mirror of
https://github.com/RemainderTime/spring-boot-base-demo.git
synced 2026-06-05 01:17:49 +08:00
fix(security): 统一异常处理响应格式并完善拦截器配置
- 将全局异常处理器中的返回类型从 GenericResponse 统一为 RetObj - 更新登录、权限、角色异常的错误消息为中文提示 - 在拦截器配置中添加 swagger-ui 相关路径的排除规则 - 将拦截器中的 postHandle 方法改为 afterCompletion 以确保请求结束后清理 ThreadLocal - 修复 StpInterfaceImpl 中的类型转换问题,确保用户ID正确转换为Long类型
This commit is contained in:
@@ -35,6 +35,7 @@ public class StpInterfaceImpl implements StpInterface {
|
||||
@Override
|
||||
public List<String> getRoleList(Object userId, String s) {
|
||||
// 获取用户角色数据
|
||||
return sysRoleMapper.getRoleListByUserId((Long) userId);
|
||||
Long uId = Long.valueOf(userId.toString());
|
||||
return sysRoleMapper.getRoleListByUserId(uId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user