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密码 *