|
@@ -15,10 +15,7 @@
|
|
|
*/
|
|
|
package org.springblade.core.boot.tenant;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.parser.ISqlParser;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.boot.config.MybatisPlusConfiguration;
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
|
@@ -27,9 +24,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* 多租户配置类
|
|
|
*
|
|
@@ -52,8 +46,8 @@ public class TenantConfiguration {
|
|
|
* @return TenantHandler
|
|
|
*/
|
|
|
@Bean
|
|
|
- @ConditionalOnMissingBean(TenantHandler.class)
|
|
|
- public TenantHandler bladeTenantHandler() {
|
|
|
+ @ConditionalOnMissingBean(TenantLineHandler.class)
|
|
|
+ public TenantLineHandler bladeTenantHandler() {
|
|
|
return new BladeTenantHandler(properties);
|
|
|
}
|
|
|
|
|
@@ -68,21 +62,4 @@ public class TenantConfiguration {
|
|
|
return new BladeTenantId();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 分页插件
|
|
|
- *
|
|
|
- * @param tenantHandler 自定义租户处理器
|
|
|
- * @return PaginationInterceptor
|
|
|
- */
|
|
|
- @Bean
|
|
|
- public PaginationInterceptor paginationInterceptor(TenantHandler tenantHandler) {
|
|
|
- PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
|
|
- List<ISqlParser> sqlParserList = new ArrayList<>();
|
|
|
- TenantSqlParser tenantSqlParser = new TenantSqlParser();
|
|
|
- tenantSqlParser.setTenantHandler(tenantHandler);
|
|
|
- sqlParserList.add(tenantSqlParser);
|
|
|
- paginationInterceptor.setSqlParserList(sqlParserList);
|
|
|
- return paginationInterceptor;
|
|
|
- }
|
|
|
-
|
|
|
}
|