mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
build: v1.8.0 release (^.^)YYa!!
This commit is contained in:
parent
056d09adda
commit
03bb32c979
@ -3,7 +3,6 @@
|
||||
查看 [全部代码贡献者](/zh/intro/what-is-mybatisflex.html#贡献者)。
|
||||
|
||||
## v1.8.0 20240223:
|
||||
- 优化:selectOneByQuery(QueryWrapper queryWrapper) 由用户主动添加 limit 1
|
||||
- 优化:entityOrBase.tpl 中命令占位符被替换后,entity 里面多了一行空白行,感谢 @caohenghui
|
||||
- 修复:在复杂的 VO 嵌套查询时,addResultMap 抛出异常的问题,感谢 @leizhiyou
|
||||
- 修复:实体类实现多层级的接口时监听器无法匹配问题,感谢 @ruansheng
|
||||
|
||||
@ -433,7 +433,13 @@ public interface BaseMapper<T> {
|
||||
* @return 实体类数据
|
||||
*/
|
||||
default T selectOneByQuery(QueryWrapper queryWrapper) {
|
||||
Long limitRows = CPI.getLimitRows(queryWrapper);
|
||||
try {
|
||||
queryWrapper.limit(1);
|
||||
return MapperUtil.getSelectOneResult(selectListByQuery(queryWrapper));
|
||||
} finally {
|
||||
CPI.setLimitRows(queryWrapper, limitRows);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,7 +450,13 @@ public interface BaseMapper<T> {
|
||||
* @return 实体类数据
|
||||
*/
|
||||
default <R> R selectOneByQueryAs(QueryWrapper queryWrapper, Class<R> asType) {
|
||||
Long limitRows = CPI.getLimitRows(queryWrapper);
|
||||
try {
|
||||
queryWrapper.limit(1);
|
||||
return MapperUtil.getSelectOneResult(selectListByQueryAs(queryWrapper, asType));
|
||||
} finally {
|
||||
CPI.setLimitRows(queryWrapper, limitRows);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -455,7 +467,7 @@ public interface BaseMapper<T> {
|
||||
*/
|
||||
default T selectOneWithRelationsByMap(Map<String, Object> whereConditions) {
|
||||
FlexAssert.notEmpty(whereConditions, "whereConditions");
|
||||
return selectOneWithRelationsByQuery(QueryWrapper.create().where(whereConditions).limit(1L));
|
||||
return selectOneWithRelationsByQuery(QueryWrapper.create().where(whereConditions));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -466,7 +478,7 @@ public interface BaseMapper<T> {
|
||||
*/
|
||||
default T selectOneWithRelationsByCondition(QueryCondition whereConditions) {
|
||||
FlexAssert.notNull(whereConditions, "whereConditions");
|
||||
return selectOneWithRelationsByQuery(QueryWrapper.create().where(whereConditions).limit(1L));
|
||||
return selectOneWithRelationsByQuery(QueryWrapper.create().where(whereConditions));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -476,7 +488,13 @@ public interface BaseMapper<T> {
|
||||
* @return 实体类数据
|
||||
*/
|
||||
default T selectOneWithRelationsByQuery(QueryWrapper queryWrapper) {
|
||||
Long limitRows = CPI.getLimitRows(queryWrapper);
|
||||
try {
|
||||
queryWrapper.limit(1);
|
||||
return MapperUtil.queryRelations(this, MapperUtil.getSelectOneResult(selectListByQuery(queryWrapper)));
|
||||
} finally {
|
||||
CPI.setLimitRows(queryWrapper, limitRows);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -82,11 +82,7 @@ public class Account6Test implements WithAssertions {
|
||||
// 没有 ID,插入失败
|
||||
Assert.fail();
|
||||
} catch (Exception e) {
|
||||
assertThat(e.getCause()).isInstanceOf(InvocationTargetException.class)
|
||||
.asInstanceOf(InstanceOfAssertFactories.type(InvocationTargetException.class))
|
||||
.extracting(i -> i.getTargetException().getMessage())
|
||||
.asString()
|
||||
.contains("NULL not allowed for column \"ID\"");
|
||||
Assert.assertTrue(e.getMessage().contains("NULL not allowed for column \"ID\""));
|
||||
}
|
||||
|
||||
List<Account6> list = mapper.selectAll();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user