工具类

This commit is contained in:
zt
2025-02-19 16:06:17 +08:00
parent 10e5eaf242
commit 3ae103157b

View File

@ -9,7 +9,7 @@ import com.ruoyi.common.exception.CustomException;
/**
* 安全服务工具类
*
*
* @author ruoyi
*/
public class SecurityUtils
@ -29,6 +29,21 @@ public class SecurityUtils
}
}
/**
* 获取用户账户
**/
public static Long getAppUserId()
{
try
{
return getLoginUser().getUser().getUserId();
}
catch (Exception e)
{
throw new CustomException("获取用户账户异常", HttpStatus.HTTP_UNAUTHORIZED);
}
}
/**
* 获取用户
**/
@ -79,7 +94,7 @@ public class SecurityUtils
/**
* 是否为管理员
*
*
* @param userId 用户ID
* @return 结果
*/