修改:

1.修改检查账号权限的ErrorCode枚举值
2.修改拦截器通配符
3.修改 sql 日志打印
This commit is contained in:
2025-06-20 20:15:06 +08:00
parent 10ffc506ae
commit 1410d16bb5
3 changed files with 7 additions and 19 deletions

View File

@@ -10,11 +10,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class SaTokenConfigure implements WebMvcConfigurer { public class SaTokenConfigure implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
// 注册Sa-Token的拦截器 // 注册Sa-Token的拦截器
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
.addPathPatterns("/**") .addPathPatterns("/api/**")
.excludePathPatterns(getExcludePaths()); .excludePathPatterns(getExcludePaths());
} }

View File

@@ -38,7 +38,6 @@ public class UserController {
if (user == null) { if (user == null) {
throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR); throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR);
} }
if (!usersService.isPasswordMatch(usersDTO.getPassword(), user.getPassword())) { if (!usersService.isPasswordMatch(usersDTO.getPassword(), user.getPassword())) {
throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR); throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR);
} }
@@ -49,8 +48,8 @@ public class UserController {
if (usersService.isExpired(usersDTO.getTenantId())){ if (usersService.isExpired(usersDTO.getTenantId())){
throw new BusinessException(ErrorCode.PACKAGE_EXPIRED); throw new BusinessException(ErrorCode.PACKAGE_EXPIRED);
} }
if (usersService.checkCrawlRole(user.getId())){ if (!usersService.checkCrawlRole(user.getId())){
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR); throw new BusinessException(ErrorCode.LOGIN_NOW_ALLOWED);
} }
Long second = usersService.getTenantExpiredTime(usersDTO.getTenantId()); Long second = usersService.getTenantExpiredTime(usersDTO.getTenantId());
SystemUsersVO systemUsersVO = new SystemUsersVO(); SystemUsersVO systemUsersVO = new SystemUsersVO();

View File

@@ -42,7 +42,7 @@ server:
mybatis-plus: mybatis-plus:
configuration: configuration:
map-underscore-to-camel-case: false map-underscore-to-camel-case: false
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl log-impl: org.apache.ibatis.logging.log4j2.Log4j2Impl
log-sql: log-sql:
default-executor-type: batch default-executor-type: batch
global-config: global-config:
@@ -108,19 +108,5 @@ sa-token:
# 是否输出操作日志 # 是否输出操作日志
is-log: true is-log: true
# security配置如果使用了Spring security或者satoken需要添加排除路径
security:
# 排除路径
excludes:
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /favicon.ico
- /error/**
#swagger文档和knife4j的路径
- /v3/api-docs/**
- /doc.html/**
md5: md5:
salt: (-FhqvXO,wMz salt: (-FhqvXO,wMz