From 1da3869dbd2573a6e53e282cea67a8f8e4f5b32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 17:36:24 +0800 Subject: [PATCH 1/9] refactor: optimize FlexIDKeyGenerator.java --- .../mybatisflex/core/keygen/impl/FlexIDKeyGenerator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/impl/FlexIDKeyGenerator.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/impl/FlexIDKeyGenerator.java index 1c3effca..bbd99d89 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/impl/FlexIDKeyGenerator.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/impl/FlexIDKeyGenerator.java @@ -33,7 +33,7 @@ import java.util.concurrent.ThreadLocalRandom; * 1、每台机器允许最大的并发量为 10w/s。 * 2、出现时间回拨,重启机器时,在时间回拨未恢复的情况下,可能出现 id 重复。 *

- * ID组成:时间(7+)| 毫秒内的时间自增 (00~99:2)| 机器ID(0 ~ 9:1)| 随机数(000~999:3)用于分库分表时,通过 id 取模,保证分布均衡。 + * ID组成:时间(7+)| 毫秒内的时间自增 (00~99:2)| 机器ID(00 ~ 99:2)| 随机数(00~99:2)用于分库分表时,通过 id 取模,保证分布均衡。 */ public class FlexIDKeyGenerator implements IKeyGenerator { @@ -85,12 +85,14 @@ public class FlexIDKeyGenerator implements IKeyGenerator { lastTimeMillis = currentTimeMillis; long diffTimeMillis = currentTimeMillis - INITIAL_TIMESTAMP; - return diffTimeMillis * 1000000 + clockSeq * 10000 + workId * 1000 + getRandomInt(); + + //ID组成:时间(7+)| 毫秒内的时间自增 (00~99:2)| 机器ID(00 ~ 99:2)| 随机数(00~99:2) + return diffTimeMillis * 1000000 + clockSeq * 10000 + workId * 100 + getRandomInt(); } private int getRandomInt() { - return ThreadLocalRandom.current().nextInt(1000); + return ThreadLocalRandom.current().nextInt(100); } From c9bc421937f379c7b6bef4095f83e8d072039350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 17:37:02 +0800 Subject: [PATCH 2/9] refactor: add rawType and rawLength properties for Column.java --- .../codegen/dialect/JdbcDialect.java | 4 +++ .../mybatisflex/codegen/entity/Column.java | 28 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/JdbcDialect.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/JdbcDialect.java index d58d27f3..3d7cd984 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/JdbcDialect.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/JdbcDialect.java @@ -25,6 +25,7 @@ import java.util.Map; /** * 默认方言抽象类。 + * @author michael */ public abstract class JdbcDialect implements IDialect { @@ -42,6 +43,9 @@ public abstract class JdbcDialect implements IDialect { Column column = new Column(); column.setName(columnMetaData.getColumnName(i)); + column.setRawType(columnMetaData.getColumnTypeName(i)); + column.setRawLength(columnMetaData.getColumnDisplaySize(i)); + String jdbcType = columnMetaData.getColumnClassName(i); column.setPropertyType(JdbcTypeMapping.getType(jdbcType)); diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java index fc1ace11..e44136b2 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java @@ -21,9 +21,7 @@ import com.mybatisflex.annotation.KeyType; import com.mybatisflex.codegen.config.ColumnConfig; import com.mybatisflex.core.util.StringUtil; -import java.util.ArrayList; import java.util.LinkedHashSet; -import java.util.List; import java.util.Set; /** @@ -71,6 +69,16 @@ public class Column { */ private boolean needGenColumnAnnotation = false; + /** + * 数据库的字段类型,比如 varchar/tinyint 等 + */ + private String rawType; + + /** + * 数据库中的字段长度,比如 varchar(32) 中的 32 + */ + private int rawLength; + /** * 字段配置。 */ @@ -145,6 +153,22 @@ public class Column { isAutoIncrement = autoIncrement; } + public String getRawType() { + return rawType; + } + + public void setRawType(String rawType) { + this.rawType = rawType; + } + + public int getRawLength() { + return rawLength; + } + + public void setRawLength(int rawLength) { + this.rawLength = rawLength; + } + public ColumnConfig getColumnConfig() { return columnConfig; } From 0bdc6c61826b450d2dfd41e4aa2c50e9bc00797a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 17:37:17 +0800 Subject: [PATCH 3/9] test: update test --- .../test/java/com/mybatisflex/coretest/AccountSqlTester.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java index 49b3d216..889395ea 100644 --- a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java +++ b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java @@ -362,7 +362,9 @@ public class AccountSqlTester { @Test public void testJoinSelf() { QueryWrapper queryWrapper = QueryWrapper.create() - .select() + .select(ACCOUNT.ALL_COLUMNS +// ,column("a0.xxxx").as("xxx") + ) .from(ACCOUNT).as("a0") .leftJoin(ACCOUNT).as("a1").on(ACCOUNT.ID.eq(ACCOUNT.AGE).and(ACCOUNT.USER_NAME.like("a"))) .where(ACCOUNT.AGE.ge(10)); From e7660b6b812ee38b7eed48a8728dce9e9657601f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 17:37:45 +0800 Subject: [PATCH 4/9] refactor: optimize FlexSpringTransaction.java --- .../spring/FlexSpringTransaction.java | 66 ++++++++----------- .../spring/FlexTransactionFactory.java | 11 ++-- 2 files changed, 34 insertions(+), 43 deletions(-) diff --git a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java index cb3d7719..f15d2e68 100644 --- a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java +++ b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java @@ -19,74 +19,64 @@ import com.mybatisflex.core.datasource.DataSourceKey; import com.mybatisflex.core.datasource.FlexDataSource; import com.mybatisflex.core.transaction.TransactionContext; import com.mybatisflex.core.util.StringUtil; +import org.apache.ibatis.transaction.Transaction; + import java.sql.Connection; import java.sql.SQLException; import java.util.HashMap; -import java.util.List; import java.util.Map; -import javax.sql.DataSource; -import org.apache.ibatis.session.TransactionIsolationLevel; -import org.apache.ibatis.transaction.Transaction; -import org.mybatis.logging.Logger; -import org.mybatis.logging.LoggerFactory; -import org.mybatis.spring.transaction.SpringManagedTransaction; /** - * spring事务支持,解决issusehttps://gitee.com/mybatis-flex/mybatis-flex/issues/I7HJ4J + * spring 事务支持,解决 issues https://gitee.com/mybatis-flex/mybatis-flex/issues/I7HJ4J + * * @author life */ public class FlexSpringTransaction implements Transaction { - private static final Logger LOGGER = LoggerFactory.getLogger(FlexSpringTransaction.class); - DataSource dataSource; + private final FlexDataSource dataSource; + private final Map connectionMap = new HashMap<>(); - Map connectionMap =new HashMap<>(); - - boolean isTransaction =false; - - TransactionIsolationLevel level; - boolean autoCommit; + private boolean isTransaction = false; + private boolean autoCommit; - public FlexSpringTransaction(DataSource dataSource, TransactionIsolationLevel level, - boolean autoCommit) { + public FlexSpringTransaction(FlexDataSource dataSource, boolean autoCommit) { this.dataSource = dataSource; - this.level = level; this.autoCommit = autoCommit; } @Override public Connection getConnection() throws SQLException { - if (dataSource instanceof FlexDataSource) { - String dataSourceKey = DataSourceKey.get(); - if (StringUtil.isBlank(dataSourceKey)) { - dataSourceKey = ((FlexDataSource) dataSource).getDefaultDataSourceKey(); - } - Connection connection = connectionMap.get(dataSourceKey); - if (connection == null){ - connection = this.dataSource.getConnection(); - connectionMap.put(dataSourceKey,connection); - } - this.autoCommit = connection.getAutoCommit(); - if ( TransactionContext.getXID() != null){ - isTransaction = true; - } - return connection; - }else{ - throw new SQLException("The datasource must be FlexDataSource"); + String dataSourceKey = DataSourceKey.get(); + if (StringUtil.isBlank(dataSourceKey)) { + dataSourceKey = dataSource.getDefaultDataSourceKey(); } + + Connection connection = connectionMap.get(dataSourceKey); + if (connection == null) { + connection = this.dataSource.getConnection(); + connectionMap.put(dataSourceKey, connection); + } + + this.autoCommit = connection.getAutoCommit(); + + if (TransactionContext.getXID() != null) { + this.isTransaction = true; + } + + return connection; } @Override public void commit() throws SQLException { - if (!isTransaction && !autoCommit){ + if (!isTransaction && !autoCommit) { getConnection().commit(); } } @Override public void rollback() throws SQLException { - if (!isTransaction && !autoCommit){ + if (!isTransaction && !autoCommit) { getConnection().rollback(); } } diff --git a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexTransactionFactory.java b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexTransactionFactory.java index dbfbf6a6..c1ea8ee4 100644 --- a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexTransactionFactory.java +++ b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexTransactionFactory.java @@ -15,14 +15,15 @@ */ package com.mybatisflex.spring; -import java.sql.Connection; -import java.util.Properties; -import javax.sql.DataSource; +import com.mybatisflex.core.datasource.FlexDataSource; import org.apache.ibatis.session.TransactionIsolationLevel; import org.apache.ibatis.transaction.Transaction; -import org.mybatis.spring.transaction.SpringManagedTransaction; import org.mybatis.spring.transaction.SpringManagedTransactionFactory; +import javax.sql.DataSource; +import java.sql.Connection; +import java.util.Properties; + /** * @author life */ @@ -33,7 +34,7 @@ public class FlexTransactionFactory extends SpringManagedTransactionFactory { */ @Override public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) { - return new FlexSpringTransaction(dataSource,level,autoCommit); + return new FlexSpringTransaction((FlexDataSource) dataSource, autoCommit); } /** From e4c0b5d15d3eead9e7738e1222b544d8c9426b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 18:24:47 +0800 Subject: [PATCH 5/9] build: v1.5.6 release (^.^)YYa!! --- mybatis-flex-annotation/pom.xml | 2 +- mybatis-flex-codegen/pom.xml | 2 +- mybatis-flex-core/pom.xml | 2 +- .../src/main/java/com/mybatisflex/core/FlexConsts.java | 2 +- mybatis-flex-processor/pom.xml | 2 +- mybatis-flex-solon-plugin/pom.xml | 2 +- mybatis-flex-spring-boot-starter/pom.xml | 2 +- mybatis-flex-spring/pom.xml | 2 +- mybatis-flex-test/mybatis-flex-native-test/pom.xml | 2 +- mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml | 2 +- mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml | 2 +- mybatis-flex-test/mybatis-flex-spring-test/pom.xml | 2 +- mybatis-flex-test/pom.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mybatis-flex-annotation/pom.xml b/mybatis-flex-annotation/pom.xml index 228d3afe..bf8fa81f 100644 --- a/mybatis-flex-annotation/pom.xml +++ b/mybatis-flex-annotation/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-codegen/pom.xml b/mybatis-flex-codegen/pom.xml index 2b002144..0a260491 100644 --- a/mybatis-flex-codegen/pom.xml +++ b/mybatis-flex-codegen/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-core/pom.xml b/mybatis-flex-core/pom.xml index 34905746..7f4f4f04 100644 --- a/mybatis-flex-core/pom.xml +++ b/mybatis-flex-core/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java index be0281ab..9aa76d8d 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/FlexConsts.java @@ -24,7 +24,7 @@ public class FlexConsts { } public static final String NAME = "MyBatis-Flex"; - public static final String VERSION = "1.5.5"; + public static final String VERSION = "1.5.6"; public static final String DEFAULT_PRIMARY_FIELD = "id"; diff --git a/mybatis-flex-processor/pom.xml b/mybatis-flex-processor/pom.xml index b5d4f9c6..897deaec 100644 --- a/mybatis-flex-processor/pom.xml +++ b/mybatis-flex-processor/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-solon-plugin/pom.xml b/mybatis-flex-solon-plugin/pom.xml index 8406dfb7..ac859fbe 100644 --- a/mybatis-flex-solon-plugin/pom.xml +++ b/mybatis-flex-solon-plugin/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-spring-boot-starter/pom.xml b/mybatis-flex-spring-boot-starter/pom.xml index a0d685fb..af2d2a20 100644 --- a/mybatis-flex-spring-boot-starter/pom.xml +++ b/mybatis-flex-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-spring/pom.xml b/mybatis-flex-spring/pom.xml index 999713f3..7facc147 100644 --- a/mybatis-flex-spring/pom.xml +++ b/mybatis-flex-spring/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-native-test/pom.xml b/mybatis-flex-test/mybatis-flex-native-test/pom.xml index ff2673fc..c11deee3 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-native-test/pom.xml @@ -5,7 +5,7 @@ mybatis-flex-test com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml index 6f0d8a37..563530bd 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml @@ -5,7 +5,7 @@ mybatis-flex-test com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml index eb99dd66..1f0c111e 100644 --- a/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml @@ -4,7 +4,7 @@ mybatis-flex-test com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-test/mybatis-flex-spring-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-test/pom.xml index 38c23210..c1df715f 100644 --- a/mybatis-flex-test/mybatis-flex-spring-test/pom.xml +++ b/mybatis-flex-test/mybatis-flex-spring-test/pom.xml @@ -5,7 +5,7 @@ mybatis-flex-test com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 diff --git a/mybatis-flex-test/pom.xml b/mybatis-flex-test/pom.xml index 989691e7..c1a4a577 100644 --- a/mybatis-flex-test/pom.xml +++ b/mybatis-flex-test/pom.xml @@ -5,7 +5,7 @@ parent com.mybatis-flex - 1.5.5 + 1.5.6 4.0.0 From 3bfc77f03cf60f6ac9f366e9d6ca1a1c712534b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 18:24:52 +0800 Subject: [PATCH 6/9] build: v1.5.6 release (^.^)YYa!! --- changes.md | 31 +++++++++++++++++++++++++++++++ docs/zh/changes.md | 31 +++++++++++++++++++++++++++++++ docs/zh/intro/getting-started.md | 2 +- docs/zh/intro/maven.md | 14 +++++++------- docs/zh/others/apt.md | 2 +- docs/zh/others/codegen.md | 2 +- pom.xml | 4 ++-- 7 files changed, 74 insertions(+), 12 deletions(-) diff --git a/changes.md b/changes.md index 1bea6689..3b5f7c1d 100644 --- a/changes.md +++ b/changes.md @@ -2,6 +2,37 @@ +## v1.5.6 20230804: +- 新增:代码生成器重构并新增对 Solon 框架的代码生成功能,感谢 @Suomm +- 新增:添加新的默认的达梦方言,之前使用 Oracle,感谢 @qimincow +- 优化:优化 QueryWrapper.toSQL() 的性能 +- 优化:添加 "未配置事务生成器" 时的异常信息国际化支持 +- 优化:重构 KeywordWrap.java 使之代码逻辑更加清晰 +- 优化:重构代码生成器的 Generator,使之在 web 中在线生成时,保证链接正常关闭 +- 优化:代码生成器的 Column 添加关于数据库类型和长度的相关属性 +- 优化:优化 QueryWrapper.exists() 的性能,感谢 @gongzhongqiang +- 优化:修改 FlexIDKeyGenerator 注释描述错误的问题,感谢 @duxlei +- 修复:新增 spring-devtools.properties 已解决 Spring 类转换异常的问题 +- 修复:QueryWrapper 同时 left join 两个同一个表的时候,逻辑删除条件不正确的问题 #I7QD29 +- 修复:RelationManager 在某些场景先可能出现 NPE 的问题 +- 修复:`@UseDataSource` 注解在某些 Spring 场景下不生效的问题,感谢 @Suomm +- 修复:某些场景下,多数据源使用 JdbcTemplate 事务下使用报错的问题,感谢 @lifejwang11 +- 修复:FieldQueryManager.java 在某些极端场景下出现 NPE 的问题,感谢 @loong0306 +- 修复:同表连接查询,别名匹配不正确的问题,感谢 @qimincow +- 修复:QueryMethods.column 等构建列使用 as 方法设置别名无效的问题,感谢 @Suomm +- 文档:添加 QueryWrapper join 自身的相关示例 +- 文档:常见问题添加启动失败说明列表,感谢 @Suomm +- 文档:优化关于 ActiveRecord 的相关文档,感谢 @Suomm +- 文档:修改 Auto-Mapper 的一些错误文档,感谢 @Suomm +- 文档:修改 APT 的配置描述错误的文档,感谢 @Suomm +- 文档:修改 APT generateEnable 描述错误的问题,感谢 @cijie +- 文档:修改代码生成器的示例代码错误的文档,感谢 @Suomm +- 文档:更新 MyBatis-Flex-Helper 的相关文档和截图 +- 文档:优化 MyBatis 原生使用的相关文档,感谢 @pioneer-sun +- 文档:修改关于 FAQ 的相关描述错误问题,感谢 @wlf213 + + + ## v1.5.5 20230801: - 新增:添加对 xml 分页查询的支持 - 新增:逻辑删除添加列默认值为 null 值时的构建功能,感谢 @Suomm diff --git a/docs/zh/changes.md b/docs/zh/changes.md index 1bea6689..3b5f7c1d 100644 --- a/docs/zh/changes.md +++ b/docs/zh/changes.md @@ -2,6 +2,37 @@ +## v1.5.6 20230804: +- 新增:代码生成器重构并新增对 Solon 框架的代码生成功能,感谢 @Suomm +- 新增:添加新的默认的达梦方言,之前使用 Oracle,感谢 @qimincow +- 优化:优化 QueryWrapper.toSQL() 的性能 +- 优化:添加 "未配置事务生成器" 时的异常信息国际化支持 +- 优化:重构 KeywordWrap.java 使之代码逻辑更加清晰 +- 优化:重构代码生成器的 Generator,使之在 web 中在线生成时,保证链接正常关闭 +- 优化:代码生成器的 Column 添加关于数据库类型和长度的相关属性 +- 优化:优化 QueryWrapper.exists() 的性能,感谢 @gongzhongqiang +- 优化:修改 FlexIDKeyGenerator 注释描述错误的问题,感谢 @duxlei +- 修复:新增 spring-devtools.properties 已解决 Spring 类转换异常的问题 +- 修复:QueryWrapper 同时 left join 两个同一个表的时候,逻辑删除条件不正确的问题 #I7QD29 +- 修复:RelationManager 在某些场景先可能出现 NPE 的问题 +- 修复:`@UseDataSource` 注解在某些 Spring 场景下不生效的问题,感谢 @Suomm +- 修复:某些场景下,多数据源使用 JdbcTemplate 事务下使用报错的问题,感谢 @lifejwang11 +- 修复:FieldQueryManager.java 在某些极端场景下出现 NPE 的问题,感谢 @loong0306 +- 修复:同表连接查询,别名匹配不正确的问题,感谢 @qimincow +- 修复:QueryMethods.column 等构建列使用 as 方法设置别名无效的问题,感谢 @Suomm +- 文档:添加 QueryWrapper join 自身的相关示例 +- 文档:常见问题添加启动失败说明列表,感谢 @Suomm +- 文档:优化关于 ActiveRecord 的相关文档,感谢 @Suomm +- 文档:修改 Auto-Mapper 的一些错误文档,感谢 @Suomm +- 文档:修改 APT 的配置描述错误的文档,感谢 @Suomm +- 文档:修改 APT generateEnable 描述错误的问题,感谢 @cijie +- 文档:修改代码生成器的示例代码错误的文档,感谢 @Suomm +- 文档:更新 MyBatis-Flex-Helper 的相关文档和截图 +- 文档:优化 MyBatis 原生使用的相关文档,感谢 @pioneer-sun +- 文档:修改关于 FAQ 的相关描述错误问题,感谢 @wlf213 + + + ## v1.5.5 20230801: - 新增:添加对 xml 分页查询的支持 - 新增:逻辑删除添加列默认值为 null 值时的构建功能,感谢 @Suomm diff --git a/docs/zh/intro/getting-started.md b/docs/zh/intro/getting-started.md index acbe3467..1af31103 100644 --- a/docs/zh/intro/getting-started.md +++ b/docs/zh/intro/getting-started.md @@ -51,7 +51,7 @@ VALUES (1, '张三', 18, '2020-01-11'), com.mybatis-flex mybatis-flex-spring-boot-starter - 1.5.5 + 1.5.6 com.mysql diff --git a/docs/zh/intro/maven.md b/docs/zh/intro/maven.md index 60bfa822..a8e1e2d8 100644 --- a/docs/zh/intro/maven.md +++ b/docs/zh/intro/maven.md @@ -12,12 +12,12 @@ com.mybatis-flex mybatis-flex-core - 1.5.5 + 1.5.6 com.mybatis-flex mybatis-flex-processor - 1.5.5 + 1.5.6 provided ``` @@ -28,12 +28,12 @@ com.mybatis-flex mybatis-flex-spring - 1.5.5 + 1.5.6 com.mybatis-flex mybatis-flex-processor - 1.5.5 + 1.5.6 provided `````` @@ -44,12 +44,12 @@ com.mybatis-flex mybatis-flex-spring-boot-starter - 1.5.5 + 1.5.6 com.mybatis-flex mybatis-flex-processor - 1.5.5 + 1.5.6 provided ``` @@ -70,7 +70,7 @@ com.mybatis-flex mybatis-flex-processor - 1.5.5 + 1.5.6 diff --git a/docs/zh/others/apt.md b/docs/zh/others/apt.md index 26da8dae..4cd26be2 100644 --- a/docs/zh/others/apt.md +++ b/docs/zh/others/apt.md @@ -220,7 +220,7 @@ pom.xml 添加 `annotationProcessorPaths` 配置, ``` dependencies { ... - annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.5.5' + annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.5.6' } ``` diff --git a/docs/zh/others/codegen.md b/docs/zh/others/codegen.md index 9b116395..1b9b5237 100644 --- a/docs/zh/others/codegen.md +++ b/docs/zh/others/codegen.md @@ -10,7 +10,7 @@ com.mybatis-flex mybatis-flex-codegen - 1.5.5 + 1.5.6 ``` diff --git a/pom.xml b/pom.xml index 74121ed9..b456525c 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.mybatis-flex parent pom - 1.5.5 + 1.5.6 mybatis-flex https://mybatis-flex.com @@ -54,7 +54,7 @@ 8 8 - 1.5.5 + 1.5.6 3.5.13 2.1.0 From 89fa4a3793e6e95f7c205b256d5c95fe7f2c7dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Fri, 4 Aug 2023 18:41:35 +0800 Subject: [PATCH 7/9] build: v1.5.6 release (^.^)YYa!! --- changes.md | 2 +- docs/zh/changes.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changes.md b/changes.md index 3b5f7c1d..549a083c 100644 --- a/changes.md +++ b/changes.md @@ -74,7 +74,7 @@ - 新增:多数据源功能添加负载均衡的能力 - 新增:QueryWrapper 的.and() .or() 方法, 增加一个 condition 参数的方法,感谢 @jerryzhengsz - 新增:添加 BaseMapper.selectOneWithRelationsByIdAs() 方法,感谢 @jerryzhengsz1 -- 新增:添加异常信息国际哈的支持,感谢 @Suomm +- 新增:添加异常信息国际化的支持,感谢 @Suomm - 新增:添加主键逻辑删除处理器的支持,感谢 @Suomm - 新增:在 Service 中可以直接获取链式更新 UpdateChain 方法,感谢 @Suomm - 新增:ActiveRecord 添加 join 查询和 Relations 查询的功能,感谢 @Suomm diff --git a/docs/zh/changes.md b/docs/zh/changes.md index 3b5f7c1d..549a083c 100644 --- a/docs/zh/changes.md +++ b/docs/zh/changes.md @@ -74,7 +74,7 @@ - 新增:多数据源功能添加负载均衡的能力 - 新增:QueryWrapper 的.and() .or() 方法, 增加一个 condition 参数的方法,感谢 @jerryzhengsz - 新增:添加 BaseMapper.selectOneWithRelationsByIdAs() 方法,感谢 @jerryzhengsz1 -- 新增:添加异常信息国际哈的支持,感谢 @Suomm +- 新增:添加异常信息国际化的支持,感谢 @Suomm - 新增:添加主键逻辑删除处理器的支持,感谢 @Suomm - 新增:在 Service 中可以直接获取链式更新 UpdateChain 方法,感谢 @Suomm - 新增:ActiveRecord 添加 join 查询和 Relations 查询的功能,感谢 @Suomm From 5afc516f86cdf31d6638aeebe271d2e0d8293eb3 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Sat, 5 Aug 2023 03:21:05 +0000 Subject: [PATCH 8/9] update docs/zh/awesome-things.md. Signed-off-by: Michael Yang --- docs/zh/awesome-things.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/zh/awesome-things.md b/docs/zh/awesome-things.md index e09430e0..19340be9 100644 --- a/docs/zh/awesome-things.md +++ b/docs/zh/awesome-things.md @@ -81,3 +81,9 @@ - [MyBatis-Flex 视频教程 - 27 version 乐观锁的简单使用](https://www.bilibili.com/video/BV1Rc411F7wp) - [MyBatis-Flex 视频教程 - 28 tenantId 多租户的简单使用](https://www.bilibili.com/video/BV1eP41167TU) - [MyBatis-Flex 视频教程 - 29 typeHandler 的简单使用](https://www.bilibili.com/video/BV1B841127ea) +- [MyBatis-Flex 视频教程 - 30 数据脱敏的简单使用](https://www.bilibili.com/video/BV1gz4y1s7Wg) +- [MyBatis-Flex 视频教程 - 31 枚举属性的使用](https://www.bilibili.com/video/BV1mm4y1W7SD) +- [MyBatis-Flex 视频教程 - 32 关联查询(Join Query)](https://www.bilibili.com/video/BV1B8411d7iC) + + + From cf9173d4d4adc64ef02950031b80d25af78c5815 Mon Sep 17 00:00:00 2001 From: Suomm <1474983351@qq.com> Date: Sat, 5 Aug 2023 15:52:57 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20count=20=E6=9F=A5=E8=AF=A2=E6=97=B6?= =?UTF-8?q?=E5=88=97=E6=B2=A1=E6=9C=89=E8=A2=AB=E6=9B=BF=E6=8D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mybatisflex/core/BaseMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java index c232e022..103b564d 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java @@ -827,7 +827,7 @@ public interface BaseMapper { ((FunctionQueryColumn) selectColumns.get(0)).getFnName() )) { // 第一个查询列不是 COUNT 函数,使用 COUNT(*) 替换所有的查询列 - queryWrapper.select(count()); + CPI.setSelectColumns(queryWrapper, Collections.singletonList(count())); } // 第一个查询列是 COUNT 函数,可以使用 COUNT(1)、COUNT(列名) 代替默认的 COUNT(*) objects = selectObjectListByQuery(queryWrapper); @@ -839,7 +839,7 @@ public interface BaseMapper { objects = selectObjectListByQuery(MapperUtil.rawCountQueryWrapper(queryWrapper)); } else { // 使用 COUNT(*) 替换所有的查询列 - queryWrapper.select(count()); + CPI.setSelectColumns(queryWrapper, Collections.singletonList(count())); objects = selectObjectListByQuery(queryWrapper); } }