mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 08:38:26 +08:00
Compare commits
19 Commits
12e9243934
...
de26c7a668
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de26c7a668 | ||
|
|
ad154da481 | ||
|
|
c17e747012 | ||
|
|
b78ae2c6c5 | ||
|
|
9343c8eabd | ||
|
|
45ac06ff97 | ||
|
|
ed09906361 | ||
|
|
7cfc1d3432 | ||
|
|
4b022408a5 | ||
|
|
10e595a628 | ||
|
|
4d82711fa8 | ||
|
|
61857a00fe | ||
|
|
25e00c677e | ||
|
|
eefded34f9 | ||
|
|
a4793eaceb | ||
|
|
f7ec9689d6 | ||
|
|
c1cd6dcecd | ||
|
|
66ca2981da | ||
|
|
23236e6ec2 |
11
changes.md
11
changes.md
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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'
|
||||
}
|
||||
```
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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'
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -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>
|
||||
```
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<>();
|
||||
|
||||
|
||||
@ -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<>();
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user