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

  async findListByPid(pid) {
    let sql = "SELECT * FROM o_product WHERE pid = :pid ORDER BY sort ASC";
    return await this.customQuery(sql, {pid: pid});
  }

  async findMapByPid(pid) {
    let result = {};
    let list = await this.findListByPid(pid);
    if (!list || list.length == 0) {
      return result;
    }

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

}
module.exports = OproductDao;