Commit 32b53617 by 王昆

gbs

parent e702cf52
......@@ -28,14 +28,6 @@ class SaasChannelDao extends Dao {
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){
let sql = [];
sql.push("select * from saas_channel where 1=1");
......
......@@ -28,12 +28,17 @@ class SaasMainDao extends Dao {
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 dics(params) {
let sql = [];
sql.push("SELECT");
sql.push(params.attrs || "*");
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;
......@@ -57,12 +57,17 @@ class SaasMerchantDao extends Dao {
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 dics(params) {
let sql = [];
sql.push("SELECT");
sql.push(params.attrs || "*");
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) {
......
......@@ -12,7 +12,8 @@ class SaasMainService extends ServiceBase {
if (!saas_id) {
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);
}
......
......@@ -38,7 +38,8 @@ class SaasMerchantService extends ServiceBase {
if (!saas_id) {
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);
}
......
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