xiaoqiao 8 ay önce
ebeveyn
işleme
cdf92e6a45

doc/已更新脚本 → doc/已更新脚本.txt


+ 0 - 66
doc/待更新脚本

@@ -1,66 +0,0 @@
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T0104', '领域检索', 'T01', 2);
-
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T0104', 3, '领域检索', 'SearchOutlined', 'views/domain', '/domain', 'T01', null, 0, 1, 1, 'T0104', 1, null);
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T010401', 1, '领域检索', null, 'views/domain', '/domain/index', 'T0104', null, 0, 0, 1, 'T0104', 1, null);
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T010402', 2, '领域检索结果', null, 'views/domainResult', '/domain/result', 'T0104', null, 0, 0, 1, 'T0104', 1, null);
-
-
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T0109', '索引定义', 'T01', 9);
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T010900', '查看', 'T0109', 0);
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T010901', '新增', 'T0109', 1);
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T010902', '导入', 'T0109', 2);
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T010903', '编辑', 'T0109', 3);
- INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T010904', '删除', 'T0109', 4);
-
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T0109', 5, '索引定义', 'ReadOutlined', 'views/esindex', '/esindex', 'T01', null, 0, 1, 1, 'T0109', 1, null);
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T010901', 1, '索引管理', '', 'views/esindexlist', '/esindex/list', 'T0109', null, 0, 0, 1, 'T0109', 1, null);
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T010902', 2, '字段定义', '', 'views/esindexedit', '/esindex/edit', 'T0109', null, 0, 0, 1, null, 1, null);
- INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
- VALUES ('T010903', 3, '索引详细', '', 'views/esindexdetail', '/esindex/detail', 'T0109', null, 0, 0, 1, null, 1, null);
-
- create table es_index
- (
-     indexId              varchar(50) not null,
-     indexName            varchar(100) not null comment '索引名称',
-     indexCode            varchar(100) not null comment '索引编码',
-     indexDesc            varchar(200) comment '描述',
-     displayType          int comment '显示类型1、生命周期2、普通表格3、列表4、图表5、文档',
-     createdName          varchar(50) not null comment '创建姓名',
-     createTime           datetime not null comment '创建时间',
-     modiTime             datetime not null,
-     createdBy            varchar(50) not null comment '创建人',
-     status               int not null comment '状态(1 有效/0 无效)',
-     primary key (indexId)
- );
-
- create table es_indexField
- (
-     fieldId              varchar(50) not null,
-     indexId              varchar(50) comment '索引id',
-     fieldCode            varchar(100) not null comment '字段编码',
-     fieldName            varchar(100) not null comment '字段名称',
-     fieldDesc            varchar(200) comment '字段描述',
-     dataType             varchar(20) not null comment '数据类型',
-     queryTypeId          int not null comment '字典表queryType的值1、文本2、数值3、日期4、字典值5、级联选择6、穿梭选择',
-     disOrder             int not null,
-     isSearchField        int not null comment '1、是0、否 如是1则自助检索页面显示',
-     isDisplay            int comment '1、显示0、隐藏',
-     primary key (fieldId)
- );
-
- alter table es_indexField add constraint FK_Reference_33 foreign key (indexId)
-     references es_index (indexId) on delete restrict on update restrict;
-
-
- insert into sys_dictionary value('displayType','索引显示类型',1,1);
- insert into sys_dictionary_item values (uuid(),'','displayType',1,'生命周期',1,1,1);
- insert into sys_dictionary_item values (uuid(),'','displayType',2,'表格',2,1,1);
- insert into sys_dictionary_item values (uuid(),'','displayType',3,'列表',3,1,1);
- insert into sys_dictionary_item values (uuid(),'','displayType',4,'图表',4,1,1);
- insert into sys_dictionary_item values (uuid(),'','displayType',5,'文档',5,1,1);

+ 60 - 0
doc/待更新脚本.txt

@@ -0,0 +1,60 @@
+---2024-5-30日 购物车mysql脚本
+
+create table cf_apply_form
+(
+    applyId              varchar(50) not null,
+    applyUserId          varchar(50),
+    applyUserName        varchar(50),
+    status               int comment '1、审核中2、审核通过3、驳回',
+    applyDate            datetime comment '申请时间',
+    reason               varchar(300) comment '申请原因',
+    primary key (applyId)
+);
+
+create table cf_apply_form_reviewer
+(
+    reviewerId           varchar(50) not null,
+    applyId              varchar(50),
+    reviewerUserId       varchar(50),
+    reviewerUserName     varchar(50),
+    reviewerAction       int,
+    comments             varchar(300),
+    reviewerDate         datetime,
+    primary key (reviewerId)
+);
+
+alter table cf_apply_form_reviewer add constraint FK_Reference_34 foreign key (applyId)
+    references cf_apply_form (applyId) on delete restrict on update restrict;
+
+create table cf_apply_form_well_file
+(
+    wellFileId           varchar(50) not null,
+    applyId              varchar(50) comment '关联申请单',
+    well_common_name     varchar(200) comment '井',
+    file_name            varchar(200) comment '文件名称',
+    primary key (wellFileId)
+);
+
+alter table cf_apply_form_well_file add constraint FK_Reference_35 foreign key (applyId)
+    references cf_apply_form (applyId) on delete restrict on update restrict;
+
+INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T0111', '我的审批', 'T01', 9);
+INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
+VALUES ('T0111', 4, '我的审批', 'MailOutlined', 'views/reviewer', '/reviewer', 'T01', null, 0, 1, 1, 'T0111', 1, null);
+INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
+VALUES ('T011101', 1, '我的审批', '', 'views/reviewerList', '/reviewer/list', 'T0111', null, 0, 0, 1, 'T0111', 1, null);
+
+INSERT INTO sys_function_code (FunctionCode, FunctionName, ParentFunctionCode, OrderNo) VALUES ('T0110', '我的申请', 'T01', 9);
+INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
+VALUES ('T0110', 4, '我的申请', 'FileDoneOutlined', 'views/apply', '/apply', 'T01', null, 0, 1, 1, 'T0110', 1, null);
+INSERT INTO sys_menu (MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon)
+VALUES ('T011001', 1, '我的申请', '', 'views/applyList', '/apply/list', 'T0110', null, 0, 0, 1, 'T0110', 1, null);
+
+UPDATE sys_menu SET OrderNo=6 WHERE MenuNo='T0108';
+UPDATE sys_menu SET OrderNo=5 WHERE MenuNo='T0109';
+
+
+insert into sys_dictionary value('applyFormStatus','申请单状态',1,1);
+insert into sys_dictionary_item values (uuid(),'','applyFormStatus',1,'审核中',1,1,1);
+insert into sys_dictionary_item values (uuid(),'','applyFormStatus',2,'通过',2,1,1);
+insert into sys_dictionary_item values (uuid(),'','applyFormStatus',3,'驳回',3,1,1);

+ 100 - 83
src/main/java/com/bowintek/practice/services/impl/EsQueryServiceImpl.java

@@ -31,6 +31,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -40,6 +41,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 @Component
+@Slf4j
 public class EsQueryServiceImpl implements EsQueryService {
     @Autowired
     private ElasticsearchClient esClient;
@@ -53,19 +55,19 @@ public class EsQueryServiceImpl implements EsQueryService {
     private static List<String> pathCache = null;
     private static long cacheTime = 0;
 
-    public void getCacheList(){
+    public void getCacheList() {
         synchronized (lockObject) {
             //从本地缓存加载数据
             long timeSpan = (new Date()).getTime() - cacheTime;
-            if (timeSpan > 30 * 1000 || indexCache == null || pathCache==null) {
+            if (timeSpan > 30 * 1000 || indexCache == null || pathCache == null) {
                 List<EsIndexVo> list1 = esIndexCquery.getList(null, null, null);
                 indexCache = list1.stream()
-                        .map(m->m.getIndexCode())
+                        .map(m -> m.getIndexCode())
                         .distinct().collect(Collectors.toList());
 
-                List<EsIndexfieldVo> list2 = esIndexCquery.getFieldList(null,null);
-                pathCache = list2.stream().filter(p->p.getDataType().equals("NESTED"))
-                        .map(m->m.getFieldCode())
+                List<EsIndexfieldVo> list2 = esIndexCquery.getFieldList(null, null);
+                pathCache = list2.stream().filter(p -> p.getDataType().equals("NESTED"))
+                        .map(m -> m.getFieldCode())
                         .distinct().collect(Collectors.toList());
 
                 cacheTime = (new Date()).getTime();
@@ -73,17 +75,17 @@ public class EsQueryServiceImpl implements EsQueryService {
         }
     }
 
-    public List<String> getIndexCache(){
+    public List<String> getIndexCache() {
         getCacheList();
         return indexCache;
     }
 
-    public List<String> getPathCache(){
+    public List<String> getPathCache() {
         getCacheList();
         return pathCache;
     }
 
-    public List<Query> getComparisonQueryList(EsQueryText queryText){
+    public List<Query> getComparisonQueryList(EsQueryText queryText) {
         List<Query> queryList = new ArrayList<>();
         //分析查询字符串,有的字符串需要变成条件查询
         List<ComparisonResult> cmpList = analyzeService.analyzeJavas(queryText.getKeyString());
@@ -93,27 +95,27 @@ public class EsQueryServiceImpl implements EsQueryService {
         for (int i = 0; i < cmpList.size(); i++) {
             ComparisonResult cmp = cmpList.get(i);
             //检查查询、对比的值是否为空
-            if(StringUtils.IsNullEmpty(cmp.getKeyString())) continue;
+            if (StringUtils.IsNullEmpty(cmp.getKeyString())) continue;
 
             if (cmp.getSearchType().equals("comparison")) { //对比查询,有字段,有对比符号,有值
                 //第一级,对比搜索
                 queryList.addAll(getRangeQueryByComparison(cmp));
                 //第二级,对比搜索
-                for(String path : pathList) {
+                for (String path : pathList) {
                     queryList.addAll(getNestedRangeQueryByComparison(cmp, path));
                 }
-            } else if(StringUtils.IsNullEmpty(queryText.getField())){//全文查询,没有限制字段
+            } else if (StringUtils.IsNullEmpty(queryText.getField())) {//全文查询,没有限制字段
                 //第一级,文字搜索
                 queryList.add(getMultiMatchQuery(cmp.getKeyString()));
                 //第二级,嵌套类型,文字搜索
-                for(String path : pathList) {
+                for (String path : pathList) {
                     queryList.add(getNestedMultiMatchQuery(path, cmp.getKeyString()));
                 }
             } else { //全文查询,限定了字段
                 //第一级,文字搜索
-                queryList.add(getMultiMatchQuery(new String[]{queryText.getField()} ,cmp.getKeyString()));
+                queryList.add(getMultiMatchQuery(new String[]{queryText.getField()}, cmp.getKeyString()));
                 //第二级,嵌套类型,文字搜索
-                for(String path : pathList) {
+                for (String path : pathList) {
                     queryList.add(getNestedMultiMatchQuery(path, new String[]{queryText.getField()}, cmp.getKeyString()));
                 }
             }
@@ -133,26 +135,26 @@ public class EsQueryServiceImpl implements EsQueryService {
 
             List<Query> queryMustList = new ArrayList<>();
             //[2]分析查询字符串,有的字符串需要变成条件查询
-            for(EsQueryText queryText : queryList){
+            for (EsQueryText queryText : queryList) {
                 List<Query> shouldQuerys = getComparisonQueryList(queryText);
-                if(shouldQuerys.size()>0){
-                    queryMustList.add(Query.of(q->q.bool(b->b.should(shouldQuerys))));
+                if (shouldQuerys.size() > 0) {
+                    queryMustList.addAll(shouldQuerys);
                 }
             }
             //[3]限定查询条件,都是有条件的查询
-            for(ComparisonResult cmp:limiters){
+            for (ComparisonResult cmp : limiters) {
                 List<Query> cmpQuerys = new ArrayList<>();
                 //检查查询、对比的值是否为空
-                if(StringUtils.IsNullEmpty(cmp.getValue())) continue;
+                if (StringUtils.IsNullEmpty(cmp.getValue())) continue;
 
                 //第一级,对比搜索
                 cmpQuerys.addAll(getRangeQueryByComparison(cmp));
                 //第二级,对比搜索
-                for(String path : pathList) {
+                for (String path : pathList) {
                     cmpQuerys.addAll(getNestedRangeQueryByComparison(cmp, path));
                 }
-                if(cmpQuerys.size()>0){
-                    queryMustList.add(Query.of(q->q.bool(b->b.should(cmpQuerys))));
+                if (cmpQuerys.size() > 0) {
+                    queryMustList.addAll(cmpQuerys);
                 }
             }
 
@@ -165,96 +167,101 @@ public class EsQueryServiceImpl implements EsQueryService {
             searchRequest.from(page * limit);
             //==>设置查询条件
             if (queryMustList.size() > 0) {
-                searchRequest.query(q -> q.bool(b -> b.must(queryMustList)));
+                 Query queryMust = Query.of(q -> q.bool(b -> b.must(queryMustList)));
+                //Query byName = MatchQuery.of(m -> m.field("well_common_name").query("宁12-412"))._toQuery();
+                //Query queryMust = Query.of(q -> q.term(TermQuery.of(m -> m.field("well_common_name.keyword").value("宁12-412"))));
+                searchRequest.query(queryMust);
             }
             //==>高亮设置
-            searchRequest.highlight(h->h.fields("*", f->f.matchedFields("*")));
+            searchRequest.highlight(h -> h.fields("*", f -> f.preTags("<font color='red'>")
+                    .postTags("</font>")));
             //排序
             //searchRequest.sort(f->f.field(v->v.field("well_id").order(SortOrder.Asc)));
             //查询后分组
-            searchRequest.aggregations("group_well",a->a.terms(t->t.field("well_id.keyword")));
+            searchRequest.aggregations("group_well", a -> a.terms(t -> t.field("well_id.keyword")));
             //[5]Es发起查询
             SearchRequest request = searchRequest.build();
+
+            log.info("dsl:" + request.toString());
             SearchResponse<ObjectNode> response = esClient.search(request, ObjectNode.class);
 
             //[6]转换结果,可以对不同的index做出参数输出
             List<Map<String, Object>> rows = searchResponse2List(response);
             result.put("rows", rows);
             result.put("total", response.hits().total().value());
-            result.put("agg",aggResponse2List(response));
+            result.put("agg", aggResponse2List(response));
 
             //请求参数输出,方便调试
             String[] jsonStrings = request.toString().split("typed_keys=true");
             result.put("SearchUrl", jsonStrings[0]);
             result.put("SearchRequest", stringToNodeJson(jsonStrings[1]));
             System.out.println(response.hits().total() + " " + request.toString());
-        }
-        catch (Exception ex){
+        } catch (Exception ex) {
             result.put("Message", ex.getMessage());
             result.put("StackTrace", ex.getStackTrace());
         }
         return result;
     }
 
-    public Query getMultiMatchQuery(String text){
+    public Query getMultiMatchQuery(String text) {
         //不指定,查询所有的一级字段
         return MultiMatchQuery.of(q -> q.query(text)
                 .operator(Operator.Or))._toQuery();
     }
 
-    public Query getMultiMatchQuery(List<String> fields, String text){
+    public Query getMultiMatchQuery(List<String> fields, String text) {
         //限定查询字段
         return MultiMatchQuery.of(q -> q.fields(fields)
                 .query(text)
                 .operator(Operator.Or))._toQuery();
     }
 
-    public Query getMultiMatchQuery(String[] fields, String text){
+    public Query getMultiMatchQuery(String[] fields, String text) {
         //限定查询字段
         return getMultiMatchQuery(Arrays.asList(fields), text);
     }
 
-    public Query getNestedMultiMatchQuery(String path, String text){
+    public Query getNestedMultiMatchQuery(String path, String text) {
         //不指定,查询所有的二级字段
-        return NestedQuery.of(q-> q.path(path)
+        return NestedQuery.of(q -> q.path(path)
                 .query(getMultiMatchQuery(text))
                 .ignoreUnmapped(true))._toQuery();
     }
 
-    public Query getNestedMultiMatchQuery(String path, List<String> fields, String text){
+    public Query getNestedMultiMatchQuery(String path, List<String> fields, String text) {
         //限定查询字段
-        return NestedQuery.of(q-> q.path(path)
+        return NestedQuery.of(q -> q.path(path)
                 .query(getMultiMatchQuery(fields, text))
                 .ignoreUnmapped(true))._toQuery();
     }
 
-    public Query getNestedMultiMatchQuery(String path, String[] fields, String text){
+    public Query getNestedMultiMatchQuery(String path, String[] fields, String text) {
         //限定查询字段
-        return NestedQuery.of(q-> q.path(path)
+        return NestedQuery.of(q -> q.path(path)
                 .query(getMultiMatchQuery(fields, text))
                 .ignoreUnmapped(true))._toQuery();
     }
 
-    public List<Query> getRangeQueryByComparison(ComparisonResult cmp){
+    public List<Query> getRangeQueryByComparison(ComparisonResult cmp) {
         List<Query> queryList = new ArrayList<>();
-        for(int i=0;i<cmp.getFields().length;i++){
+        for (int i = 0; i < cmp.getFields().length; i++) {
             String fieldString = cmp.getFields()[i];
             //对比类型查询
             Query query = getComparisonQuery(fieldString, cmp.getOpreation(), cmp.getValue());
-            if(query!=null) queryList.add(query);
+            if (query != null) queryList.add(query);
         }
 
         return queryList;
     }
 
-    public List<Query> getNestedRangeQueryByComparison(ComparisonResult cmp, String path){
+    public List<Query> getNestedRangeQueryByComparison(ComparisonResult cmp, String path) {
         List<Query> queryList = new ArrayList<>();
-        for(int i=0;i<cmp.getFields().length;i++){
+        for (int i = 0; i < cmp.getFields().length; i++) {
             String fieldString = cmp.getFields()[i];
             //对比类型查询
             Query query = getComparisonQuery(path + "." + fieldString, cmp.getOpreation(), cmp.getValue());
-            if(query!=null) {
-                Query nested = NestedQuery.of(q-> q.path(path).query(query)
+            if (query != null) {
+                Query nested = NestedQuery.of(q -> q.path(path).query(query)
                         .ignoreUnmapped(true))._toQuery();
                 queryList.add(nested);
             }
@@ -263,23 +270,23 @@ public class EsQueryServiceImpl implements EsQueryService {
         return queryList;
     }
 
-    public Query getComparisonQuery(String fieldString, String opreation, String value){
+    public Query getComparisonQuery(String fieldString, String opreation, String value) {
         //对比类型查询
         Query query = null;
-        if(opreation.equals("大于"))
-            query = RangeQuery.of(q->q.field(fieldString).gt(JsonData.of(value)))._toQuery();
-        else if(opreation.equals("大于等于"))
-            query = RangeQuery.of(q->q.field(fieldString).gte(JsonData.of(value)))._toQuery();
-        else if(opreation.equals("小于"))
-            query = RangeQuery.of(q->q.field(fieldString).lt(JsonData.of(value)))._toQuery();
-        else if(opreation.equals("小于等于"))
-            query = RangeQuery.of(q->q.field(fieldString).lte(JsonData.of(value)))._toQuery();
-        else if(opreation.equals("等于"))
-            query = TermQuery.of(q->q.field(fieldString).value(value))._toQuery();
-        else if(opreation.equals("包括IN")) {
+        if (opreation.equals("大于"))
+            query = RangeQuery.of(q -> q.field(fieldString).gt(JsonData.of(value)))._toQuery();
+        else if (opreation.equals("大于等于"))
+            query = RangeQuery.of(q -> q.field(fieldString).gte(JsonData.of(value)))._toQuery();
+        else if (opreation.equals("小于"))
+            query = RangeQuery.of(q -> q.field(fieldString).lt(JsonData.of(value)))._toQuery();
+        else if (opreation.equals("小于等于"))
+            query = RangeQuery.of(q -> q.field(fieldString).lte(JsonData.of(value)))._toQuery();
+        else if (opreation.equals("等于"))
+            query = TermQuery.of(q -> q.field(fieldString).value(value))._toQuery();
+        else if (opreation.equals("包括IN")) {
             String[] ins = value.split(",");
             List<FieldValue> fls = new ArrayList<>();
-            for(String inString : ins) fls.add(FieldValue.of(inString));
+            for (String inString : ins) fls.add(FieldValue.of(inString));
             query = TermsQuery.of(q -> q.field(fieldString).terms(s -> s.value(fls)))._toQuery();
         }
         return query;
@@ -305,21 +312,21 @@ public class EsQueryServiceImpl implements EsQueryService {
             searchRequest.from(page * limit);
 
             //生成查询参数
-            if(!StringUtils.IsNullEmpty(text)) {
+            if (!StringUtils.IsNullEmpty(text)) {
                 //非嵌套字段查询
-                String[] fields = new String[]{"well_common_name","testing_name"};
+                String[] fields = new String[]{"well_common_name", "testing_name"};
                 Query query1 = MultiMatchQuery.of(q -> q.fields(Arrays.asList(fields)).query(text).operator(Operator.Or))._toQuery();
                 //嵌套字段查询
                 String[] nestedFields = new String[]{"historys.testing_name"};
                 Query nestedQuery = MultiMatchQuery.of(q -> q.fields(Arrays.asList(nestedFields)).query(text).operator(Operator.Or))._toQuery();
-                Query query3 = NestedQuery.of(q-> q.path("historys").query(nestedQuery).ignoreUnmapped(true))._toQuery();
+                Query query3 = NestedQuery.of(q -> q.path("historys").query(nestedQuery).ignoreUnmapped(true))._toQuery();
                 //对比类型查询
-                Query query2 = RangeQuery.of(q->q.field("authorized_md").gte(JsonData.of(500)))._toQuery();
+                Query query2 = RangeQuery.of(q -> q.field("authorized_md").gte(JsonData.of(500)))._toQuery();
 
                 Query[] arys = new Query[]{query1, query2, query3};
-                searchRequest.query(q->q.bool(b->b.should(Arrays.asList(arys))));
+                searchRequest.query(q -> q.bool(b -> b.should(Arrays.asList(arys))));
                 //高亮设置
-                searchRequest.highlight(h->h.fields("historys.testing_name", f->f.matchedFields("historys.testing_name")));
+                searchRequest.highlight(h -> h.fields("historys.testing_name", f -> f.matchedFields("historys.testing_name")));
             }
 
             //Es发起查询
@@ -330,9 +337,8 @@ public class EsQueryServiceImpl implements EsQueryService {
             List<Map<String, Object>> rows = searchResponse2List(response);
             result.put("rows", rows);
             result.put("total", response.hits().total().value());
-            System.out.println(response.hits().total()+" "+ request.toString());
-        }
-        catch (Exception ex){
+            System.out.println(response.hits().total() + " " + request.toString());
+        } catch (Exception ex) {
             ex.printStackTrace();
         }
         return result;
@@ -340,7 +346,7 @@ public class EsQueryServiceImpl implements EsQueryService {
 
     public void updateMappingTest() throws IOException {
         Map<String, Property> maps = new HashMap<>();
-        maps.put("well_common_name", Property.of(p->p.text(TextProperty.of(t->t.index(true).analyzer("ik_max_word")))));
+        maps.put("well_common_name", Property.of(p -> p.text(TextProperty.of(t -> t.index(true).analyzer("ik_max_word")))));
         updateMappings("fact_dwr_well_basic_information", maps);
     }
 
@@ -356,9 +362,9 @@ public class EsQueryServiceImpl implements EsQueryService {
         JsonNode rootNode = objectMapper.readTree(jsonString);
         return rootNode;
     }
-    public List<Map<String, Object>> aggResponse2List(SearchResponse<ObjectNode> searchResponse)
-    {
-        List<StringTermsBucket> buckets =searchResponse.aggregations().get("group_well").sterms().buckets().array();
+
+    public List<Map<String, Object>> aggResponse2List(SearchResponse<ObjectNode> searchResponse) {
+        List<StringTermsBucket> buckets = searchResponse.aggregations().get("group_well").sterms().buckets().array();
         List<Map<String, Object>> aggs = new ArrayList<>();
         for (StringTermsBucket bucket : buckets) {
             Map<String, Object> map = new HashMap<>();
@@ -368,10 +374,15 @@ public class EsQueryServiceImpl implements EsQueryService {
         }
         return aggs;
     }
+
     public List<Map<String, Object>> searchResponse2List(SearchResponse<ObjectNode> searchResponse) {
 
-        if (searchResponse == null) {return new ArrayList<>(0);}
-        if (searchResponse.hits() == null) {return new ArrayList<>(0);}
+        if (searchResponse == null) {
+            return new ArrayList<>(0);
+        }
+        if (searchResponse.hits() == null) {
+            return new ArrayList<>(0);
+        }
         //if (CommonUtils.isCollectionEmpty(searchResponse.hits().hits())) {return new ArrayList<>(0);}
 
         List<Hit<ObjectNode>> hits = searchResponse.hits().hits();
@@ -386,29 +397,35 @@ public class EsQueryServiceImpl implements EsQueryService {
 
             //输出结果日志
             String line = "=>";
-            for(Map.Entry<String, Object> entry : map.entrySet()){
-                line += "  "+entry.getKey()
-                        +":"+ (entry.getValue()==null?"null":entry.getValue().toString());
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
+                line += "  " + entry.getKey()
+                        + ":" + (entry.getValue() == null ? "null" : entry.getValue().toString());
             }
             System.out.println(line);
         }
         return list;
     }
 
-    public String subFieldIndex(String index, String fieldName){
-        if(fieldName.startsWith(index) && fieldName.length()> index.length()+1) return fieldName.substring(index.length()+1);
+    public String subFieldIndex(String index, String fieldName) {
+        if (fieldName.startsWith(index) && fieldName.length() > index.length() + 1)
+            return fieldName.substring(index.length() + 1);
         return fieldName;
     }
 
     public Map<String, Object> objectNode2Map(String index, ObjectNode objectNode) {
-        if (null == objectNode) {return new HashMap<>(0);}
-        if (objectNode.isEmpty()) {return new HashMap<>(0);}
+        if (null == objectNode) {
+            return new HashMap<>(0);
+        }
+        if (objectNode.isEmpty()) {
+            return new HashMap<>(0);
+        }
         ObjectMapper objectMapper = new ObjectMapper();
-        Map<String, Object> map = objectMapper.convertValue(objectNode, new TypeReference<Map<String, Object>>() {});
+        Map<String, Object> map = objectMapper.convertValue(objectNode, new TypeReference<Map<String, Object>>() {
+        });
 
-        for(Map.Entry<String, Object> entry : map.entrySet()){
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
             String name = subFieldIndex(index, entry.getKey());
-            if(name.equals(entry.getKey())) continue;
+            if (name.equals(entry.getKey())) continue;
 
             map.remove(entry.getKey());
             map.put(name, entry.getValue());

+ 7 - 5
vue/src/components/basic/es-result/query-criteria.vue

@@ -103,11 +103,13 @@ export default defineComponent({
       });
       //限定条件写入
       //{"fieldName":"开钻日期", "fields":["spud_date"],"opreation":"大于","value":"2022-03-28"}
-      queryObject.limiters.push({
-        fields: ["well_common_name.keyword"],
-        opreation: '等于',
-        value: formState.well_common_name
-      });
+      if(formState.well_common_name!=null&&formState.well_common_name!="") {
+        queryObject.limiters.push({
+          fields: ["well_common_name.keyword"],
+          opreation: '等于',
+          value: formState.well_common_name
+        });
+      }
       //多个值测试,如 组织单位 in 哪些值
      // queryObject.limiters.push({fields: ["well_type.keyword"], opreation: '包括IN', value: '直井'});
 

+ 3 - 3
vue/src/views/wellinfo/index.vue

@@ -382,7 +382,7 @@ export default defineComponent({
     const showTree = ref(true);
     const isShowDoc = ref(false);
     const showColumnType = ref(['oil', 'gas', 'water']);
-    const data = ref([{children: [], label: '', value: ''}]);
+    const data = ref([]);
     const viewModel = ref("list");
     const tabsViewStore = useTabsViewStore();
     const docKey = ref('');
@@ -553,7 +553,7 @@ export default defineComponent({
       } else {
         subjectTrees.value.data = Object.assign(subjectTrees.value.organizationTree);
       }
-      loadData();
+      data.value=[];
       getSubjectTree();
     }
     const detail = (well_id) => {
@@ -827,7 +827,7 @@ export default defineComponent({
   },
   created() {
     this.getSettingColumns();
-    this.loadData();
+    //this.loadData();
   }
   ,
   activated() {