工具类
This commit is contained in:
@ -9,7 +9,7 @@ import com.ruoyi.common.exception.CustomException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 安全服务工具类
|
* 安全服务工具类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SecurityUtils
|
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
|
* @param userId 用户ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user