|
@@ -212,6 +212,19 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
} else if (Objects.nonNull(schoolId)) {
|
|
} else if (Objects.nonNull(schoolId)) {
|
|
role.setSchoolId(schoolId);
|
|
role.setSchoolId(schoolId);
|
|
}
|
|
}
|
|
|
|
+ // 系统默认内置角色(不允许和系统默认角色重名)
|
|
|
|
+ List<String> defaultRoleNames = this.list(new QueryWrapper<SysRole>().lambda()
|
|
|
|
+ .eq(SysRole::getDefaultRole,true)
|
|
|
|
+ .eq(SysRole::getEnable,true))
|
|
|
|
+ .stream()
|
|
|
|
+ .map(SysRole::getName)
|
|
|
|
+ .distinct()
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ String roleName = role.getName();
|
|
|
|
+ if (defaultRoleNames.contains(roleName)){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("自定义角色名称不能和系统默认角色【" + roleName + "】同名");
|
|
|
|
+ }
|
|
|
|
+
|
|
if (Objects.nonNull(role.getId())) {//编辑
|
|
if (Objects.nonNull(role.getId())) {//编辑
|
|
List<SysRolePrivilege> sysRolePrivilegeList = commonCacheService.rolePrivilegeCache(role.getId());
|
|
List<SysRolePrivilege> sysRolePrivilegeList = commonCacheService.rolePrivilegeCache(role.getId());
|
|
QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
|