fix(security): 统一异常处理响应格式并完善拦截器配置

- 将全局异常处理器中的返回类型从 GenericResponse 统一为 RetObj
- 更新登录、权限、角色异常的错误消息为中文提示
- 在拦截器配置中添加 swagger-ui 相关路径的排除规则
- 将拦截器中的 postHandle 方法改为 afterCompletion 以确保请求结束后清理 ThreadLocal
- 修复 StpInterfaceImpl 中的类型转换问题,确保用户ID正确转换为Long类型
This commit is contained in:
海言
2026-05-28 16:00:05 +08:00
parent 84f67fa96b
commit 11a70628ce
4 changed files with 16 additions and 13 deletions

View File

@@ -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);
}
}