From e584cfae4943e0f32b934251611d0cea88c9085a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392912@qq.com> Date: Thu, 2 Jan 2025 12:48:23 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E8=B0=83=E6=95=B4=20sql=20?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mp/config/BladeMybatisPlusProperties.java | 38 ------------------- .../mp/config/MybatisPlusConfiguration.java | 7 +--- .../core/mp/logger/SqlLogFilter.java | 4 +- .../core/mp/props/MybatisPlusProperties.java | 5 +++ 4 files changed, 9 insertions(+), 45 deletions(-) delete mode 100644 blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/BladeMybatisPlusProperties.java diff --git a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/BladeMybatisPlusProperties.java b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/BladeMybatisPlusProperties.java deleted file mode 100644 index fd4cdb8..0000000 --- a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/BladeMybatisPlusProperties.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net). - *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.gnu.org/licenses/lgpl.html - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springblade.core.mp.config; - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; - -/** - * druid 连接池配置 - * - * @author L.cm - */ -@Getter -@Setter -@ConfigurationProperties("blade.mybatis-plus") -public class BladeMybatisPlusProperties { - - /** - * 是否打印 sql - */ - private boolean sqlLog = true; - -} diff --git a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/MybatisPlusConfiguration.java b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/MybatisPlusConfiguration.java index 5bf8d79..dd440ad 100644 --- a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/MybatisPlusConfiguration.java +++ b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/config/MybatisPlusConfiguration.java @@ -46,10 +46,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; @AutoConfiguration @AllArgsConstructor @MapperScan("org.springblade.**.mapper.**") -@EnableConfigurationProperties({ - MybatisPlusProperties.class, - BladeMybatisPlusProperties.class -}) +@EnableConfigurationProperties(MybatisPlusProperties.class) public class MybatisPlusConfiguration { @@ -104,7 +101,7 @@ public class MybatisPlusConfiguration { */ @Bean @ConditionalOnProperty(value = "blade.mybatis-plus.sql-log", matchIfMissing = true) - public SqlLogFilter sqlLogFilter(BladeMybatisPlusProperties properties) { + public SqlLogFilter sqlLogFilter(MybatisPlusProperties properties) { return new SqlLogFilter(properties); } diff --git a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/logger/SqlLogFilter.java b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/logger/SqlLogFilter.java index 7d71c2e..f44a495 100644 --- a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/logger/SqlLogFilter.java +++ b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/logger/SqlLogFilter.java @@ -26,7 +26,7 @@ import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.util.StringUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.config.BladeMybatisPlusProperties; +import org.springblade.core.mp.props.MybatisPlusProperties; import org.springblade.core.tool.utils.StringUtil; import java.sql.SQLException; @@ -47,7 +47,7 @@ import java.util.List; @RequiredArgsConstructor public class SqlLogFilter extends FilterEventAdapter { private static final SQLUtils.FormatOption FORMAT_OPTION = new SQLUtils.FormatOption(false, false); - private final BladeMybatisPlusProperties properties; + private final MybatisPlusProperties properties; @Override protected void statementExecuteBefore(StatementProxy statement, String sql) { diff --git a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/props/MybatisPlusProperties.java b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/props/MybatisPlusProperties.java index 4743f6a..10cd47c 100644 --- a/blade-starter-mybatis/src/main/java/org/springblade/core/mp/props/MybatisPlusProperties.java +++ b/blade-starter-mybatis/src/main/java/org/springblade/core/mp/props/MybatisPlusProperties.java @@ -37,4 +37,9 @@ public class MybatisPlusProperties { */ protected Boolean overflow = false; + /** + * 是否打印 sql + */ + private boolean sqlLog = true; + }