Commit 887cf2eb authored by chenyuxi's avatar chenyuxi

feat: 部门删除更新权限

parent 2a91ac40
......@@ -561,6 +561,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
*/
@Override
public R<String> removeCspDeptById(Long deptId) {
SysDept findInfo = baseMapper.selectById(deptId);
if (Common.isEmpty(findInfo)) {
return R.failed("部门未找到");
}
int hasChild = baseMapper.hasChildByDeptId(deptId);
if (hasChild > 0) {
return R.failed("存在下级部门,不允许删除");
......@@ -570,8 +574,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
return R.failed("部门下仍然有员工,请调出所有员工后,删除部门");
}
this.removeById(deptId);
// 清理用户权限,重新获取用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByDeptId(deptId.toString());
// 清理用户权限,重新获取项目下的用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByProjectNo(findInfo.getProjectNo());
if (Common.isNotNull(userNames)){
for (String us:userNames){
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ us);
......
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