疯狂的狮子li
2021-08-09 9bfa420a764f19750cbd91df897fc6ae6fd0f1cc
ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java
@@ -9,11 +9,41 @@
/**
 * 安全服务工具类
 *
 *
 * @author ruoyi
 */
public class SecurityUtils
{
    /**
     * 用户ID
     **/
    public static Long getUserId()
    {
        try
        {
            return getLoginUser().getUserId();
        }
        catch (Exception e)
        {
            throw new CustomException("获取用户ID异常", HttpStatus.UNAUTHORIZED);
        }
    }
    /**
     * 获取部门ID
     **/
    public static Long getDeptId()
    {
        try
        {
            return getLoginUser().getDeptId();
        }
        catch (Exception e)
        {
            throw new CustomException("获取部门ID异常", HttpStatus.UNAUTHORIZED);
        }
    }
    /**
     * 获取用户账户
     **/
@@ -79,7 +109,7 @@
    /**
     * 是否为管理员
     *
     *
     * @param userId 用户ID
     * @return 结果
     */