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

  /* 插入状态信息信息*/
  async insertInfo(qobj, t) {
    const obj = {
      flow_type: qobj.flowType,
      flow_id: qobj.flowId,
      status_code: qobj.statusCode,
    };
    if (qobj.statusReason && qobj.statusReason != 'undefined') {
      obj.status_reason = qobj.statusReason;
    } else {
      obj.status_reason = '';
    }
    if (qobj.clerkName && qobj.clerkName != 'undefined') {
      obj.salesman_name = qobj.clerkName;
    }
    if (qobj.clerkId && qobj.clerkId != 'undefined') {
      obj.salesman_id = qobj.clerkId;
    }
    return await this.create(obj, t);
  }
}
module.exports = StatuslogDao;
