mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-13 00:57:09 +08:00
refactor(extension/tenant): 修复部分 Sonar 警告
This commit is contained in:
@@ -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;
|
||||||
|
|
@@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户处理器
|
* 租户处理器
|
@@ -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
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
|
@@ -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;
|
||||||
|
@@ -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;
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户数据源级隔离拦截器
|
* 租户数据源级隔离拦截器
|
||||||
|
Reference in New Issue
Block a user