const system=require("../../system");
const Dao=require("../dao.base");
class InvoiceDao extends Dao{
  constructor(){
    super(Dao.getModelName(InvoiceDao));
  }
  extraWhere(obj,w,qc,linkAttrs){
    if(obj.codepath && obj.codepath!=""){
      if(obj.codepath.indexOf("msginvoice")>0){
        
      }else{
        w["user_id"]=obj.uid;
        w["app_id"]=obj.appid;
      }
    }
    return w;
  }
  async update(obj){
    var obj2=await this.preUpdate(obj);
    await this.model.update(obj2,{where:{id:obj2.id}});
    var user=await this.model.findOne({where:{id:obj2.id}});
    return user;
  }
  async findAndCountAll(qobj,t){
    var invoices=await super.findAndCountAll(qobj,t);
    return invoices;
  }
}
module.exports=InvoiceDao;
