文档库--组合搜索问题

This commit is contained in:
zhn
2022-03-24 16:38:44 +08:00
parent b4441bec2b
commit bb3f346fdd
2 changed files with 7 additions and 5 deletions
@@ -2159,11 +2159,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
StringBuilder condition = new StringBuilder();
for (String valueTemp : value.split(",")) {
valueSb.append("'" + valueTemp + "',");
condition.append(" or " + key + " like concat(concat('%','" + valueTemp + "'),'%')");
condition.append(" or " + key + " like concat(concat('%','" + valueTemp + "'),'%'))");
}
String substring = valueSb.substring(0, valueSb.length() - 1);
//下拉单选或下拉多选
conditionSb.append(" and " + key + " in(" + substring + ")" + condition.toString());
conditionSb.append(" and (" + key + " in(" + substring + ")" + condition.toString());
} else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldType)) {
//日期(区分单日期还时间范围)
@@ -88,7 +88,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
.filter(e -> FieldTypeEnum.TEXT_STRING.getValue().equals(e.getFieldShowType())
|| FieldTypeEnum.TEXT_NUMBER.getValue().equals(e.getFieldShowType()))
.collect(Collectors.toList());
List<String> inputFieldList = inputOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldEnName).collect(Collectors.toList());
List<String> inputFieldList = inputOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
//下拉,树形,日期等字段
List<OnlCgformField> otherOnlCgformFieldList = fieldList.stream()
.filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType())//下拉单选
@@ -97,7 +97,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|| FieldTypeEnum.DATE_MORE.getValue().equals(e.getFieldShowType())//日期多选
|| FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))//树形
.collect(Collectors.toList());
List<String> otherFieldList = otherOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldEnName).collect(Collectors.toList());
List<String> otherFieldList = otherOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
//过滤出下拉选
List<OnlCgformField> onlCgformFieldList = fieldList.stream()
@@ -136,6 +136,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
}
}
JSONArray should = new JSONArray();
JSONArray must = new JSONArray();
//封装输入框查询条件
if (ObjectUtils.isNotEmpty(inputMap)) {
Map<String, Object> queryMap = new HashMap<>();
@@ -145,10 +146,11 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> queryMapTemp = new HashMap<>();
queryMapTemp.put(key, value);
queryMap.put("match", queryMapTemp);
must.add(queryMap);
}
int a=0;
}
//封装下拉,树形,日期查询条件
JSONArray must = new JSONArray();
if (ObjectUtils.isNotEmpty(otherMap)) {
for (Map.Entry<String, Object> entry : otherMap.entrySet()) {
String key = entry.getKey();