Skip to content

Commit

Permalink
fix(extension/tenant): 修复部分错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Dec 24, 2024
1 parent c5cb203 commit 88d1102
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* 租户提供者
*
* @author Charles7c
* @author 小熊
* @since 2.7.0
*/
public interface TenantProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
*/
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ public String getTenantIdColumn() {
@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);
Expand Down

0 comments on commit 88d1102

Please sign in to comment.