mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
fixed baseMapper.selectOneByQueryAs() method
This commit is contained in:
parent
e116568a06
commit
040738a832
@ -331,8 +331,13 @@ public interface BaseMapper<T> {
|
||||
* @return 数据内容
|
||||
*/
|
||||
default <R> R selectOneByQueryAs(QueryWrapper queryWrapper, Class<R> asType) {
|
||||
List<R> entities = selectListByQueryAs(queryWrapper.limit(1), asType);
|
||||
return (entities == null || entities.isEmpty()) ? null : entities.get(0);
|
||||
try {
|
||||
MappedStatementTypes.setCurrentType(asType);
|
||||
List<R> entities = selectListByQueryAs(queryWrapper.limit(1), asType);
|
||||
return (entities == null || entities.isEmpty()) ? null : entities.get(0);
|
||||
} finally {
|
||||
MappedStatementTypes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user