update 优化 统一补全代码注释

This commit is contained in:
疯狂的狮子Li
2026-03-13 19:36:14 +08:00
parent 916282ba68
commit 48992b574d
201 changed files with 2554 additions and 465 deletions

View File

@@ -22,7 +22,11 @@ import java.util.List;
public class SaPermissionImpl implements StpInterface {
/**
* 获取菜单权限列表
* 获取指定登录对象的菜单权限列表
*
* @param loginId 登录ID
* @param loginType 登录类型
* @return 菜单权限列表
*/
@Override
public List<String> getPermissionList(Object loginId, String loginType) {
@@ -49,7 +53,11 @@ public class SaPermissionImpl implements StpInterface {
}
/**
* 获取角色权限列表
* 获取指定登录对象的角色权限列表
*
* @param loginId 登录ID
* @param loginType 登录类型
* @return 角色权限列表
*/
@Override
public List<String> getRoleList(Object loginId, String loginType) {
@@ -75,6 +83,11 @@ public class SaPermissionImpl implements StpInterface {
}
}
/**
* 获取权限服务实现。
*
* @return 权限服务
*/
private PermissionService getPermissionService() {
try {
return SpringUtils.getBean(PermissionService.class);

View File

@@ -20,7 +20,11 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
public class SaTokenExceptionHandler {
/**
* 权限码异常
* 处理权限码校验失败异常
*
* @param e 异常信息
* @param request 当前请求
* @return 统一失败响应
*/
@ExceptionHandler(NotPermissionException.class)
public R<Void> handleNotPermissionException(NotPermissionException e, HttpServletRequest request) {
@@ -30,7 +34,11 @@ public class SaTokenExceptionHandler {
}
/**
* 角色权限异常
* 处理角色权限校验失败异常
*
* @param e 异常信息
* @param request 当前请求
* @return 统一失败响应
*/
@ExceptionHandler(NotRoleException.class)
public R<Void> handleNotRoleException(NotRoleException e, HttpServletRequest request) {
@@ -40,7 +48,11 @@ public class SaTokenExceptionHandler {
}
/**
* 认证失败
* 处理未登录或登录态失效异常。
*
* @param e 异常信息
* @param request 当前请求
* @return 统一失败响应
*/
@ExceptionHandler(NotLoginException.class)
public R<Void> handleNotLoginException(NotLoginException e, HttpServletRequest request) {

View File

@@ -55,7 +55,9 @@ public class LoginHelper {
}
/**
* 获取用户(多级缓存)
* 获取当前 Token 对应的登录用户信息。
*
* @return 登录用户
*/
@SuppressWarnings("unchecked")
public static <T extends LoginUser> T getLoginUser() {
@@ -67,7 +69,10 @@ public class LoginHelper {
}
/**
* 获取用户基于token
* 根据指定 Token 获取登录用户信息。
*
* @param token Token
* @return 登录用户
*/
@SuppressWarnings("unchecked")
public static <T extends LoginUser> T getLoginUser(String token) {
@@ -79,42 +84,54 @@ public class LoginHelper {
}
/**
* 获取用户id
* 获取当前登录用户 ID。
*
* @return 用户 ID
*/
public static Long getUserId() {
return Convert.toLong(getExtra(USER_KEY));
}
/**
* 获取用户id
* 获取当前登录用户 ID 字符串。
*
* @return 用户 ID 字符串
*/
public static String getUserIdStr() {
return Convert.toStr(getExtra(USER_KEY));
}
/**
* 获取用户账户
* 获取当前登录用户名。
*
* @return 用户名
*/
public static String getUsername() {
return Convert.toStr(getExtra(USER_NAME_KEY));
}
/**
* 获取部门ID
* 获取当前登录用户部门 ID
*
* @return 部门 ID
*/
public static Long getDeptId() {
return Convert.toLong(getExtra(DEPT_KEY));
}
/**
* 获取部门名
* 获取当前登录用户部门名称。
*
* @return 部门名称
*/
public static String getDeptName() {
return Convert.toStr(getExtra(DEPT_NAME_KEY));
}
/**
* 获取部门类别编码
* 获取当前登录用户部门类别编码
*
* @return 部门类别编码
*/
public static String getDeptCategory() {
return Convert.toStr(getExtra(DEPT_CATEGORY_KEY));
@@ -135,7 +152,9 @@ public class LoginHelper {
}
/**
* 获取用户类型
* 获取当前登录用户类型
*
* @return 用户类型
*/
public static UserType getUserType() {
String loginType = StpUtil.getLoginIdAsString();
@@ -146,7 +165,7 @@ public class LoginHelper {
* 是否为超级管理员
*
* @param userId 用户ID
* @return 结果
* @return 是否为超级管理员
*/
public static boolean isSuperAdmin(Long userId) {
return SystemConstants.SUPER_ADMIN_ID.equals(userId);
@@ -155,7 +174,7 @@ public class LoginHelper {
/**
* 是否为超级管理员
*
* @return 结果
* @return 是否为超级管理员
*/
public static boolean isSuperAdmin() {
return isSuperAdmin(getUserId());
@@ -164,7 +183,7 @@ public class LoginHelper {
/**
* 检查当前用户是否已登录
*
* @return 结果
* @return 是否已登录
*/
public static boolean isLogin() {
try {