|
|
|
@ -3,7 +3,6 @@ package com.ibeetl.admin.core.service;
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.util.enums.DelFlagEnum;
|
|
|
|
@ -232,7 +231,7 @@ public class CoreBaseService<T> extends CoreBaseAnnotationParser {
|
|
|
|
|
* ArrayUtil.map(ignores, ReUtil::escape) 每个元素将正则的关键字转义,以防万一
|
|
|
|
|
* 生成的正则大概的样子:[org_id|user_id|_add_time|]$
|
|
|
|
|
*/
|
|
|
|
|
String regex = String.format("[%s]$", ArrayUtil.join(ArrayUtil.map(ignores, ReUtil::escape), "|"));
|
|
|
|
|
String regex = String.format("[%s]$", ArrayUtil.join(ArrayUtil.map(ignores, ReUtil::escape).toArray(), "|"));
|
|
|
|
|
log.debug("生成的正则:{}", regex);
|
|
|
|
|
|
|
|
|
|
// 构建LambdaQuery
|
|
|
|
@ -240,16 +239,14 @@ public class CoreBaseService<T> extends CoreBaseAnnotationParser {
|
|
|
|
|
LambdaQuery<T> tLambdaQuery = sqlManager.lambdaQuery(currentEntityClass);
|
|
|
|
|
|
|
|
|
|
// 实体类属性转Map
|
|
|
|
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(condition);
|
|
|
|
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(condition, true, true);
|
|
|
|
|
|
|
|
|
|
// 移除空值或者忽略字段
|
|
|
|
|
for (String k : stringObjectMap.keySet()) {
|
|
|
|
|
Object obj = stringObjectMap.get(k);
|
|
|
|
|
/**
|
|
|
|
|
* 根据类型判断是否为空, 移除非String类型的值,在忽略列表中的值
|
|
|
|
|
* 查看支持哪些类型 {@link cn.hutool.core.util.ObjectUtil#isEmpty}
|
|
|
|
|
* 移除在忽略列表中的值
|
|
|
|
|
*/
|
|
|
|
|
if (!(obj instanceof String) || ObjectUtil.isEmpty(obj) || ReUtil.isMatch(regex, k)) {
|
|
|
|
|
if (ReUtil.isMatch(regex, k)) {
|
|
|
|
|
stringObjectMap.remove(k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|