From 6892fa6d8e62a4d595e72a2a13086870e4caa2f3 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Mon, 26 Feb 2024 16:29:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shxy/xymanager_common/constant/Constants.java | 4 ++++ .../com/shxy/xymanager_service/impl/RoleServiceImpl.java | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java index 79fcac4..f6aa9ff 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java @@ -199,5 +199,9 @@ public class Constants { */ public static AtomicInteger REQUEST_ID = new AtomicInteger((int) (System.currentTimeMillis() / 1000 - 1672502400)); // Based On 2023-01-01 00:00:00 + /** + * 超级管理员 + */ + public static int SUPER_ADMIN = 1; } \ No newline at end of file diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/RoleServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/RoleServiceImpl.java index 16a3a16..d1e3f9b 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/RoleServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/RoleServiceImpl.java @@ -15,13 +15,13 @@ import javax.annotation.Resource; import java.util.Date; import java.util.List; +import static com.shxy.xymanager_common.constant.Constants.SUPER_ADMIN; + @Service @Slf4j @Transactional(rollbackFor = Exception.class) public class RoleServiceImpl implements RoleService { - int adminId = 1; - @Resource TbRoleMapper roleMapper; @Resource @@ -63,7 +63,7 @@ public class RoleServiceImpl implements RoleService { @Override public void changePermission(Integer roleId, List list) throws Exception { - if (roleId == adminId) { + if (roleId == SUPER_ADMIN) { throw new Exception("不能修改admin的权限"); } TbPermissionExample example = new TbPermissionExample();