Commit f7ecff90 by 孙亚楠

dd

parent 78a765c4
...@@ -56,6 +56,9 @@ class ActionAPI extends APIBase { ...@@ -56,6 +56,9 @@ class ActionAPI extends APIBase {
case "listSaas": case "listSaas":
opResult = await this.saasSve.apiListSaas(action_body); opResult = await this.saasSve.apiListSaas(action_body);
break; break;
case "saasQueryById":
opResult = await this.saasSve.apiQueryById(action_body);
break;
// 组织机构 // 组织机构
case "addOrg": case "addOrg":
...@@ -70,8 +73,8 @@ class ActionAPI extends APIBase { ...@@ -70,8 +73,8 @@ class ActionAPI extends APIBase {
case "listOrg": case "listOrg":
opResult = await this.orgSve.apiListOrg(action_body); opResult = await this.orgSve.apiListOrg(action_body);
break; break;
case "findById": case "orgQueryById":
opResult = await this.orgSve.apiFindById(action_body); opResult = await this.orgSve.apiQueryById(action_body);
break; break;
case "byPid": case "byPid":
opResult = await this.orgSve.apiByPid(action_body); opResult = await this.orgSve.apiByPid(action_body);
...@@ -82,20 +85,20 @@ class ActionAPI extends APIBase { ...@@ -82,20 +85,20 @@ class ActionAPI extends APIBase {
// 菜单权限 // 菜单权限
case "addAuth": case "addAuth":
return this.authSve.add(action_body); opResult = this.authSve.add(action_body);
break; break;
case "updAuth": case "updAuth":
return this.authSve.upd(action_body); opResult = this.authSve.upd(action_body);
break; break;
case "tree": case "tree":
return this.authSve.tree(action_body); opResult = this.authSve.tree(action_body);
break; break;
case "byPid": case "byPid":
return this.authSve.byPid(action_body); opResult = this.authSve.byPid(action_body);
break; break;
case "delAuth": case "delAuth":
// TODO 验证是否有角色关联 // TODO 验证是否有角色关联
return this.authSve.del(action_body); opResult = this.authSve.del(action_body);
break; break;
// 角色 // 角色
...@@ -111,6 +114,9 @@ class ActionAPI extends APIBase { ...@@ -111,6 +114,9 @@ class ActionAPI extends APIBase {
case "listRole": case "listRole":
opResult = await this.roleSve.apiListRole(action_body); opResult = await this.roleSve.apiListRole(action_body);
break; break;
case "roleQueryById":
opResult = await this.roleSve.apiQueryById(action_body);
break;
// 用户 // 用户
case "addUser": case "addUser":
......
...@@ -67,7 +67,7 @@ class OrgService extends ServiceBase { ...@@ -67,7 +67,7 @@ class OrgService extends ServiceBase {
* 根据ID查明细 * 根据ID查明细
* @param {*} params * @param {*} params
*/ */
async apiFindById(params){ async apiQueryById(params){
try { try {
return await this.queryById(params) return await this.queryById(params)
} catch (error) { } catch (error) {
...@@ -249,13 +249,21 @@ class OrgService extends ServiceBase { ...@@ -249,13 +249,21 @@ class OrgService extends ServiceBase {
} }
async byPid(obj) { async byPid(obj) {
try {
var list = await this.dao.findAll({ var list = await this.dao.findAll({
pid: obj.pid || 0, pid: obj.pid || 0,
}); });
return list; return system.getResult(list);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
} }
/**
* 结构树
*/
async tree() { async tree() {
try {
var all = await this.dao.all(); var all = await this.dao.all();
var pmap = {}; var pmap = {};
for (var item of all) { for (var item of all) {
...@@ -265,17 +273,15 @@ class OrgService extends ServiceBase { ...@@ -265,17 +273,15 @@ class OrgService extends ServiceBase {
} }
list.push(item); list.push(item);
pmap[item.pid] = list; pmap[item.pid] = list;
if (item.pid === 0) {
tree = item;
}
console.log(item.pid);
} }
for(var item of all) { for(var item of all) {
item.childs = pmap[item.id] || []; item.childs = pmap[item.id] || [];
} }
return system.getResult(pmap[0]);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
return pmap[0];
} }
} }
module.exports = OrgService; module.exports = OrgService;
\ No newline at end of file
...@@ -17,6 +17,14 @@ class RoleService extends ServiceBase { ...@@ -17,6 +17,14 @@ class RoleService extends ServiceBase {
} }
} }
async apiQueryById(params){
try {
return await this.queryById(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/** /**
* role 更新 * role 更新
* @param {*} params * @param {*} params
...@@ -136,6 +144,25 @@ class RoleService extends ServiceBase { ...@@ -136,6 +144,25 @@ class RoleService extends ServiceBase {
} }
/** /**
* 根据ID查询明细
* @param {*} params
*/
async queryById(params){
try {
if(!params.id){
return system.getResult(-1,`参数错误 ID不能为空`);
}
let _role = await this.findById(this.trim(params.id));
if(!_role){
return system.getResult(-1,`角色不存在`);
}
return system.getResult(_role);
} catch (error) {
return system.getResult(-1, `系统错误 错误信息${error}`);
}
}
/**
* 查询列表 * 查询列表
* @param {*} params * @param {*} params
*/ */
......
...@@ -53,8 +53,17 @@ class SaasService extends ServiceBase { ...@@ -53,8 +53,17 @@ class SaasService extends ServiceBase {
} }
} }
/**
* asss明细
* @param {*} params
*/
async apiQueryById(params){
try {
return this.queryById(params);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
/********************************************************************** */ /********************************************************************** */
...@@ -168,5 +177,20 @@ class SaasService extends ServiceBase { ...@@ -168,5 +177,20 @@ class SaasService extends ServiceBase {
return system.getResult(-1,`系统错误 错误信息 ${error}`); return system.getResult(-1,`系统错误 错误信息 ${error}`);
} }
} }
async queryById(params){
try {
if(!params.id){
return system.getResult(-1,`参数错误 ID不能为空`);
}
let _saas = await this.findById(this.trim(params.id));
if(!_saas){
return system.getResult(-1,`当前信息不存在`);
}
return system.getResult(_saas);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
} }
module.exports = SaasService; module.exports = SaasService;
\ No newline at end of file
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