Commit b374fe61 by 王昆

gsb

parent de6eefd0
...@@ -11,5 +11,22 @@ class RoleauthDao extends Dao { ...@@ -11,5 +11,22 @@ class RoleauthDao extends Dao {
role_id: role_id role_id: role_id
}, t) || []; }, t) || [];
} }
async authIdsByRoleIds(roleIds) {
if (!roleIds || roleIds.length == 0) {
return [];
}
let sql = "SELECT auth_id FROM uc_role_auth WHERE role_id IN (:roleIds)";
let roles = await this.customQuery(sql, {roleIds: roleIds});
if (!roles || roles.length == 0) {
return [];
}
let rs = [];
for (let role of roles) {
rs.push(role.auth_id);
}
return rs;
}
} }
module.exports = RoleauthDao; module.exports = RoleauthDao;
\ No newline at end of file
...@@ -73,7 +73,7 @@ class AuthService extends ServiceBase { ...@@ -73,7 +73,7 @@ class AuthService extends ServiceBase {
async tree(params) { async tree(params) {
try { try {
var all = await this.dao.all(params.saas_id, "id,name,path,pid,icon"); var all = await this.dao.all(params.saas_id);
var pmap = {}; var pmap = {};
for (var item of all) { for (var item of all) {
......
...@@ -183,6 +183,9 @@ class RoleService extends ServiceBase { ...@@ -183,6 +183,9 @@ class RoleService extends ServiceBase {
if(!_role){ if(!_role){
return system.getResult(-1,`角色不存在`); return system.getResult(-1,`角色不存在`);
} }
// 查询角色关联权限ids
await this.roleauthDao.
this.handleDate(_role,['created_at'],null,-8); this.handleDate(_role,['created_at'],null,-8);
this.handleDate(_role,['updated_at'],null,-8); this.handleDate(_role,['updated_at'],null,-8);
return system.getResult(_role); return system.getResult(_role);
......
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