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

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package top.continew.starter.extension.tenant.handler; package top.continew.starter.extension.tenant;
import top.continew.starter.extension.tenant.config.TenantDataSource; import top.continew.starter.extension.tenant.config.TenantDataSource;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package top.continew.starter.extension.tenant.handler; package top.continew.starter.extension.tenant;
/** /**
* 租户处理器 * 租户处理器

View File

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

View File

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

View File

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

View File

@@ -17,6 +17,8 @@
package top.continew.starter.extension.tenant.handler; package top.continew.starter.extension.tenant.handler;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; 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.autoconfigure.TenantProperties;
import top.continew.starter.extension.tenant.config.TenantProvider; import top.continew.starter.extension.tenant.config.TenantProvider;
import top.continew.starter.extension.tenant.context.TenantContext; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import top.continew.starter.extension.tenant.config.TenantDataSource; 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; import javax.sql.DataSource;

View File

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