const Dao = require("../../dao.base");
const system = require("../../../system");
class ApplyDao extends Dao {
  constructor() {
    super(Dao.getModelName(ApplyDao));
    this.statusMap = {
      "0090": "未付款",
      "1000": "待审核",
      "1010": "审核不通过",
      "1020": "待分配",
      "1030": "待处理",
      "1040": "交付商关闭",
      "1050": "已开具",
      "1060": "待审核",
      "1070": "审核通过",
      "1080": "已邮寄",
      "1090": "完成",
      "1100": "发票撤回",
      "1200": "红冲",
      "1300": "审核失败(平台第二次审核)"
    };

    this.customerMap = {
      "0090": "未付款",
      "1000": "待审核",
      "1030": "待处理",
      "1050": "已开具",
      "1090": "完成"
    };

    this.deliverMap = {
      "1030": "待处理",
      "1040": "交付商关闭",
      "1050": "已开具",
      "1060": "待审核",
      "1080": "已邮寄",
      "1300": "审核失败(平台第二次审核)"
    }
  }


  async findMapByIds(ids, attrs) {
    var result = {};
    if (!ids || ids.length == 0) {
      return result;
    }

    attrs = attrs || "*";
    var sql = "SELECT " + attrs + " FROM invoice_apply where id IN (:ids) ";
    var list = await this.customQuery(sql, { ids: ids });
    if (!list || list.length == 0) {
      return result;
    }

    for (var item of list) {
      result[item.id] = item;
    }

    return result;
  }
}
module.exports = ApplyDao;
