From fe850c71e9fb973644b013f7667378f24d70ccb4 Mon Sep 17 00:00:00 2001 From: smallchill Date: Fri, 11 Sep 2020 10:24:40 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=202.7.3.RELEASE=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=A4=9A=E7=A7=9F=E6=88=B7=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blade-core-boot/pom.xml | 2 +- .../boot/config/MybatisPlusConfiguration.java | 32 ++++++++++++++++--- .../core/boot/tenant/BladeTenantHandler.java | 10 +++--- .../core/boot/tenant/TenantConfiguration.java | 29 ++--------------- .../src/main/resources/bootstrap.yml | 2 +- blade-core-cloud/pom.xml | 2 +- blade-core-develop/pom.xml | 2 +- blade-core-launch/pom.xml | 2 +- .../core/launch/constant/AppConstant.java | 2 +- blade-core-log/pom.xml | 2 +- blade-core-mybatis/pom.xml | 2 +- blade-core-oss/pom.xml | 2 +- blade-core-secure/pom.xml | 2 +- blade-core-social/pom.xml | 2 +- blade-core-swagger/pom.xml | 2 +- .../core/swagger/SwaggerProperties.java | 2 +- blade-core-test/pom.xml | 2 +- blade-core-tool/pom.xml | 2 +- blade-core-transaction/pom.xml | 2 +- pom.xml | 8 ++--- 20 files changed, 56 insertions(+), 55 deletions(-) diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 933f9be..a30012c 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java b/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java index 336336b..abcf4d6 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/config/MybatisPlusConfiguration.java @@ -15,7 +15,12 @@ */ package org.springblade.core.boot.config; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; +import lombok.AllArgsConstructor; import org.mybatis.spring.annotation.MapperScan; import org.springblade.core.mp.plugins.SqlLogInterceptor; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -29,13 +34,32 @@ import org.springframework.context.annotation.Configuration; * @author Chill */ @Configuration +@AllArgsConstructor @MapperScan("org.springblade.**.mapper.**") public class MybatisPlusConfiguration { + private final TenantLineHandler tenantLineHandler; + + /** + * mybatis-plus 拦截器集合 + */ @Bean - @ConditionalOnMissingBean(PaginationInterceptor.class) - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); + @ConditionalOnMissingBean(MybatisPlusInterceptor.class) + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + // 配置租户拦截器 + interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(tenantLineHandler)); + // 配置分页拦截器 + interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); + return interceptor; + } + + /** + * mybatis-plus自3.4.0起采用新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除) + */ + @Bean + public ConfigurationCustomizer configurationCustomizer() { + return configuration -> configuration.setUseDeprecatedExecutor(false); } /** diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java index 13e22e6..0780d47 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java @@ -15,7 +15,7 @@ */ package org.springblade.core.boot.tenant; -import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler; +import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.expression.Expression; @@ -31,7 +31,7 @@ import org.springblade.core.tool.utils.StringUtil; */ @Slf4j @AllArgsConstructor -public class BladeTenantHandler implements TenantHandler { +public class BladeTenantHandler implements TenantLineHandler { private final BladeTenantProperties properties; @@ -41,7 +41,7 @@ public class BladeTenantHandler implements TenantHandler { * @return 租户ID */ @Override - public Expression getTenantId(boolean where) { + public Expression getTenantId() { return new StringValue(Func.toStr(SecureUtil.getTenantId(), TenantConstant.DEFAULT_TENANT_ID)); } @@ -59,10 +59,10 @@ public class BladeTenantHandler implements TenantHandler { * 过滤租户表 * * @param tableName 表名 - * @return 是否进行过滤 + * @return 是否忽略, true:表示忽略,false:需要解析并拼接多租户条件 */ @Override - public boolean doTableFilter(String tableName) { + public boolean ignoreTable(String tableName) { return !( ( (properties.getTables().size() > 0 && properties.getTables().contains(tableName)) diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java index 06a8feb..6cd8170 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java @@ -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 sqlParserList = new ArrayList<>(); - TenantSqlParser tenantSqlParser = new TenantSqlParser(); - tenantSqlParser.setTenantHandler(tenantHandler); - sqlParserList.add(tenantSqlParser); - paginationInterceptor.setSqlParserList(sqlParserList); - return paginationInterceptor; - } - } diff --git a/blade-core-boot/src/main/resources/bootstrap.yml b/blade-core-boot/src/main/resources/bootstrap.yml index f87e636..f3f8664 100644 --- a/blade-core-boot/src/main/resources/bootstrap.yml +++ b/blade-core-boot/src/main/resources/bootstrap.yml @@ -97,7 +97,7 @@ mybatis-plus: swagger: title: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统 - version: 2.7.2 + version: 2.7.3 license: Powered By SpringBlade licenseUrl: https://bladex.vip terms-of-service-url: https://bladex.vip diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index 5328eb5..b685220 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-develop/pom.xml b/blade-core-develop/pom.xml index 10b444a..2887098 100644 --- a/blade-core-develop/pom.xml +++ b/blade-core-develop/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index ab89a71..baaa8aa 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java index f3f7541..0a1d6e8 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java @@ -25,7 +25,7 @@ public interface AppConstant { /** * 应用版本 */ - String APPLICATION_VERSION = "2.7.2"; + String APPLICATION_VERSION = "2.7.3"; /** * 基础包 diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index 94041af..a722cb1 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index 1d2b061..7e2e60b 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-oss/pom.xml b/blade-core-oss/pom.xml index cd00546..d87639d 100644 --- a/blade-core-oss/pom.xml +++ b/blade-core-oss/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index e3db633..f923e7b 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-social/pom.xml b/blade-core-social/pom.xml index a1e5953..6ec08c4 100644 --- a/blade-core-social/pom.xml +++ b/blade-core-social/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index d7661ad..5a104da 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java index c4ccb52..1525640 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java @@ -55,7 +55,7 @@ public class SwaggerProperties { /** * 版本 **/ - private String version = "2.7.2"; + private String version = "2.7.3"; /** * 许可证 **/ diff --git a/blade-core-test/pom.xml b/blade-core-test/pom.xml index 7c69831..d0ef651 100644 --- a/blade-core-test/pom.xml +++ b/blade-core-test/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index 97dd0b6..2f9e51a 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 2.7.2 + 2.7.3 4.0.0 diff --git a/blade-core-transaction/pom.xml b/blade-core-transaction/pom.xml index 2ccb8cf..a535c21 100644 --- a/blade-core-transaction/pom.xml +++ b/blade-core-transaction/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.7.2 + 2.7.3 4.0.0 diff --git a/pom.xml b/pom.xml index 9145669..cb98dfe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.7.2 + 2.7.3 pom blade-tool @@ -36,14 +36,14 @@ - 2.7.2 + 2.7.3 1.8 3.8.0 2.9.2 1.5.21 2.0.4 - 3.3.2 + 3.4.0 1.6.0 3.4.2 2.3.0 @@ -52,7 +52,7 @@ 1.3.0 2.2.9.RELEASE - Hoxton.SR7 + Hoxton.SR8 Cairo-SR8 UTF-8