add 国际研讨会查询参会人增加choiceTopic字段

This commit is contained in:
lijiarao
2023-11-06 17:48:33 +08:00
parent c250cddd1a
commit d307a01f99
2 changed files with 16 additions and 0 deletions
@@ -14,6 +14,7 @@ import com.jero.common.util.CommonUtils;
import com.jero.common.util.DateUtils;
import com.jero.common.util.SqlInjectionUtil;
import com.jero.common.util.oConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.NumberUtils;
import java.beans.PropertyDescriptor;
@@ -38,6 +39,7 @@ public class QueryGenerator {
* 数字类型字段,拼接此后缀 接受多值参数
*/
private static final String MULTI = "_MultiString";
private static final String REGEXP = "_regexp";
private static final String STAR = "*";
private static final String COMMA = ",";
/**
@@ -210,6 +212,11 @@ public class QueryGenerator {
endValue = parameterMap.get(filedName + MULTI)[0].trim();
addQueryByRule(queryWrapper, columnName.replace(MULTI,""), type, endValue, QueryRuleEnum.IN);
}
//多值查询
if (parameterMap != null && parameterMap.containsKey(filedName + REGEXP)) {
endValue = parameterMap.get(filedName + REGEXP)[0].trim();
addQueryByRule(queryWrapper, columnName.replace(REGEXP,""), type, endValue, QueryRuleEnum.REGEXP_IN);
}
}
//多字段排序 TODO 需要修改前端
@@ -533,11 +540,19 @@ public class QueryGenerator {
case RIGHT_LIKE:
queryWrapper.likeRight(name, value);
break;
case REGEXP_IN:
queryWrapper.apply(name + " REGEXP '{0}'", dealValue(value.toString()));
break;
default:
log.info("--查询规则未匹配到---");
break;
}
}
private static String dealValue(String value){
// 处理 value 。按照逗号分割。
String[] valueArr = value.split(",");
return StringUtils.join(valueArr, "|");
}
/**
*
* @param name
@@ -21,6 +21,7 @@ public enum QueryRuleEnum {
RIGHT_LIKE("RIGHT_LIKE","right_like","右模糊"),
EQ_WITH_ADD("EQWITHADD","eq_with_add","带加号等于"),
LIKE_WITH_AND("LIKEWITHAND","like_with_and","多词模糊匹配————暂时未用上"),
REGEXP_IN("REGEXP","regexp","正则表达式in"),
SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段");
private String value;