Commit 37358d6b by wangxin

权限接口

parent 3579affe
...@@ -49,12 +49,6 @@ public class SystemMailboxController { ...@@ -49,12 +49,6 @@ public class SystemMailboxController {
@GetMapping("hasPermission") @GetMapping("hasPermission")
public Boolean hasPermission(){ public Boolean hasPermission(){
Page<SystemMailboxParamVo> page = systemMailboxService.selectMyPage(1, 1, 2); return systemMailboxService.hasPermission();
// 如果能正常获取到数据且total大于0,说明用户有权限
if (page != null && page.getTotal() > 0) {
return true;
}
// 如果total为0,说明用户没有权限查看信箱
return false;
} }
} }
\ No newline at end of file
...@@ -169,12 +169,18 @@ public class SystemMailboxServiceImpl extends ServiceImpl<SystemMailboxMapper,Sy ...@@ -169,12 +169,18 @@ public class SystemMailboxServiceImpl extends ServiceImpl<SystemMailboxMapper,Sy
@Override @Override
public Boolean hasPermission() { public Boolean hasPermission() {
Page<SystemMailboxParamVo> page = selectMyPage(1, 1, 2); Long accountId = ContextHolder.get().getAccountId();
// 如果能正常获取到数据且total大于0,说明用户有权限 List<Long> roleIds = myItemConfigmapper.getJjXxRoleCount(accountId);
if (page != null && page.getTotal() > 0) { Integer roleType = null;//信箱类型 1: 纪检 2: 书记,null没权限看 纪检和书记,只能看自己的
return true; if(CollectionUtil.isNotEmpty(roleIds)){
if(roleIds.contains(1877604582759526400L)&&!roleIds.contains(1877605828904022016L)){
roleType = 2;
}
if(!roleIds.contains(1877604582759526400L)&&roleIds.contains(1877605828904022016L)){
roleType = 1;
}
} }
// 如果total为0,说明用户没有权限查看信箱 //
return false; return roleType != null;
} }
} }
\ 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