const system=require("../../system");
const Dao=require("../dao.base");
class EtemplateDao extends Dao{
  constructor(){
    super(Dao.getModelName(EtemplateDao));
  }

  extraModelFilter(){
    //return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"],joinTableAttributes:['created_at']}]};
    return {"key":"include","value":[{model:this.db.models.ecompany,attributes:["id","name"]}]};
  }

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