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; + }