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

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

    extraWhere(qobj, qw, qc) {
        qc.raw = true;
        return qw;
    }

    async delByDay(statDay) {
        if (!statDay) {
            return;
        }
        var sql = "DELETE FROM `c_busi_stat` WHERE stat_day = " + Number(statDay);
        return await this.customExecAddOrPutSql(sql);
    }

    async updateDepartmentName(params) {
        let sql = "UPDATE `c_busi_stat` SET user_name = :user_name, user_id=:user_id, user_department_name= :user_department_name WHERE busi_id IN (:busiIds)";
        return await this.customExecAddOrPutSql(sql, {replacements: params});
    }
}

module.exports = BusistatDao;
