mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 09:38:26 +08:00
fixed: 修复 QueryWrapper 不能使用超过一次; github close #49
This commit is contained in:
parent
19ca5f9373
commit
4b1ddae7bd
@ -542,6 +542,7 @@ public interface BaseMapper<T> {
|
||||
*/
|
||||
default long selectCountByQuery(QueryWrapper queryWrapper) {
|
||||
List<QueryColumn> selectColumns = CPI.getSelectColumns(queryWrapper);
|
||||
try {
|
||||
if (CollectionUtil.isEmpty(selectColumns)) {
|
||||
queryWrapper.select(count());
|
||||
}
|
||||
@ -554,6 +555,10 @@ public interface BaseMapper<T> {
|
||||
} else {
|
||||
throw FlexExceptions.wrap("selectCountByQuery error, Can not get number value for queryWrapper: %s", queryWrapper);
|
||||
}
|
||||
} finally {
|
||||
//fixed https://github.com/mybatis-flex/mybatis-flex/issues/49
|
||||
CPI.setSelectColumns(queryWrapper, selectColumns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user