Commit d8e14779 by 王昆

gsb

parent 6a3a4d08
......@@ -80,6 +80,9 @@ class ActionAPI extends APIBase {
opResult = await this.saaschannelSve.mapByIds(action_body);
break;
// 商户
case "mchtIdsLikeName":
opResult = await this.saasmerchantSve.idsLikeName(action_body);
break;
case "mchtMapByIds":
opResult = await this.saasmerchantSve.mapByIds(action_body);
break;
......
......@@ -5,6 +5,35 @@ class SaasMerchantDao extends Dao {
super(Dao.getModelName(SaasMerchantDao));
}
async idsLikeName(params) {
// name, saas_id, saas_merchant_id
let sql = [];
sql.push("SELECT");
sql.push("id");
sql.push("FROM");
sql.push(this.model.tableName);
sql.push("WHERE name LIKE :name");
if (params.saas_id) {
sql.push("AND saas_id = :saas_id");
}
if (params.saas_merchant_id) {
sql.push("AND saas_merchant_id = :saas_merchant_id");
}
// 最多查1000条
sql.push("LIMIT 1000");
let list = await this.customQuery(sql.join(" "), params) || [];
if (list.length == 0) {
return list;
}
let ids = [];
for (let item of list) {
ids.push(item.id);
}
return ids;
}
async listByIds(ids, attrs) {
if (!ids || ids.length == 0) {
return [];
......
......@@ -10,6 +10,19 @@ class SaasMerchantService extends ServiceBase {
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async idsLikeName(params) {
let name = this.trim(params.name);
let saas_id = this.trim(params.saas_id);
let saas_merchant_id = this.trim(params.saas_merchant_id);
let ids = await this.dao.idsLikeName({
name: `%${name}%`,
saas_id: saas_id,
saas_merchant_id: saas_merchant_id
});
return system.getResultSuccess(ids);
}
async mapByIds(params) {
if (!params.ids || params.ids.length == 0) {
return system.getResultSuccess({});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment