const Dao = require("../../dao.base");

class MerchantDao extends Dao {
    constructor() {
        super(Dao.getModelName(MerchantDao));
    }

    async suggest(name) {
        if (!name) {
            return [];
        }
        var sql = "SELECT id, name FROM `e_merchant` WHERE name LIKE :queryLike AND deleted_at IS NULL ";
        sql = sql + " ORDER BY id ASC LIMIT 10";
        var list = await this.customQuery(sql, {queryLike: "%" + name + "%"});
        return list || [];
    }
}

module.exports = MerchantDao;
