From 731adca2395fd016d26790251f37aac0c98f9146 Mon Sep 17 00:00:00 2001 From: caojianbin <1910336823> Date: Thu, 4 Aug 2022 11:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=A8=A1=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/security/utils/SecurityUtils.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java index 78a5393..34f0dda 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java @@ -25,6 +25,15 @@ public class SecurityUtils } /** + * yisai获取用户ID + */ + public static String getStringUserId() + { + return SecurityContextHolder.getStringUserId(); + } + + + /** * 获取用户名称 */ public static String getUsername() @@ -90,6 +99,18 @@ public class SecurityUtils return userId != null && 1L == userId; } + + /** + * yisai是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdminString(String userId) + { + return userId != null && "1".equals(userId); + } + /** * 生成BCryptPasswordEncoder密码 *