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

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

  /**
   * fn:
   * @param params
   * @returns {Promise<void>}
   */
  async cschemes(params){
    let sql =[];
    sql.push('SELECT * FROM c_scheme WHERE 1 = 1 ');
    this.setCscheme(sql,params);
    return await this.customQuery(sql.join(" "), params);
  }

  setCscheme(sql,params){
    if(params.id){
      sql.push(`and id=:id`);
    }
    if(params.ids && params.ids.length>0){
      sql.push(`and id in(:ids)`);
    }
    if(params.deliver_id){
      sql.push(`and deliver_id =:deliver_id`);
    }
  }

}

module.exports = CschemeDao;
