mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
optimize: BaseMapper.selectOneByXXX
This commit is contained in:
parent
26ed92ebe6
commit
3fedc3caad
@ -373,7 +373,7 @@ public interface BaseMapper<T> {
|
||||
if (map == null || map.isEmpty()) {
|
||||
throw FlexExceptions.wrap("map can not be null or empty.");
|
||||
}
|
||||
return selectOneByQuery(QueryWrapper.create().where(map));
|
||||
return selectOneByQuery(QueryWrapper.create().where(map).limit(1));
|
||||
}
|
||||
|
||||
|
||||
@ -387,7 +387,7 @@ public interface BaseMapper<T> {
|
||||
if (condition == null) {
|
||||
throw FlexExceptions.wrap("condition can not be null.");
|
||||
}
|
||||
return selectOneByQuery(QueryWrapper.create().where(condition));
|
||||
return selectOneByQuery(QueryWrapper.create().where(condition).limit(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -585,7 +585,7 @@ public class Db {
|
||||
* @param whereColumns where条件
|
||||
*/
|
||||
public static Row selectOneByMap(String schema, String tableName, Map whereColumns) {
|
||||
return invoker().selectOneByQuery(schema, tableName, new QueryWrapper().where(whereColumns));
|
||||
return invoker().selectOneByQuery(schema, tableName, new QueryWrapper().where(whereColumns).limit(1));
|
||||
}
|
||||
|
||||
|
||||
@ -596,7 +596,7 @@ public class Db {
|
||||
* @param whereColumns where条件
|
||||
*/
|
||||
public static Row selectOneByMap(String tableName, Map whereColumns) {
|
||||
return invoker().selectOneByQuery(null, tableName, new QueryWrapper().where(whereColumns));
|
||||
return invoker().selectOneByQuery(null, tableName, new QueryWrapper().where(whereColumns).limit(1));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -607,7 +607,7 @@ public class Db {
|
||||
* @param condition 条件
|
||||
*/
|
||||
public static Row selectOneByCondition(String schema, String tableName, QueryCondition condition) {
|
||||
return invoker().selectOneByQuery(schema, tableName, new QueryWrapper().where(condition));
|
||||
return invoker().selectOneByQuery(schema, tableName, new QueryWrapper().where(condition).limit(1));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -617,7 +617,7 @@ public class Db {
|
||||
* @param condition 条件
|
||||
*/
|
||||
public static Row selectOneByCondition(String tableName, QueryCondition condition) {
|
||||
return invoker().selectOneByQuery(null, tableName, new QueryWrapper().where(condition));
|
||||
return invoker().selectOneByQuery(null, tableName, new QueryWrapper().where(condition).limit(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user