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

  async mapByOrderIdsAndStatus(orderIds, statuses) {
    var result = {};
    if(!orderIds || orderIds.length == 0 || !statuses || statuses.length == 0) {
      return result;
    }
    let sql = [];
    sql.push("SELECT");
    sql.push("*");
    sql.push("FROM `o_order_process`");
    sql.push("WHERE order_id IN (:orderIds)");
    sql.push("AND `status` IN (:statuses)");

    let list = await this.customQuery(sql.join(" "), {orderIds: orderIds, statuses: statuses});

    if (!list || list.length == 0) {
      return result;
    }

    for (let item of list) {
      result[item.order_id + "_" + item.status] = item;
    }
    return result;
  }
}
module.exports = OorderprocessDao;
