mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-10 20:57:18 +08:00
fix(extension/tenant): 修复部分错误
This commit is contained in:
@@ -22,6 +22,7 @@ import top.continew.starter.extension.tenant.context.TenantContext;
|
|||||||
* 租户提供者
|
* 租户提供者
|
||||||
*
|
*
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
|
* @author 小熊
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*/
|
*/
|
||||||
public interface TenantProvider {
|
public interface TenantProvider {
|
||||||
|
@@ -54,7 +54,7 @@ public class TenantAutoConfiguration {
|
|||||||
private static final Logger log = LoggerFactory.getLogger(TenantAutoConfiguration.class);
|
private static final Logger log = LoggerFactory.getLogger(TenantAutoConfiguration.class);
|
||||||
private final TenantProperties tenantProperties;
|
private final TenantProperties tenantProperties;
|
||||||
|
|
||||||
private TenantAutoConfiguration(TenantProperties tenantProperties) {
|
public TenantAutoConfiguration(TenantProperties tenantProperties) {
|
||||||
this.tenantProperties = tenantProperties;
|
this.tenantProperties = tenantProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,7 +65,10 @@ public class TenantDataSourceAdvisor extends AbstractPointcutAdvisor implements
|
|||||||
*/
|
*/
|
||||||
private Pointcut buildPointcut() {
|
private Pointcut buildPointcut() {
|
||||||
AspectJExpressionPointcut cut = new AspectJExpressionPointcut();
|
AspectJExpressionPointcut cut = new AspectJExpressionPointcut();
|
||||||
cut.setExpression("execution(* *..controller..*(..))");
|
cut.setExpression("""
|
||||||
|
execution(* *..controller..*(..))
|
||||||
|
&& !@annotation(top.continew.starter.extension.tenant.annotation.TenantDataSourceIgnore)
|
||||||
|
""");
|
||||||
return new ComposablePointcut((Pointcut)cut);
|
return new ComposablePointcut((Pointcut)cut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -55,8 +55,10 @@ public class DefaultTenantLineHandler implements TenantLineHandler {
|
|||||||
@Override
|
@Override
|
||||||
public boolean ignoreTable(String tableName) {
|
public boolean ignoreTable(String tableName) {
|
||||||
Long tenantId = TenantContextHolder.getTenantId();
|
Long tenantId = TenantContextHolder.getTenantId();
|
||||||
if ((null != tenantId && tenantId.equals(tenantProperties
|
if (null != tenantId && tenantId.equals(tenantProperties.getSuperTenantId())) {
|
||||||
.getSuperTenantId())) || TenantIsolationLevel.DATASOURCE.equals(TenantContextHolder.getIsolationLevel())) {
|
return true;
|
||||||
|
}
|
||||||
|
if (TenantIsolationLevel.DATASOURCE.equals(TenantContextHolder.getIsolationLevel())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return CollUtil.contains(tenantProperties.getIgnoreTables(), tableName);
|
return CollUtil.contains(tenantProperties.getIgnoreTables(), tableName);
|
||||||
|
Reference in New Issue
Block a user