mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 20:57:23 +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 小熊
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public interface TenantProvider {
|
||||
|
@@ -54,7 +54,7 @@ public class TenantAutoConfiguration {
|
||||
private static final Logger log = LoggerFactory.getLogger(TenantAutoConfiguration.class);
|
||||
private final TenantProperties tenantProperties;
|
||||
|
||||
private TenantAutoConfiguration(TenantProperties tenantProperties) {
|
||||
public TenantAutoConfiguration(TenantProperties tenantProperties) {
|
||||
this.tenantProperties = tenantProperties;
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,10 @@ public class TenantDataSourceAdvisor extends AbstractPointcutAdvisor implements
|
||||
*/
|
||||
private Pointcut buildPointcut() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -55,8 +55,10 @@ public class DefaultTenantLineHandler implements TenantLineHandler {
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
if ((null != tenantId && tenantId.equals(tenantProperties
|
||||
.getSuperTenantId())) || TenantIsolationLevel.DATASOURCE.equals(TenantContextHolder.getIsolationLevel())) {
|
||||
if (null != tenantId && tenantId.equals(tenantProperties.getSuperTenantId())) {
|
||||
return true;
|
||||
}
|
||||
if (TenantIsolationLevel.DATASOURCE.equals(TenantContextHolder.getIsolationLevel())) {
|
||||
return true;
|
||||
}
|
||||
return CollUtil.contains(tenantProperties.getIgnoreTables(), tableName);
|
||||
|
Reference in New Issue
Block a user