修改查询条件为多选

This commit is contained in:
sh
2026-03-12 14:47:47 +08:00
parent d918189775
commit 9c58cd9168
2 changed files with 23 additions and 13 deletions

View File

@@ -118,7 +118,7 @@ public class Job extends BaseEntity
@ApiModelProperty("是否发布 0未发布 1发布") @ApiModelProperty("是否发布 0未发布 1发布")
private Integer isPublish; private Integer isPublish;
@ApiModelProperty("数据来源") @ApiModelProperty("数据来源 0系统自录1 365平台同步2招聘会同步3岗位抓取")
private String dataSource; private String dataSource;
@ApiModelProperty("岗位链接") @ApiModelProperty("岗位链接")

View File

@@ -488,9 +488,10 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(esJobSearch.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(esJobSearch.getLatitude().toString()), Double.parseDouble(esJobSearch.getLongitude().toString()))); wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(esJobSearch.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(esJobSearch.getLatitude().toString()), Double.parseDouble(esJobSearch.getLongitude().toString())));
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getEducation())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getEducation())){
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getEducation()); //Integer maxValue = StringUtil.findMaxValue(esJobSearch.getEducation());
//wrapper.and(x->x.le(ESJobDocument::getEducation_int,maxValue));//模糊查询 //wrapper.and(x->x.le(ESJobDocument::getEducation_int,maxValue));//模糊查询
wrapper.and(x->x.eq(ESJobDocument::getEducation_int,maxValue));//精准查询 List<Integer> integers=StringUtil.convertStringToIntegerList(esJobSearch.getEducation());
wrapper.and(x->x.in(ESJobDocument::getEducation,integers));
} }
if(Objects.nonNull(esJobSearch.getMaxSalary())){ if(Objects.nonNull(esJobSearch.getMaxSalary())){
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,esJobSearch.getMaxSalary())); wrapper.and(x->x.le(ESJobDocument::getMaxSalary,esJobSearch.getMaxSalary()));
@@ -499,9 +500,10 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(x->x.ge(ESJobDocument::getMinSalary,esJobSearch.getMinSalary())); wrapper.and(x->x.ge(ESJobDocument::getMinSalary,esJobSearch.getMinSalary()));
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience()); //Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience());
//wrapper.and(x->x.le(ESJobDocument::getExperience_int,maxValue)); //wrapper.and(x->x.le(ESJobDocument::getExperience_int,maxValue));
wrapper.and(x->x.eq(ESJobDocument::getExperience_int,maxValue));//精准查询 List<Integer> integers = StringUtil.convertStringToIntegerList(esJobSearch.getExperience());
wrapper.and(x->x.in(ESJobDocument::getExperience_int,integers));//精准查询
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){
//wrapper.and(x->x.eq(ESJobDocument::getJobCategory,esJobSearch.getJobCategory())); //wrapper.and(x->x.eq(ESJobDocument::getJobCategory,esJobSearch.getJobCategory()));
@@ -511,9 +513,10 @@ public class ESJobSearchImpl implements IESJobSearchService
.like(ESJobDocument::getJobTitle, targetValue)); .like(ESJobDocument::getJobTitle, targetValue));
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getScale())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getScale())){
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getScale()); //Integer maxValue = StringUtil.findMaxValue(esJobSearch.getScale());
//wrapper.and(x->x.le(ESJobDocument::getScale,maxValue)); //wrapper.and(x->x.le(ESJobDocument::getScale,maxValue));
wrapper.and(x->x.eq(ESJobDocument::getScale,maxValue));//精准查询 List<Integer> integers = StringUtil.convertStringToIntegerList(esJobSearch.getScale());
wrapper.and(x->x.in(ESJobDocument::getScale,integers));//精准查询
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getArea())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getArea())){
List<Integer> integers = StringUtil.convertStringToIntegerList(esJobSearch.getArea()); List<Integer> integers = StringUtil.convertStringToIntegerList(esJobSearch.getArea());
@@ -523,7 +526,8 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(x->x.eq(ESJobDocument::getJobType,esJobSearch.getJobType())); wrapper.and(x->x.eq(ESJobDocument::getJobType,esJobSearch.getJobType()));
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getType())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getType())){
wrapper.and(x->x.eq(ESJobDocument::getType,esJobSearch.getType())); List<Integer> integers = StringUtil.convertStringToIntegerList(esJobSearch.getType());
wrapper.and(x->x.in(ESJobDocument::getType,integers));
} }
if(!StringUtil.isEmptyOrNull(esJobSearch.getDescription())){ if(!StringUtil.isEmptyOrNull(esJobSearch.getDescription())){
wrapper.and(x->x.like(ESJobDocument::getDescription,esJobSearch.getDescription())); wrapper.and(x->x.like(ESJobDocument::getDescription,esJobSearch.getDescription()));
@@ -591,7 +595,9 @@ public class ESJobSearchImpl implements IESJobSearchService
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getEducation())){ if(!StringUtil.isEmptyOrNull(jobQuery.getEducation())){
//wrapper.and(a->a.le(ESJobDocument::getEducation,jobQuery.getEducation())); //wrapper.and(a->a.le(ESJobDocument::getEducation,jobQuery.getEducation()));
wrapper.and(a->a.eq(ESJobDocument::getEducation,jobQuery.getEducation())); //wrapper.and(a->a.eq(ESJobDocument::getEducation,jobQuery.getEducation()));
List<Integer> integers=StringUtil.convertStringToIntegerList(jobQuery.getEducation());
wrapper.and(a->a.in(ESJobDocument::getEducation,integers));
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getArea())){ if(!StringUtil.isEmptyOrNull(jobQuery.getArea())){
List<Integer> integers = StringUtil.convertStringToIntegerList(jobQuery.getArea()); List<Integer> integers = StringUtil.convertStringToIntegerList(jobQuery.getArea());
@@ -599,7 +605,8 @@ public class ESJobSearchImpl implements IESJobSearchService
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getExperience())){ if(!StringUtil.isEmptyOrNull(jobQuery.getExperience())){
//wrapper.and(a->a.le(ESJobDocument::getExperience,jobQuery.getExperience())); //wrapper.and(a->a.le(ESJobDocument::getExperience,jobQuery.getExperience()));
wrapper.and(a->a.eq(ESJobDocument::getExperience,jobQuery.getExperience())); List<Integer> integers = StringUtil.convertStringToIntegerList(jobQuery.getExperience());
wrapper.and(a->a.in(ESJobDocument::getExperience,integers));
} }
if(Objects.nonNull(jobQuery.getMaxSalary())){ if(Objects.nonNull(jobQuery.getMaxSalary())){
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,jobQuery.getMaxSalary())); wrapper.and(x->x.le(ESJobDocument::getMaxSalary,jobQuery.getMaxSalary()));
@@ -617,10 +624,12 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(jobQuery.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(jobQuery.getLatitude().toString()), Double.parseDouble(jobQuery.getLongitude().toString()))); wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(jobQuery.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(jobQuery.getLatitude().toString()), Double.parseDouble(jobQuery.getLongitude().toString())));
} }
if(jobQuery.getJobLocationAreaCode()!=null){ if(jobQuery.getJobLocationAreaCode()!=null){
wrapper.and(a->a.eq(ESJobDocument::getJobLocationAreaCode,jobQuery.getJobLocationAreaCode())); List<Integer> integers = StringUtil.convertStringToIntegerList(jobQuery.getJobLocationAreaCode());
wrapper.and(a->a.in(ESJobDocument::getJobLocationAreaCode,integers));
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getScale())){ if(!StringUtil.isEmptyOrNull(jobQuery.getScale())){
wrapper.and(a->a.eq(ESJobDocument::getScale,jobQuery.getScale())); List<Integer> integers = StringUtil.convertStringToIntegerList(jobQuery.getScale());
wrapper.and(a->a.in(ESJobDocument::getScale,integers));
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getSearchValue())){ if(!StringUtil.isEmptyOrNull(jobQuery.getSearchValue())){
wrapper.and(a->a.match(ESJobDocument::getDescription,jobQuery.getSearchValue(),4.0f)); wrapper.and(a->a.match(ESJobDocument::getDescription,jobQuery.getSearchValue(),4.0f));
@@ -629,7 +638,8 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(a->a.eq(ESJobDocument::getCompanyNature,jobQuery.getCompanyNature())); wrapper.and(a->a.eq(ESJobDocument::getCompanyNature,jobQuery.getCompanyNature()));
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getType())){ if(!StringUtil.isEmptyOrNull(jobQuery.getType())){
wrapper.and(a->a.eq(ESJobDocument::getType,jobQuery.getType())); List<Integer> integers = StringUtil.convertStringToIntegerList(jobQuery.getType());
wrapper.and(a->a.in(ESJobDocument::getType,integers));
} }
if(!StringUtil.isEmptyOrNull(jobQuery.getJobType())){ if(!StringUtil.isEmptyOrNull(jobQuery.getJobType())){
wrapper.and(a->a.eq(ESJobDocument::getJobType,jobQuery.getJobType())); wrapper.and(a->a.eq(ESJobDocument::getJobType,jobQuery.getJobType()));