From aa0382e44311f9f7e62a688c8fcaa9c69a512e0f Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 24 十二月 2024 15:15:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java index 79c8067..14060f8 100644 --- a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java +++ b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java @@ -1,10 +1,13 @@ package com.iailab.framework.tenant.config; +import com.baomidou.dynamic.datasource.processor.DsProcessor; +import com.baomidou.dynamic.datasource.processor.DsSpelExpressionProcessor; import com.iailab.framework.common.enums.WebFilterOrderEnum; import com.iailab.framework.mybatis.core.util.MyBatisUtils; import com.iailab.framework.redis.config.IailabCacheProperties; import com.iailab.framework.tenant.core.aop.TenantIgnoreAspect; import com.iailab.framework.tenant.core.db.TenantDatabaseInterceptor; +import com.iailab.framework.tenant.core.db.dynamic.TenantDsProcessor; import com.iailab.framework.tenant.core.job.TenantJobAspect; import com.iailab.framework.tenant.core.mq.rabbitmq.TenantRabbitMQInitializer; import com.iailab.framework.tenant.core.mq.redis.TenantRedisMessageInterceptor; @@ -63,6 +66,18 @@ // 需要加在首个,主要是为了在分页插件前面。这个是 MyBatis Plus 的规定 MyBatisUtils.addInterceptor(interceptor, inner, 0); return inner; + } + + @Bean + public DsProcessor dsProcessor( +// TenantFrameworkService tenantFrameworkService, +// DataSource dataSource, +// DefaultDataSourceCreator dataSourceCreator + ) { +// TenantDsProcessor tenantDsProcessor = new TenantDsProcessor(tenantFrameworkService, dataSourceCreator); + TenantDsProcessor tenantDsProcessor = new TenantDsProcessor(); + tenantDsProcessor.setNextProcessor(new DsSpelExpressionProcessor()); + return tenantDsProcessor; } // ========== WEB ========== @@ -133,12 +148,13 @@ @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate, RedisCacheConfiguration redisCacheConfiguration, - IailabCacheProperties iailabCacheProperties) { + IailabCacheProperties iailabCacheProperties, + TenantProperties tenantProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(iailabCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 - return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); + return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration, tenantProperties.getIgnoreCaches()); } } -- Gitblit v1.9.3