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

  async byOpenId(openid, saasMerchantId) {
    var sql = `SELECT * FROM ${this.model.tableName} WHERE openid = :openid AND saas_merchant_id = :saasMerchantId AND deleted_at IS NULL`;
    var list = await this.customQuery(sql, {
      openid: openid,
      saasMerchantId: saasMerchantId,
    });
    if (!list || list.length == 0) {
      return null;
    }
    return list[0];
  }

}
module.exports = SaasMerchantAppletUserDao;