mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 09:08:24 +08:00
commit
09ec3a2838
@ -40,7 +40,7 @@ import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class QueryEntityProcesser extends AbstractProcessor {
|
||||
public class QueryEntityProcessor extends AbstractProcessor {
|
||||
|
||||
private static final List<String> defaultSupportColumnTypes = Arrays.asList(
|
||||
int.class.getName(), Integer.class.getName(),
|
||||
@ -339,7 +339,7 @@ public class QueryEntityProcesser extends AbstractProcessor {
|
||||
if (writer != null) {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -409,7 +409,7 @@ public class QueryEntityProcesser extends AbstractProcessor {
|
||||
if (writer != null) {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
com.mybatisflex.processer.QueryEntityProcesser
|
||||
com.mybatisflex.processer.QueryEntityProcessor
|
||||
@ -22,6 +22,7 @@ import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.query.QueryCondition;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.query.CPI;
|
||||
import com.mybatisflex.core.util.ObjectUtil;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.builder.annotation.ProviderContext;
|
||||
|
||||
@ -35,7 +36,7 @@ public interface BaseMapper<T> {
|
||||
/**
|
||||
* 插入 entity 数据
|
||||
*
|
||||
* @param entity
|
||||
* @param entity 实体类
|
||||
* @return 返回影响的行数
|
||||
* @see com.mybatisflex.core.provider.EntitySqlProvider#insert(Map, ProviderContext)
|
||||
*/
|
||||
@ -80,11 +81,11 @@ public interface BaseMapper<T> {
|
||||
/**
|
||||
* 根据 map 构建的条件来删除数据
|
||||
*
|
||||
* @param whereConditions
|
||||
* @param whereConditions 条件
|
||||
* @return 返回影响的行数
|
||||
*/
|
||||
default int deleteByMap(Map<String, Object> whereConditions) {
|
||||
if (whereConditions == null || whereConditions.isEmpty()) {
|
||||
if (ObjectUtil.areNull(whereConditions) || whereConditions.isEmpty()) {
|
||||
throw FlexExceptions.wrap("deleteByMap is not allow empty map.");
|
||||
}
|
||||
return deleteByQuery(QueryWrapper.create().where(whereConditions));
|
||||
@ -153,7 +154,6 @@ public interface BaseMapper<T> {
|
||||
* @param entity 数据内容
|
||||
* @param ignoreNulls 是否忽略空值
|
||||
* @param queryWrapper query 条件
|
||||
* @return
|
||||
* @see com.mybatisflex.core.provider.EntitySqlProvider#updateByQuery(Map, ProviderContext)
|
||||
*/
|
||||
@UpdateProvider(type = EntitySqlProvider.class, method = "updateByQuery")
|
||||
@ -201,11 +201,7 @@ public interface BaseMapper<T> {
|
||||
*/
|
||||
default T selectOneByQuery(@Param(FlexConsts.QUERY) QueryWrapper queryWrapper) {
|
||||
List<T> entities = selectListByQuery(queryWrapper.limit(1));
|
||||
if (entities == null || entities.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return entities.get(0);
|
||||
}
|
||||
return (entities == null || entities.isEmpty()) ? null : entities.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,7 +295,7 @@ public interface BaseMapper<T> {
|
||||
/**
|
||||
* 根据 queryWrapper 来查询数据量
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param queryWrapper 查询包装器
|
||||
* @return 数据量
|
||||
* @see EntitySqlProvider#selectCountByQuery(Map, ProviderContext)
|
||||
*/
|
||||
|
||||
@ -65,7 +65,7 @@ public class MybatisFlexBootstrap {
|
||||
protected SqlSessionFactory sqlSessionFactory;
|
||||
protected Class<? extends Log> logImpl;
|
||||
|
||||
private Map<Class<?>, Object> mapperObjects = new ConcurrentHashMap<>();
|
||||
private final Map<Class<?>, Object> mapperObjects = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 虽然提供了 getInstance,但也允许用户进行实例化,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user