Browse Source

指定字段查询

master
583641232@qq.com 1 year ago
parent
commit
a6fb6779c7
  1. 2
      cas-admin/src/main/resources/application-dev.yml
  2. 2
      cas-admin/src/main/resources/application-prod.yml
  3. 14
      cas-system/src/main/java/com/inscloudtech/datacenter/domain/CollectionInformation.java
  4. 18
      cas-system/src/main/java/com/inscloudtech/datacenter/service/impl/CollectionInformationServiceImpl.java

2
cas-admin/src/main/resources/application-dev.yml

@ -82,6 +82,6 @@ easy-es:
address: 192.168.3.20:9200 #es的连接地址,必须含端口 若为集群,则可以用逗号隔开 例如:127.0.0.1:9200,127.0.0.2:9200
global-config:
distributed: false
print-dsl: false
print-dsl: true
password: ly123456
username: elastic

2
cas-admin/src/main/resources/application-prod.yml

@ -86,4 +86,4 @@ easy-es:
address: localhost:9200 #es的连接地址,必须含端口 若为集群,则可以用逗号隔开 例如:127.0.0.1:9200,127.0.0.2:9200
global-config:
distributed: false
print-dsl: false
print-dsl: true

14
cas-system/src/main/java/com/inscloudtech/datacenter/domain/CollectionInformation.java

@ -41,7 +41,7 @@ public class CollectionInformation extends BaseEntity {
@UpdateValueLog(fieldName = "信息来源")
@DeduplicationField
@ExcelProperty("信息来源")
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
private String informationSources ;
@ -51,7 +51,7 @@ public class CollectionInformation extends BaseEntity {
@UpdateValueLog(fieldName = "主体名称")
@DeduplicationField
@ExcelProperty("主体名称")
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
private String name;
@ -61,7 +61,7 @@ public class CollectionInformation extends BaseEntity {
@ExcelProperty("基础信息")
@DeduplicationField
@UpdateValueLog(fieldName = "基础信息")
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
private String basicInfo;
@ -71,7 +71,7 @@ public class CollectionInformation extends BaseEntity {
@ExcelProperty("关系信息")
@UpdateValueLog(fieldName = "关系信息")
@DeduplicationField
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
private String relationInfo;
@ -81,7 +81,7 @@ public class CollectionInformation extends BaseEntity {
@ExcelProperty("财产信息")
@UpdateValueLog(fieldName = "财产信息")
@DeduplicationField
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
private String assetsInfo;
/**
@ -90,7 +90,7 @@ public class CollectionInformation extends BaseEntity {
@ExcelProperty("行为信息")
@DeduplicationField
@UpdateValueLog(fieldName = "行为信息")
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
private String actionInfo;
/**
@ -99,7 +99,7 @@ public class CollectionInformation extends BaseEntity {
@UpdateValueLog(fieldName = "其他事项")
@ExcelProperty("其他事项")
@DeduplicationField
@IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer")
@IndexField(fieldType = FieldType.KEYWORD)
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String remark;

18
cas-system/src/main/java/com/inscloudtech/datacenter/service/impl/CollectionInformationServiceImpl.java

@ -148,16 +148,14 @@ public class CollectionInformationServiceImpl implements CollectionInformationSe
// lqw.multiMatchQuery(keyword, CollectionInformation::getInformationSources, CollectionInformation::getName,
// CollectionInformation::getBasicInfo,CollectionInformation::getRelationInfo,CollectionInformation::getAssetsInfo,
// CollectionInformation::getActionInfo,CollectionInformation::getRemark);
lqw.like(CollectionInformation::getInformationSources, keyword);
// lqw.or().like(CollectionInformation::getName, keyword);
// lqw.or().like(CollectionInformation::getBasicInfo, keyword);
// lqw.or().like(CollectionInformation::getRelationInfo, keyword);
// lqw.or().like(CollectionInformation::getAssetsInfo, keyword);
// lqw.or().like(CollectionInformation::getActionInfo, keyword);
// lqw.or().like( CollectionInformation::getRemark, keyword);
lqw.and(lq -> lq.or().like(CollectionInformation::getInformationSources, keyword)
.or().like(CollectionInformation::getName, keyword)
.or().like(CollectionInformation::getBasicInfo, keyword)
.or().like(CollectionInformation::getRelationInfo, keyword)
.or().like(CollectionInformation::getAssetsInfo, keyword)
.or().like(CollectionInformation::getActionInfo, keyword)
.or().like(CollectionInformation::getRemark, keyword)
);
}
return lqw;
}

Loading…
Cancel
Save