|
@@ -31,6 +31,7 @@ import org.springblade.core.tool.constant.RoleConstant;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.manager.entity.WbsTableOwnerRole;
|
|
import org.springblade.manager.entity.WbsTableOwnerRole;
|
|
import org.springblade.manager.vo.WbsTableOwnerRoleVO;
|
|
import org.springblade.manager.vo.WbsTableOwnerRoleVO;
|
|
import org.springblade.system.dto.RoleDTO;
|
|
import org.springblade.system.dto.RoleDTO;
|
|
@@ -328,6 +329,12 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|
if (aLong > 0) {
|
|
if (aLong > 0) {
|
|
throw new ServiceException("角色名已存在,请重新输入");
|
|
throw new ServiceException("角色名已存在,请重新输入");
|
|
}
|
|
}
|
|
|
|
+ if (ObjectUtil.isNotEmpty(role.getId())) {
|
|
|
|
+ Role roleNow = baseMapper.selectById(role.getId());
|
|
|
|
+ if (roleNow != null && roleNow.getRoleName().equals("超级管理员") && roleNow.getRoleAlias().equals("administrator")) {
|
|
|
|
+ throw new ServiceException("没有权限,超级管理员信息无法更改!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return saveOrUpdate(role);
|
|
return saveOrUpdate(role);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -356,8 +363,12 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|
if (cnt > 0L) {
|
|
if (cnt > 0L) {
|
|
throw new ServiceException("请先删除子节点!");
|
|
throw new ServiceException("请先删除子节点!");
|
|
}
|
|
}
|
|
- boolean b = removeByIds(Func.toLongList(ids));
|
|
|
|
- return b;
|
|
|
|
|
|
+ List<Role> roles = baseMapper.selectList(Wrappers.<Role>query().lambda().select(Role::getRoleName, Role::getRoleAlias).in(Role::getId, Func.toLongList(ids)));
|
|
|
|
+ List<Role> collect = roles.stream().filter(f -> f.getRoleName().equals("超级管理员") && f.getRoleAlias().equals("administrator")).collect(Collectors.toList());
|
|
|
|
+ if (collect.size() > 0) {
|
|
|
|
+ throw new ServiceException("没有权限,超级管理员无法删除!");
|
|
|
|
+ }
|
|
|
|
+ return removeByIds(Func.toLongList(ids));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|