Compare commits

...

19 Commits

Author SHA1 Message Date
Michael Yang
de26c7a668
Merge pull request #610 from cybzzz/main
fix: 带子查询的场景下,分页优化误删 join 的修复
2025-11-16 13:49:59 +08:00
Michael Yang
ad154da481
Merge pull request #611 from 4ucl/patch-1
fix: 代码生成器指定 EntityConfig#withBasePackage 时, 生成文件路径错误
2025-11-16 13:49:46 +08:00
Michael Yang
c17e747012
Merge pull request #609 from ruansheng8/feat-tx
refactor: -m flex 调整TransactionObject访问修饰符为public
2025-11-16 13:48:42 +08:00
Lucas C
b78ae2c6c5
Fix base entity package path replacement logic 2025-11-15 18:31:58 +08:00
cybzzz
9343c8eabd fix: 带子查询的场景下,分页优化误删 join 的修复 2025-11-15 13:24:36 +08:00
ruansheng
45ac06ff97 refactor: -m flex 调整TransactionObject访问修饰符为public 2025-11-14 14:14:00 +08:00
Michael Yang
ed09906361 build: v1.11.4 release (^.^)YYa!! 2025-11-13 12:47:38 +08:00
Michael Yang
7cfc1d3432 build: v1.11.4 release (^.^)YYa!! 2025-11-13 12:36:27 +08:00
Michael Yang
4b022408a5 build: v1.11.4 release (^.^)YYa!! 2025-11-13 12:34:05 +08:00
Michael Yang
10e595a628 fix: fixed and close https://gitee.com/mybatis-flex/mybatis-flex/issues/ID64KB 2025-11-13 12:23:23 +08:00
Michael Yang
4d82711fa8
!560 update mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/DbTypeUtil.java.
Merge pull request !560 from younger/N/A
2025-11-10 10:30:10 +00:00
younger
61857a00fe
update mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/DbTypeUtil.java.
修复根据人大金仓url识别错误类型的bug

Signed-off-by: younger <1095367863@qq.com>
2025-11-10 10:28:26 +00:00
Michael Yang
25e00c677e Merge remote-tracking branch 'gitee/main' 2025-11-10 10:29:20 +08:00
Michael Yang
eefded34f9 Merge branch 'main' of https://github.com/mybatis-flex/mybatis-flex 2025-11-10 10:29:08 +08:00
Michael Yang
a4793eaceb
Merge pull request #600 from Arowa-Z/main
fix: 修复EXISTS、NOT EXISTS的子select语句无法自动附加逻辑删除的问题
2025-11-10 10:26:42 +08:00
Michael Yang
f7ec9689d6
Merge pull request #605 from CShisan/main
fix 修复@EnumValue应用在接口方法且返回类型为泛型时失效的问题
2025-11-10 10:24:36 +08:00
CShisan
c1cd6dcecd fix 修复@EnumValue应用在接口方法且返回类型为泛型时失效的问题 2025-11-07 18:01:11 +08:00
Arowa_Z
66ca2981da fix: 修复EXISTS、NOT EXISTS的子select语句无法自动附加逻辑删除的问题 2025-10-17 23:27:14 +08:00
Michael Yang
23236e6ec2 build: v1.11.3 release (^.^)YYa!! 2025-09-26 12:12:04 +08:00
18 changed files with 101 additions and 47 deletions

View File

@ -2,8 +2,17 @@
查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。
## v1.11.4 20251113
- 修复:修复 EXISTS、NOT EXISTS 的子 select 语句无法自动附加逻辑删除的问题,感谢 @Arowa_Z
- 修复:@EnumValue 应用在接口方法且返回类型为泛型时失效的问题,感谢 @CShisan
- 修复:人大金仓方言类型判断不准确的问题,感谢 @younger
- 修复RowKeyGenerator 的 autoKeyGeneratorNames 在某些情况下累积导致缓存污染的问题
- 文档:修正示例代码中的语法错误,感谢 @涛声依旧
## v1.11.3 20250926
- 修复: QueryColumn.between_(values) 不能为 null 的问题 #ID03CH
- 修复QueryColumn.between_(values) 不能为 null 的问题 #ID03CH

View File

@ -2,8 +2,17 @@
查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。
## v1.11.4 20251113
- 修复:修复 EXISTS、NOT EXISTS 的子 select 语句无法自动附加逻辑删除的问题,感谢 @Arowa_Z
- 修复:@EnumValue 应用在接口方法且返回类型为泛型时失效的问题,感谢 @CShisan
- 修复:人大金仓方言类型判断不准确的问题,感谢 @younger
- 修复RowKeyGenerator 的 autoKeyGeneratorNames 在某些情况下累积导致缓存污染的问题
- 文档:修正示例代码中的语法错误,感谢 @涛声依旧
## v1.11.3 20250926
- 修复: QueryColumn.between_(values) 不能为 null 的问题 #ID03CH
- 修复QueryColumn.between_(values) 不能为 null 的问题 #ID03CH

View File

@ -53,7 +53,7 @@ VALUES (1, '张三', 18, '2020-01-11'),
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
@ -81,7 +81,7 @@ VALUES (1, '张三', 18, '2020-01-11'),
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>

View File

@ -10,7 +10,7 @@
```kotlin
dependencies {
implementation("com.mybatis-flex:mybatis-flex-core:1.11.1")
implementation("com.mybatis-flex:mybatis-flex-core:1.11.4")
}
```
@ -18,7 +18,7 @@ dependencies {
```groovy
dependencies {
implementation 'com.mybatis-flex:mybatis-flex-core:1.11.1'
implementation 'com.mybatis-flex:mybatis-flex-core:1.11.4'
}
```
@ -28,7 +28,7 @@ dependencies {
```kotlin
dependencies {
implementation("com.mybatis-flex:mybatis-flex-spring:1.11.1")
implementation("com.mybatis-flex:mybatis-flex-spring:1.11.4")
}
```
@ -36,7 +36,7 @@ dependencies {
```groovy
dependencies {
implementation 'com.mybatis-flex:mybatis-flex-spring:1.11.1'
implementation 'com.mybatis-flex:mybatis-flex-spring:1.11.4'
}
```
@ -46,7 +46,7 @@ dependencies {
```kotlin
dependencies {
implementation("com.mybatis-flex:mybatis-flex-spring-boot-starter:1.11.1")
implementation("com.mybatis-flex:mybatis-flex-spring-boot-starter:1.11.4")
}
```
@ -54,7 +54,7 @@ dependencies {
```groovy
dependencies {
implementation 'com.mybatis-flex:mybatis-flex-spring-boot-starter:1.11.1'
implementation 'com.mybatis-flex:mybatis-flex-spring-boot-starter:1.11.4'
}
```
@ -65,7 +65,7 @@ dependencies {
```kotlin
dependencies {
implementation("com.mybatis-flex:mybatis-flex-solon-plugin:1.11.1")
implementation("com.mybatis-flex:mybatis-flex-solon-plugin:1.11.4")
}
```
@ -73,7 +73,7 @@ dependencies {
```groovy
dependencies {
implementation 'com.mybatis-flex:mybatis-flex-solon-plugin:1.11.1'
implementation 'com.mybatis-flex:mybatis-flex-solon-plugin:1.11.4'
}
```
@ -91,7 +91,7 @@ dependencies {
```kotlin
dependencies {
annotationProcessor("com.mybatis-flex:mybatis-flex-processor:1.11.1")
annotationProcessor("com.mybatis-flex:mybatis-flex-processor:1.11.4")
}
```
@ -99,6 +99,6 @@ dependencies {
```groovy
dependencies {
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.11.1'
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.11.4'
}
```

View File

@ -12,12 +12,12 @@
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-core</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
```
@ -28,12 +28,12 @@
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
``````
@ -44,12 +44,12 @@
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
```
@ -60,12 +60,12 @@
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
```
@ -76,12 +76,12 @@
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-solon-plugin</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
```
@ -104,7 +104,7 @@
<path>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-processor</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</path>
</annotationProcessorPaths>
</configuration>

View File

@ -248,7 +248,7 @@ pom.xml 添加 `annotationProcessorPaths` 配置,
```
dependencies {
...
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.11.1'
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.11.4'
}
```

View File

@ -21,7 +21,7 @@
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-codegen</artifactId>
<version>1.11.1</version>
<version>1.11.4</version>
</dependency>
```

View File

@ -132,7 +132,7 @@ public class EntityGenerator implements IGenerator {
String sourceDir = StringUtil.hasText(entityConfig.getSourceDir()) ? entityConfig.getSourceDir() : packageConfig.getSourceDir();
String baseEntityPackagePath = packageConfig.getEntityPackage().replace(".", "/");
baseEntityPackagePath = StringUtil.hasText(entityConfig.getWithBasePackage()) ? entityConfig.getWithBasePackage().replace(".", "")
baseEntityPackagePath = StringUtil.hasText(entityConfig.getWithBasePackage()) ? entityConfig.getWithBasePackage().replace(".", "/")
: baseEntityPackagePath + "/base";
String baseEntityClassName = table.buildEntityClassName() + entityConfig.getWithBaseClassSuffix();

View File

@ -27,7 +27,7 @@ public class FlexConsts {
}
public static final String NAME = "MyBatis-Flex";
public static final String VERSION = "1.11.1";
public static final String VERSION = "1.11.3";
public static final String SQL = "$$sql";

View File

@ -185,7 +185,7 @@ public class DbTypeUtil {
return DbType.IMPALA;
} else if (jdbcUrl.contains(":informix")) {
return DbType.INFORMIX;
} else if (jdbcUrl.contains(":kingbase\\d*:") && isMatchedRegex(":kingbase\\d*:", jdbcUrl)) {
} else if (isMatchedRegex(":kingbase\\d*:", jdbcUrl)) {
return DbType.KINGBASE_ES;
} else if (jdbcUrl.contains(":lealone:")) {
return DbType.LEALONE;

View File

@ -42,8 +42,9 @@ public class RowKeyGenerator implements KeyGenerator, IMultiKeyGenerator {
private static final KeyGenerator[] NO_KEY_GENERATORS = new KeyGenerator[0];
private final MappedStatement ms;
private KeyGenerator[] keyGenerators;
private Set<String> autoKeyGeneratorNames;
private KeyGenerator[] keyGenerators;
public RowKeyGenerator(MappedStatement methodMappedStatement) {
this.ms = methodMappedStatement;
@ -52,6 +53,8 @@ public class RowKeyGenerator implements KeyGenerator, IMultiKeyGenerator {
@Override
public void processBefore(Executor executor, MappedStatement ms, Statement stmt, Object parameter) {
Row row = (Row) ((Map<?, ?>) parameter).get(FlexConsts.ROW);
// 重置 autoKeyGeneratorNames fix https://gitee.com/mybatis-flex/mybatis-flex/issues/ID64KB
autoKeyGeneratorNames = null;
keyGenerators = buildRowKeyGenerators(RowCPI.obtainsPrimaryKeys(row));
for (KeyGenerator keyGenerator : keyGenerators) {
keyGenerator.processBefore(executor, ms, stmt, parameter);
@ -89,7 +92,7 @@ public class RowKeyGenerator implements KeyGenerator, IMultiKeyGenerator {
String keyColumn = rowKey.getKeyColumn();
if (rowKey.getKeyType() == KeyType.Auto) {
if (autoKeyGeneratorNames == null) {
autoKeyGeneratorNames = new HashSet<>();
autoKeyGeneratorNames = new LinkedHashSet<>();
}
autoKeyGeneratorNames.add(keyColumn);
return new RowJdbc3KeyGenerator(keyColumn);

View File

@ -76,7 +76,8 @@ public class OperatorSelectCondition extends QueryCondition {
@Override
boolean containsTable(String... tables) {
QueryCondition condition = queryWrapper.getWhereQueryCondition();
return condition != null && condition.containsTable(tables);
boolean subContains = condition != null && condition.containsTable(tables);
return subContains || nextContainsTable(tables);
}
@Override

View File

@ -50,7 +50,12 @@ class WrapperUtil {
}
}
// not Brackets
else {
else if (condition instanceof OperatorSelectCondition) {
if (list == null) {
list = new ArrayList<>();
}
list.add(((OperatorSelectCondition) condition).getQueryWrapper());
} else {
Object value = condition.getValue();
if (value instanceof QueryWrapper) {
if (list == null) {

View File

@ -77,13 +77,22 @@ public class EnumWrapper<E extends Enum<E>> {
if (!(methodName.startsWith("get") && methodName.length() > 3)) {
throw new IllegalStateException("Can not find get method \"" + methodName + "()\" in enum: " + enumClass.getName());
}
String enumValueFieldName;
if (methodName.startsWith("get")) {
enumValueFieldName = StringUtil.firstCharToLowerCase(enumValueMethod.getName().substring(3));
} else {
enumValueFieldName = enumValueMethod.getName().toLowerCase();
}
enumValueField = ClassUtil.getFirstField(enumClass, field -> enumValueFieldName.equals(field.getName()));
if (enumValueField != null) {
propertyType = ClassUtil.getWrapType(enumValueField.getType());
} else {
throw new IllegalStateException("Can not find field \"" + enumValueFieldName + "()\" in enum: " + enumClass.getName());
}
this.getterMethod = enumValueMethod;
this.hasEnumValueAnnotation = true;
Class<?> returnType = enumValueMethod.getReturnType();
if (returnType.isPrimitive()) {
returnType = ConvertUtil.primitiveToBoxed(returnType);
}
this.propertyType = returnType;
}
}
}

View File

@ -91,7 +91,7 @@ public class FlexTransactionManager extends AbstractPlatformTransactionManager {
TimeoutHolder.clear();
}
static class TransactionObject extends JdbcTransactionObjectSupport {
public static class TransactionObject extends JdbcTransactionObjectSupport {
private static final ThreadLocal<String> ROLLBACK_ONLY_XIDS = new ThreadLocal<>();

View File

@ -91,7 +91,7 @@ public class FlexTransactionManager extends AbstractPlatformTransactionManager {
TimeoutHolder.clear();
}
static class TransactionObject extends JdbcTransactionObjectSupport {
public static class TransactionObject extends JdbcTransactionObjectSupport {
private static final ThreadLocal<String> ROLLBACK_ONLY_XIDS = new ThreadLocal<>();

View File

@ -31,11 +31,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.mybatisflex.core.query.QueryMethods.case_;
import static com.mybatisflex.core.query.QueryMethods.column;
import static com.mybatisflex.core.query.QueryMethods.count;
import static com.mybatisflex.core.query.QueryMethods.distinct;
import static com.mybatisflex.core.query.QueryMethods.select;
import static com.mybatisflex.core.query.QueryMethods.*;
import static com.mybatisflex.test.model.table.RoleTableDef.ROLE;
import static com.mybatisflex.test.model.table.UserRoleTableDef.USER_ROLE;
import static com.mybatisflex.test.model.table.UserTableDef.USER;
@ -199,4 +195,26 @@ class QueryWrapperTest {
" AND ` user_name ` = ''", sql);
}
@Test
void test07() {
QueryWrapper queryWrapper = QueryWrapper.create()
.select()
.from(USER.as("u"))
.leftJoin(USER_ROLE).as("ur").on(USER.USER_ID.eq(USER_ROLE.USER_ID))
.where(QueryCondition.createEmpty())
.and(USER.USER_ID.eq(1).or(USER.USER_ID.in(
QueryWrapper.create().select(USER_ROLE.USER_ID).from(USER_ROLE)))
)
.and(
exists(selectOne().from(ROLE)
.where(ROLE.ROLE_ID.eq(USER_ROLE.ROLE_ID)))
)
.and(USER_ROLE.USER_ID.eq(1));
System.out.println(queryWrapper.toSQL());
QueryCondition whereQueryCondition = CPI.getWhereQueryCondition(queryWrapper);
boolean contained = CPI.containsTable(whereQueryCondition, "tb_user_role");
Assertions.assertTrue(contained);
}
}

View File

@ -69,7 +69,7 @@
<maven.compiler.target>8</maven.compiler.target>
<!-- Mybatis-Flex 版本 -->
<revision>1.11.3</revision>
<revision>1.11.4</revision>
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
<xml-maven-plugin.version>1.1.0</xml-maven-plugin.version>