From 8de02e285e0e90aff7fc96197cd1eb9226fd7d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 1 Nov 2023 16:41:21 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=BC=96=E8=BE=91=E4=BD=BF=E7=94=A8=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E7=AE=A1=E7=90=86=E5=91=98code=E8=B6=8A=E6=9D=83?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/system/service/impl/SysRoleServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 4f05d5ee7..b84d81fca 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -195,9 +195,12 @@ public class SysRoleServiceImpl implements ISysRoleService { if (ObjectUtil.isNotNull(role.getRoleId())) { SysRole sysRole = baseMapper.selectById(role.getRoleId()); // 如果标识符不相等 判断为修改了管理员标识符 - if (!StringUtils.equals(sysRole.getRoleKey(), role.getRoleKey()) - && StringUtils.equals(sysRole.getRoleKey(), UserConstants.ADMIN_ROLE_KEY)) { - throw new ServiceException("不允许修改系统内置管理员角色标识符!"); + if (!StringUtils.equals(sysRole.getRoleKey(), role.getRoleKey())) { + if (StringUtils.equals(sysRole.getRoleKey(), UserConstants.ADMIN_ROLE_KEY)) { + throw new ServiceException("不允许修改系统内置管理员角色标识符!"); + } else if (StringUtils.equals(role.getRoleKey(), UserConstants.ADMIN_ROLE_KEY)) { + throw new ServiceException("不允许使用系统内置管理员角色标识符!"); + } } } }