diff --git a/client-api/src/main/java/org/jiayunet/service/JobService.java b/client-api/src/main/java/org/jiayunet/service/JobService.java index 14bbf18..bb1cbba 100644 --- a/client-api/src/main/java/org/jiayunet/service/JobService.java +++ b/client-api/src/main/java/org/jiayunet/service/JobService.java @@ -105,7 +105,7 @@ public class JobService { List excludeIndustryIds = dislikes.stream().map(UserJobDislike::getIndustryId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); // 6. 执行分页查询 - Page page = jobMapper.selectJobPage(param.toPage(), param.getJobIds(),param.getStatusFilter(), expandedRegionCodes, expandedCategoryIds, expandedIndustryIds, param.getEmploymentType(), excludeJobIds, excludeCompanyIds, excludeRegionCodes, excludeIndustryIds); + Page page = jobMapper.selectJobPage(param.toPage(), param.getJobIds(),param.getStatusFilter(), param.getKeyword(), expandedRegionCodes, expandedCategoryIds, expandedIndustryIds, param.getEmploymentType(), excludeJobIds, excludeCompanyIds, excludeRegionCodes, excludeIndustryIds); // 7. 查询收藏状态 List jobIds = page.getRecords().stream().map(JobListItemVo::getId).collect(Collectors.toList()); diff --git a/common/src/main/java/org/jiayunet/pojo/PageParam.java b/common/src/main/java/org/jiayunet/pojo/PageParam.java index db41867..dbf7b5d 100644 --- a/common/src/main/java/org/jiayunet/pojo/PageParam.java +++ b/common/src/main/java/org/jiayunet/pojo/PageParam.java @@ -23,6 +23,11 @@ public class PageParam { @Max(value = 100, message = "每页条数最大为100") private Integer pageSize = 10; + /** + * 关键字 + */ + private String keyword; + /** * 构建 MyBatis-Plus 分页对象 */ diff --git a/manager/src/main/java/org/jiayunet/mapper/JobMapper.java b/manager/src/main/java/org/jiayunet/mapper/JobMapper.java index f1d66d4..4d058f2 100644 --- a/manager/src/main/java/org/jiayunet/mapper/JobMapper.java +++ b/manager/src/main/java/org/jiayunet/mapper/JobMapper.java @@ -19,5 +19,5 @@ public interface JobMapper extends CommonMapper { /** * 分页查询岗位列表 */ - Page selectJobPage(Page page, @Param("jobIds") List jobIds, @Param("statusFilter") List statusFilter, @Param("regionCodes") List regionCodes, @Param("categoryIds") List categoryIds, @Param("industryIds") List industryIds, @Param("employmentType") Integer employmentType, @Param("excludeJobIds") List excludeJobIds, @Param("excludeCompanyIds") List excludeCompanyIds, @Param("excludeRegionCodes") List excludeRegionCodes, @Param("excludeIndustryIds") List excludeIndustryIds); + Page selectJobPage(Page page, @Param("jobIds") List jobIds, @Param("statusFilter") List statusFilter, @Param("keyword") String keyword, @Param("regionCodes") List regionCodes, @Param("categoryIds") List categoryIds, @Param("industryIds") List industryIds, @Param("employmentType") Integer employmentType, @Param("excludeJobIds") List excludeJobIds, @Param("excludeCompanyIds") List excludeCompanyIds, @Param("excludeRegionCodes") List excludeRegionCodes, @Param("excludeIndustryIds") List excludeIndustryIds); } diff --git a/manager/src/main/resources/mapper/JobMapper.xml b/manager/src/main/resources/mapper/JobMapper.xml index 197442b..774ddc0 100644 --- a/manager/src/main/resources/mapper/JobMapper.xml +++ b/manager/src/main/resources/mapper/JobMapper.xml @@ -60,6 +60,15 @@ #{id} + + + AND + ( + c.title like concat("%",#{keyword},"%") + or + c.name like concat("%",#{keyword},"%") + ) + AND j.id NOT IN