refactor(extension/tenant): 修复部分 Sonar 警告

This commit is contained in:
2024-12-25 20:31:21 +08:00
parent f7ed2bbfb0
commit 25f499de7e
8 changed files with 12 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ package top.continew.starter.extension.tenant.annotation;
import java.lang.annotation.*;
/**
* 多租户数据源级隔离忽略注解
* 多租户忽略注解
*
* @author Charles7c
* @since 2.7.0

View File

@@ -43,10 +43,9 @@ public class TenantInterceptor implements HandlerInterceptor, Ordered {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod)handler;
TenantIgnore customAnnotation = handlerMethod.getMethodAnnotation(TenantIgnore.class);
if (customAnnotation != null) {
if (handler instanceof HandlerMethod handlerMethod) {
TenantIgnore tenantIgnore = handlerMethod.getMethodAnnotation(TenantIgnore.class);
if (tenantIgnore != null) {
return true;
}
}

View File

@@ -33,8 +33,8 @@ import org.springframework.core.ResolvableType;
import top.continew.starter.core.constant.PropertiesConstants;
import top.continew.starter.extension.tenant.config.TenantProvider;
import top.continew.starter.extension.tenant.handler.DefaultTenantHandler;
import top.continew.starter.extension.tenant.handler.TenantDataSourceHandler;
import top.continew.starter.extension.tenant.handler.TenantHandler;
import top.continew.starter.extension.tenant.TenantDataSourceHandler;
import top.continew.starter.extension.tenant.TenantHandler;
import top.continew.starter.extension.tenant.handler.datasource.DefaultTenantDataSourceHandler;
import top.continew.starter.extension.tenant.handler.datasource.TenantDataSourceAdvisor;
import top.continew.starter.extension.tenant.handler.datasource.TenantDataSourceInterceptor;

View File

@@ -17,6 +17,8 @@
package top.continew.starter.extension.tenant.handler;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import top.continew.starter.extension.tenant.TenantDataSourceHandler;
import top.continew.starter.extension.tenant.TenantHandler;
import top.continew.starter.extension.tenant.autoconfigure.TenantProperties;
import top.continew.starter.extension.tenant.config.TenantProvider;
import top.continew.starter.extension.tenant.context.TenantContext;

View File

@@ -24,7 +24,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.continew.starter.extension.tenant.config.TenantDataSource;
import top.continew.starter.extension.tenant.handler.TenantDataSourceHandler;
import top.continew.starter.extension.tenant.TenantDataSourceHandler;
import javax.sql.DataSource;

View File

@@ -21,7 +21,7 @@ import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import top.continew.starter.extension.tenant.context.TenantContextHolder;
import top.continew.starter.extension.tenant.enums.TenantIsolationLevel;
import top.continew.starter.extension.tenant.handler.TenantDataSourceHandler;
import top.continew.starter.extension.tenant.TenantDataSourceHandler;
/**
* 租户数据源级隔离拦截器