Commit 32b53617 by 王昆

gbs

parent e702cf52
...@@ -28,14 +28,6 @@ class SaasChannelDao extends Dao { ...@@ -28,14 +28,6 @@ class SaasChannelDao extends Dao {
return result; return result;
} }
async bySaasId(saasId, attrs) {
attrs = attrs || "*";
let sql = `SELECT ${attrs} FROM ${this.model.tableName} WHERE saas_id = :saasId `;
return await this.customQuery(sql, {
saasId: saasId
});
}
async findDics(params){ async findDics(params){
let sql = []; let sql = [];
sql.push("select * from saas_channel where 1=1"); sql.push("select * from saas_channel where 1=1");
......
...@@ -28,12 +28,17 @@ class SaasMainDao extends Dao { ...@@ -28,12 +28,17 @@ class SaasMainDao extends Dao {
return result; return result;
} }
async bySaasId(saasId, attrs) { async dics(params) {
attrs = attrs || "*"; let sql = [];
let sql = `SELECT ${attrs} FROM ${this.model.tableName} WHERE saas_id = :saasId `; sql.push("SELECT");
return await this.customQuery(sql, { sql.push(params.attrs || "*");
saasId: saasId sql.push("FROM");
}); sql.push(this.model.tableName);
sql.push("WHERE 1 = 1");
if (params.saas_id) {
sql.push("AND saas_id = :saas_id");
}
return await this.customQuery(sql, params);
} }
} }
module.exports = SaasMainDao; module.exports = SaasMainDao;
...@@ -57,12 +57,17 @@ class SaasMerchantDao extends Dao { ...@@ -57,12 +57,17 @@ class SaasMerchantDao extends Dao {
return result; return result;
} }
async bySaasId(saasId, attrs) { async dics(params) {
attrs = attrs || "*"; let sql = [];
let sql = `SELECT ${attrs} FROM ${this.model.tableName} WHERE saas_id = :saasId `; sql.push("SELECT");
return await this.customQuery(sql, { sql.push(params.attrs || "*");
saasId: saasId sql.push("FROM");
}); sql.push(this.model.tableName);
sql.push("WHERE 1 = 1");
if (params.saas_id) {
sql.push("AND saas_id = :saas_id");
}
return await this.customQuery(sql, params);
} }
async byChannelId(channelId, attrs) { async byChannelId(channelId, attrs) {
......
...@@ -12,7 +12,8 @@ class SaasMainService extends ServiceBase { ...@@ -12,7 +12,8 @@ class SaasMainService extends ServiceBase {
if (!saas_id) { if (!saas_id) {
return system.getResultSuccess([]); return system.getResultSuccess([]);
} }
let list = await this.dao.bySaasId(Number(params.saas_id), "id, name"); params.attrs = "id, name";
let list = await this.dao.dics(params);
return system.getResultSuccess(list); return system.getResultSuccess(list);
} }
......
...@@ -38,7 +38,8 @@ class SaasMerchantService extends ServiceBase { ...@@ -38,7 +38,8 @@ class SaasMerchantService extends ServiceBase {
if (!saas_id) { if (!saas_id) {
return system.getResultSuccess([]); return system.getResultSuccess([]);
} }
let list = await this.dao.bySaasId(Number(params.saas_id), "id, name, short_name"); params.attrs = "id, name, short_name";
let list = await this.dao.dics(params);
return system.getResultSuccess(list); return system.getResultSuccess(list);
} }
......
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