const system = require("../../system");
const ServiceBase = require("../sve.base");
class BmmerchantService extends ServiceBase {
  constructor() {
    super(ServiceBase.getDaoName(BmmerchantService));
    //this.appDao=system.getObject("db.appDao");
    this.bmmerchantcompanyDao = system.getObject("db.bmmerchantcompanyDao");
  }


  async getMerchantInfo(id) {
    var attrs = ["id", "name"];
    var merchant = await this.dao.model.findOne({
      where: { id: id }, attrs, raw: true
    });
    if(merchant) {
      merchant.companyList = await this.bmmerchantcompanyDao.findByMerchantId(id);
    }
    return merchant;
  }
}
module.exports = BmmerchantService;