提取通用方法到基类控制器

This commit is contained in:
RuoYi
2021-08-08 19:12:12 +08:00
parent fc60c003c3
commit 7736097f6b
15 changed files with 154 additions and 73 deletions

View File

@ -14,6 +14,36 @@ import com.ruoyi.common.exception.CustomException;
*/
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);
}
}
/**
* 获取用户账户
**/