From 59cb515466d2d9e53e06417edb6b0a9ca8f69414 Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Fri, 25 Mar 2022 22:07:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=BA=93--=E5=9C=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=AD=E6=A3=80=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DocumentSearchServiceImpl.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java index c4ac4ca81..a7da908b9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java @@ -140,9 +140,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { if(ObjectUtils.isNotEmpty(mapTwo)){ queryCondition(mapTwo, inputFieldList, otherFieldList, must); } + //处理ids + JSONArray should = new JSONArray(); + String ids = (String) mapTwo.get("ids"); + if(StringUtils.isNotBlank(ids)){ + for (String s : ids.split(",")) { + Map queryMap = new HashMap<>(); + Map queryMapTemp = new HashMap<>(); + queryMapTemp.put("id", s); + queryMap.put("match", queryMapTemp); + should.add(queryMap); + } + } //列表 //封装查询条件 - JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(must, null, null); + JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(must, null, should); //1. 封装分页和字段值 JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(sourceList, jsonObject, null, null, Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString())); @@ -200,9 +212,9 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { String key = entry.getKey(); Object value = entry.getValue(); //处理二次搜索中选择列表数据 - if("ids".equals(key) && ObjectUtils.isNotEmpty(value)){ - inputMap.put("id", value); - } +// if("ids".equals(key) && ObjectUtils.isNotEmpty(value)){ +// inputMap.put("id", value); +// } if (inputFieldList.contains(key)) { inputMap.put(key, value); }