添加查询 关键字

This commit is contained in:
zk
2026-03-24 16:07:33 +08:00
parent 15dda22233
commit 929e9e4d72
4 changed files with 16 additions and 2 deletions
@@ -105,7 +105,7 @@ public class JobService {
List<Long> excludeIndustryIds = dislikes.stream().map(UserJobDislike::getIndustryId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
// 6. 执行分页查询
Page<JobListItemVo> page = jobMapper.selectJobPage(param.toPage(), param.getJobIds(),param.getStatusFilter(), expandedRegionCodes, expandedCategoryIds, expandedIndustryIds, param.getEmploymentType(), excludeJobIds, excludeCompanyIds, excludeRegionCodes, excludeIndustryIds);
Page<JobListItemVo> page = jobMapper.selectJobPage(param.toPage(), param.getJobIds(),param.getStatusFilter(), param.getKeyword(), expandedRegionCodes, expandedCategoryIds, expandedIndustryIds, param.getEmploymentType(), excludeJobIds, excludeCompanyIds, excludeRegionCodes, excludeIndustryIds);
// 7. 查询收藏状态
List<Long> jobIds = page.getRecords().stream().map(JobListItemVo::getId).collect(Collectors.toList());
@@ -23,6 +23,11 @@ public class PageParam {
@Max(value = 100, message = "每页条数最大为100")
private Integer pageSize = 10;
/**
* 关键字
*/
private String keyword;
/**
* 构建 MyBatis-Plus 分页对象
*/
@@ -19,5 +19,5 @@ public interface JobMapper extends CommonMapper<Job> {
/**
* 分页查询岗位列表
*/
Page<JobListItemVo> selectJobPage(Page<JobListItemVo> page, @Param("jobIds") List<Long> jobIds, @Param("statusFilter") List<Integer> statusFilter, @Param("regionCodes") List<String> regionCodes, @Param("categoryIds") List<Long> categoryIds, @Param("industryIds") List<Long> industryIds, @Param("employmentType") Integer employmentType, @Param("excludeJobIds") List<Long> excludeJobIds, @Param("excludeCompanyIds") List<Long> excludeCompanyIds, @Param("excludeRegionCodes") List<String> excludeRegionCodes, @Param("excludeIndustryIds") List<Long> excludeIndustryIds);
Page<JobListItemVo> selectJobPage(Page<JobListItemVo> page, @Param("jobIds") List<Long> jobIds, @Param("statusFilter") List<Integer> statusFilter, @Param("keyword") String keyword, @Param("regionCodes") List<String> regionCodes, @Param("categoryIds") List<Long> categoryIds, @Param("industryIds") List<Long> industryIds, @Param("employmentType") Integer employmentType, @Param("excludeJobIds") List<Long> excludeJobIds, @Param("excludeCompanyIds") List<Long> excludeCompanyIds, @Param("excludeRegionCodes") List<String> excludeRegionCodes, @Param("excludeIndustryIds") List<Long> excludeIndustryIds);
}
@@ -60,6 +60,15 @@
#{id}
</foreach>
</if>
<!-- 关键字 -->
<if test="keyword != null and keyword.length()>0">
AND
(
c.title like concat("%",#{keyword},"%")
or
c.name like concat("%",#{keyword},"%")
)
</if>
<!-- 排除不感兴趣的岗位 -->
<if test="excludeJobIds != null and excludeJobIds.size() > 0">
AND j.id NOT IN