Merge branch 'main' of ssh://124.243.245.42:2222/zkr/shz-backend

This commit is contained in:
2026-06-27 22:45:00 +08:00
39 changed files with 229 additions and 51 deletions

View File

@@ -1,7 +1,5 @@
package com.ruoyi.cms.controller.app;
import com.ruoyi.cms.domain.JobApply;
import com.ruoyi.cms.service.impl.JobApplyServiceImpl;
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
import com.ruoyi.cms.service.UserWorkExperiencesService;
import com.ruoyi.common.core.controller.BaseController;
@@ -20,8 +18,8 @@ import java.util.List;
/**
* 用户工作经历表
*
* @author
* @email
* @author
* @email
* @date 2025-10-10 16:26:26
*/
@RestController
@@ -32,9 +30,6 @@ public class AppUserWorkExperiencesController extends BaseController {
@Autowired
private UserWorkExperiencesService userWorkExperiencesService;
@Autowired
JobApplyServiceImpl jobApplyService;
/**
* 列表
*/
@@ -44,14 +39,6 @@ public class AppUserWorkExperiencesController extends BaseController {
if(userWorkExperiences.getUserId()==null){
userWorkExperiences.setUserId(SiteSecurityUtils.getUserId());
}
//已读简历
if (userWorkExperiences.getJobId() != null) {
JobApply jobApply = jobApplyService.selectByJobIdAndUserId(userWorkExperiences.getJobId(), userWorkExperiences.getUserId());
if (jobApply != null) {
jobApply.setIsView("1");
jobApplyService.updateJobApply(jobApply);
}
}
startPage();
List<UserWorkExperiences> list=userWorkExperiencesService.getWorkExperiencesList(userWorkExperiences);
return getDataTable(list);

View File

@@ -84,6 +84,13 @@ public class CmsJobController extends BaseController
return getDataTable(list);
}
@ApiOperation("根据岗位ID获取推荐的人")
@GetMapping("/getRecommendByJobId")
public AjaxResult getRecommendByJobId(@RequestParam("jobId") Long jobId)
{
return AjaxResult.success(jobService.getRecommendByJobId(jobId));
}
/**
* 获取岗位详细信息
*/
@@ -373,4 +380,6 @@ public class CmsJobController extends BaseController
}
return success(jobService.updateReviewStatus(jobId, reviewStatus));
}
}

View File

@@ -1,6 +1,8 @@
package com.ruoyi.cms.controller.cms;
import com.ruoyi.cms.domain.JobApply;
import com.ruoyi.cms.service.IAppUserService;
import com.ruoyi.cms.service.impl.JobApplyServiceImpl;
import com.ruoyi.cms.util.RoleUtils;
import com.ruoyi.common.core.domain.entity.AppUser;
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
@@ -33,9 +35,13 @@ public class UserWorkExperiencesController extends BaseController {
@Autowired
private UserWorkExperiencesService userWorkExperiencesService;
@Autowired
private IAppUserService appUserService;
@Autowired
private JobApplyServiceImpl jobApplyService;
/**
* 列表
*/
@@ -43,6 +49,14 @@ public class UserWorkExperiencesController extends BaseController {
@PreAuthorize("@ss.hasPermi('cms:userworkexperiences:list')")
@GetMapping("/list")
public TableDataInfo list(UserWorkExperiences userWorkExperiences){
//已读简历
if (userWorkExperiences.getJobId() != null) {
JobApply jobApply = jobApplyService.selectByJobIdAndUserId(userWorkExperiences.getJobId(), userWorkExperiences.getUserId());
if (jobApply != null) {
jobApply.setIsView("1");
jobApplyService.updateJobApply(jobApply);
}
}
startPage();
List<UserWorkExperiences> list=userWorkExperiencesService.getWorkExperiencesList(userWorkExperiences);
return getDataTable(list);

View File

@@ -49,7 +49,6 @@ public class CompanyJobLive extends BaseEntity
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty("公司ID")
private Long companyId;

View File

@@ -82,6 +82,9 @@ public class ESJobDocument
@ApiModelProperty("是否火")
private Integer isHot;
@ApiModelProperty("是否急聘")
private Integer isUrgent;
@ApiModelProperty("申请次数")
private Integer applyNum;
@@ -156,4 +159,7 @@ public class ESJobDocument
@ApiModelProperty("公司信息")
@IndexField(fieldType = FieldType.TEXT)
private String companyVoJson;
@ApiModelProperty("是否发布 0未发布 1发布")
private Integer isPublish;
}

View File

@@ -103,6 +103,9 @@ public class Job extends BaseEntity
@ApiModelProperty("是否火")
private Integer isHot;
@ApiModelProperty("是否急聘 0否 1是")
private Integer isUrgent;
@ApiModelProperty("申请次数")
@JsonIgnore
private Integer applyNum;

View File

@@ -1,29 +1,28 @@
package com.ruoyi.cms.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.ruoyi.cms.domain.query.JobSearch;
import com.ruoyi.common.core.domain.entity.AppUser;
import com.ruoyi.common.core.domain.entity.Company;
import com.ruoyi.cms.domain.Job;
import com.ruoyi.cms.domain.RowWork;
import com.ruoyi.cms.domain.VectorJob;
import com.ruoyi.cms.domain.query.ESJobSearch;
import com.ruoyi.cms.domain.query.JobSearch;
import com.ruoyi.common.core.domain.entity.AppUser;
import com.ruoyi.common.core.domain.entity.Company;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 岗位Mapper接口
*
* @author lishundong
* @date 2024-09-03
*/
public interface JobMapper extends BaseMapper<Job>
{
public interface JobMapper extends BaseMapper<Job> {
/**
* 查询岗位列表
*
*
* @param job 岗位
* @return 岗位集合
*/
@@ -40,7 +39,6 @@ public interface JobMapper extends BaseMapper<Job>
List<Company> selectRowCompany();
void batchInsert(List<Job> jobBatch);
List<Job> selectAllJob(Map<String, Object> params);
@@ -56,7 +54,8 @@ public interface JobMapper extends BaseMapper<Job>
List<AppUser> selectApplyJobUserList(Long jobId);
/**
*查询单条岗位信息
* 查询单条岗位信息
*
* @param jobId
* @return
*/
@@ -67,6 +66,7 @@ public interface JobMapper extends BaseMapper<Job>
Long updateReviewStatus(@Param("jobId") Long jobId, @Param("reviewStatus") String reviewStatus);
//删除岗位
@InterceptorIgnore(blockAttack = "true")
Long delRowWork();
List<AppUser> getRecommendByJobId(@Param("jobId") Long jobId);
}

View File

@@ -114,4 +114,6 @@ public interface IJobService
public Integer getTotals(Job job);
Long updateReviewStatus(Long jobId, String reviewStatus);
List<AppUser> getRecommendByJobId(Long jobId);
}

View File

@@ -64,6 +64,6 @@ public class CompanyJobLiveServiceImpl implements ICompanyJobLiveService {
LoginUser logUser = SecurityUtils.getLoginUser();
SysUser sysUser = logUser.getUser();
Company company = companyService.queryCodeCompany(sysUser.getIdCard());
return company.getCompanyId();
return company != null ? company.getCompanyId() : null;
}
}

View File

@@ -72,7 +72,7 @@ public class ESJobSearchImpl implements IESJobSearchService
/**
* 项目启动时,初始化索引及数据
*/
// @PostConstruct
@PostConstruct
public void init()
{
boolean isLockAcquired = false;
@@ -346,6 +346,13 @@ public class ESJobSearchImpl implements IESJobSearchService
if(!StringUtil.isEmptyOrNull(appUser.getSalaryMin())){
newSearch.setMinSalary(Long.valueOf(appUser.getSalaryMin()));
}
// 请求参数覆盖用户资料中的薪资偏好
if(Objects.nonNull(esJobSearch.getSalaryMin()) || Objects.nonNull(esJobSearch.getMinSalary())){
newSearch.setMinSalary(Objects.nonNull(esJobSearch.getSalaryMin()) ? esJobSearch.getSalaryMin() : esJobSearch.getMinSalary());
}
if(Objects.nonNull(esJobSearch.getSalaryMax()) || Objects.nonNull(esJobSearch.getMaxSalary())){
newSearch.setMaxSalary(Objects.nonNull(esJobSearch.getSalaryMax()) ? esJobSearch.getSalaryMax() : esJobSearch.getMaxSalary());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobType())){
newSearch.setJobType(esJobSearch.getJobType());
}
@@ -531,14 +538,14 @@ public class ESJobSearchImpl implements IESJobSearchService
// 岗位薪资范围与用户期望薪资范围有交集
// 条件:岗位最小薪资 <= 用户最大薪资 AND 岗位最大薪资 >= 用户最小薪资
if(Objects.nonNull(userMinSalary) && Objects.nonNull(userMaxSalary)){
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,userMaxSalary)
.ge(ESJobDocument::getMinSalary,userMinSalary));
wrapper.and(x->x.le(ESJobDocument::getMinSalary,userMaxSalary)
.ge(ESJobDocument::getMaxSalary,userMinSalary));
} else if(Objects.nonNull(userMinSalary)){
// 只有最小薪资:岗位最大薪资 >= 用户最小薪资
wrapper.and(x->x.ge(ESJobDocument::getMinSalary,userMinSalary));
wrapper.and(x->x.ge(ESJobDocument::getMaxSalary,userMinSalary));
} else if(Objects.nonNull(userMaxSalary)){
// 只有最大薪资:岗位最小薪资 <= 用户最大薪资
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,userMaxSalary));
wrapper.and(x->x.le(ESJobDocument::getMinSalary,userMaxSalary));
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience());
@@ -891,8 +898,16 @@ public class ESJobSearchImpl implements IESJobSearchService
ESJobSearch newSearch = new ESJobSearch();
BeanUtils.copyProperties(esJobSearch,newSearch);
//查询
if(appUser!=null){
// 判断是否为用户主动搜索(有明确的搜索条件),而非纯推荐场景
boolean isExplicitSearch = !StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())
|| !StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())
|| !StringUtil.isEmptyOrNull(esJobSearch.getCompanyName())
|| !StringUtil.isEmptyOrNull(esJobSearch.getDescription());
// 用户资料偏好仅在"纯推荐"场景下作为个性化过滤条件;
// 用户主动搜索时不应被资料中的薪资/学历/经验/区域等偏好缩小结果范围
if(appUser != null && !isExplicitSearch){
if(!ListUtil.isEmptyOrNull(appUser.getJobTitle())){
List<String> jobTitle = appUser.getJobTitle();
newSearch.setJobTitle(String.join(",", jobTitle));
@@ -906,9 +921,6 @@ public class ESJobSearchImpl implements IESJobSearchService
if(!StringUtil.isEmptyOrNull(appUser.getWorkExperience())){
newSearch.setExperience(appUser.getWorkExperience());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
newSearch.setExperience(esJobSearch.getExperience());
}
if(!StringUtil.isEmptyOrNull(appUser.getSalaryMax())){
newSearch.setMaxSalary(Long.valueOf(appUser.getSalaryMax()));
}
@@ -917,12 +929,22 @@ public class ESJobSearchImpl implements IESJobSearchService
}
}
// 请求参数始终优先于用户资料偏好
if(Objects.nonNull(esJobSearch.getSalaryMin()) || Objects.nonNull(esJobSearch.getMinSalary())){
newSearch.setMinSalary(Objects.nonNull(esJobSearch.getSalaryMin()) ? esJobSearch.getSalaryMin() : esJobSearch.getMinSalary());
}
if(Objects.nonNull(esJobSearch.getSalaryMax()) || Objects.nonNull(esJobSearch.getMaxSalary())){
newSearch.setMaxSalary(Objects.nonNull(esJobSearch.getSalaryMax()) ? esJobSearch.getSalaryMax() : esJobSearch.getMaxSalary());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getArea())){
newSearch.setArea(esJobSearch.getArea());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getEducation())){
newSearch.setEducation(esJobSearch.getEducation());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
newSearch.setExperience(esJobSearch.getExperience());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())){
newSearch.setJobTitle(esJobSearch.getJobTitle());
}

View File

@@ -153,7 +153,11 @@ public class JobApplyServiceImpl extends ServiceImpl<JobApplyMapper,JobApply> im
@Override
public List<Job> selectJobApplyListJob(JobApply jobApply) {
return jobApplyMapper.selectJobApplyListJob(jobApply);
List<Job> jobList = jobApplyMapper.selectJobApplyListJob(jobApply);
jobList.forEach(job -> {
job.setIsApply(1);
});
return jobList;
}
@Override

View File

@@ -29,20 +29,26 @@ import com.ruoyi.common.utils.SiteSecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.dromara.easyes.core.biz.EsPageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Connection;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -96,6 +102,40 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
@Autowired
private NoticeMapper noticeMapper;
@Autowired
private DataSource dataSource;
@Autowired
private UserWorkExperiencesMapper userWorkExperiencesMapper;
@Autowired
private AppSkillMapper appSkillMapper;
/**
* 应用启动后自动迁移:添加 is_urgent 列(幂等)
*/
@EventListener(ApplicationReadyEvent.class)
public void migrateIsUrgentColumn() {
try (Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement()) {
String checkSql = "SELECT COUNT(*) FROM information_schema.columns WHERE table_name='job' AND column_name='is_urgent'";
java.sql.ResultSet rs = stmt.executeQuery(checkSql);
boolean exists = false;
if (rs.next()) {
exists = rs.getInt(1) > 0;
}
rs.close();
if (!exists) {
stmt.execute("ALTER TABLE job ADD COLUMN is_urgent CHAR(1) DEFAULT '0'");
logger.info("急聘功能迁移: 成功添加 job.is_urgent 列");
} else {
logger.info("急聘功能迁移: job.is_urgent 列已存在,跳过");
}
} catch (Exception e) {
logger.error("急聘功能迁移失败: {}", e.getMessage());
}
}
/**
* 更新工作地址的经纬度信息
*/
@@ -1227,4 +1267,23 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
public Long updateReviewStatus(Long jobId, String reviewStatus) {
return jobMapper.updateReviewStatus(jobId, reviewStatus);
}
@Override
public List<AppUser> getRecommendByJobId(Long jobId) {
List<AppUser> list = jobMapper.getRecommendByJobId(jobId);
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(appUser -> {
UserWorkExperiences workExperiences = new UserWorkExperiences();
workExperiences.setUserId(appUser.getUserId());
List<UserWorkExperiences> experiences = userWorkExperiencesMapper.getWorkExperiencesList(workExperiences);
appUser.setExperiencesList(experiences);
AppSkill skill = new AppSkill();
skill.setUserId(appUser.getUserId());
List<AppSkill> skillList = appSkillMapper.getList(skill);
appUser.setAppSkillsList(skillList);
});
}
return list;
}
}

View File

@@ -141,13 +141,24 @@
and latest_ii.job_id = a.job_id
and latest_ii.del_flag = '0'
where a.del_flag='0'
<if test="company != null and company.jobTitle != null and company.jobTitle != ''"> and b.job_title like concat('%', cast(#{company.jobTitle, jdbcType=VARCHAR} as varchar), '%')</if>
<if test="company != null and company.education != null and company.education != ''"> and b.education = #{company.education}</if>
<if test="company != null and company.experience != null and company.experience != ''"> and b.experience = #{company.experience}</if>
<if test="company != null and company.companyName != null and company.companyName != ''"> and b.company_name like concat('%', cast(#{company.companyName, jdbcType=VARCHAR} as varchar), '%')</if>
<if test="company != null and company.companyId != null "> and b.company_id = #{company.companyId}</if>
<if test="company != null and company.code != null "> and l.code =#{company.code}</if>
<if test="name != null and name != '' "> and b.job_title like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 求职者用户名搜索 -->
<if test="name != null and name != ''"> and e.name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 手机号搜索 -->
<if test="phone != null and phone != ''"> and e.phone like concat('%', cast(#{phone, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 学历筛选 -->
<if test="education != null and education != ''"> and e.education = #{education}</if>
<!-- 性别筛选 -->
<if test="sex != null and sex != ''"> and e.sex = #{sex}</if>
<!-- 区域筛选 -->
<if test="area != null and area != ''"> and e.area = #{area}</if>
<!-- 政治面貌筛选 -->
<if test="politicalAffiliation != null and politicalAffiliation != ''"> and e.political_affiliation = #{politicalAffiliation}</if>
<!-- 身份证搜索 -->
<if test="idCard != null and idCard != ''"> and e.id_card like concat('%', cast(#{idCard, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 出生日期筛选 -->
<if test="birthDate != null and birthDate != ''"> and e.birth_date = #{birthDate}</if>
<!-- 职位名称搜索 -->
<if test="jobName != null and jobName != ''"> and b.job_title like concat('%', cast(#{jobName, jdbcType=VARCHAR} as varchar), '%')</if>
</select>
<select id="selectJobApplyListJob" parameterType="JobApply" resultType="com.ruoyi.cms.domain.Job">

View File

@@ -26,6 +26,7 @@
<result property="view" column="view" />
<result property="companyId" column="company_id" />
<result property="isHot" column="is_hot" />
<result property="isUrgent" column="is_urgent" />
<result property="dataSource" column="data_source" />
<result property="jobUrl" column="job_url" />
<result property="rowId" column="row_id" />
@@ -61,6 +62,7 @@
<result property="view" column="view" />
<result property="companyId" column="company_id" />
<result property="isHot" column="is_hot" />
<result property="isUrgent" column="is_urgent" />
<result property="applyNum" column="apply_num" />
<result property="dataSource" column="data_source" />
<result property="jobLocationAreaCode" column="job_location_area_code" />
@@ -99,7 +101,7 @@
</resultMap>
<sql id="selectJobVo">
select job_id, job_title, min_salary, max_salary, education, experience, company_name, job_location, posting_date, vacancies, del_flag, create_by, create_time, update_by, update_time, remark, latitude, longitude, "view", company_id , is_hot ,apply_num,is_publish, description,job_location_area_code,data_source,job_url,job_category,is_explain,explain_url,cover,job_type,job_address, review_status from job
select job_id, job_title, min_salary, max_salary, education, experience, company_name, job_location, posting_date, vacancies, del_flag, create_by, create_time, update_by, update_time, remark, latitude, longitude, "view", company_id , is_hot ,is_urgent,apply_num,is_publish, description,job_location_area_code,data_source,job_url,job_category,is_explain,explain_url,cover,job_type,job_address, review_status from job
</sql>
<insert id="insertBatchRowWork">
INSERT INTO row_work (
@@ -128,7 +130,7 @@
INSERT INTO job (
job_title, min_salary, max_salary, education, experience, company_name, job_location,
job_location_area_code, posting_date, vacancies, latitude, longitude, "view", company_id,
is_hot, apply_num, description, is_publish, data_source, job_url, remark, del_flag,
is_hot, is_urgent, apply_num, description, is_publish, data_source, job_url, remark, del_flag,
create_by, create_time, row_id, job_category,job_type,job_address
) VALUES
<foreach collection="list" item="job" separator=",">
@@ -136,7 +138,7 @@
#{job.jobTitle}, #{job.minSalary}, #{job.maxSalary}, #{job.education}, #{job.experience},
#{job.companyName}, #{job.jobLocation}, #{job.jobLocationAreaCode}, #{job.postingDate},
#{job.vacancies}, #{job.latitude}, #{job.longitude}, #{job.view}, #{job.companyId},
#{job.isHot}, #{job.applyNum}, #{job.description}, #{job.isPublish}, #{job.dataSource},
#{job.isHot}, #{job.isUrgent}, #{job.applyNum}, #{job.description}, #{job.isPublish}, #{job.dataSource},
#{job.jobUrl}, #{job.remark}, #{job.delFlag}, #{job.createBy}, #{job.createTime},
#{job.rowId}, #{job.jobCategory},#{job.jobType},#{job.jobAddress}
)
@@ -365,4 +367,49 @@
<delete id="delRowWork">
delete from row_work
</delete>
<select id="getRecommendByJobId" resultType="com.ruoyi.common.core.domain.entity.AppUser">
SELECT
*,
CASE match_level
WHEN 1 THEN '一级: 学历+区域+薪资+岗位类别'
WHEN 2 THEN '二级: 区域+薪资+岗位类别'
WHEN 3 THEN '三级: 薪资+岗位类别'
WHEN 4 THEN '四级: 仅岗位类别'
WHEN 5 THEN '五级: 无满足条件'
END AS match_level_desc
FROM (
SELECT
*,
ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY match_level asc) AS best_rn
FROM (
SELECT
r.*,
CASE
WHEN CAST(j.job_id AS TEXT) = ANY(string_to_array(r.job_title_id, ','))
AND ((CAST(r.salary_min AS INTEGER) &lt;= p.max_salary AND CAST(r.salary_max AS INTEGER) >= p.min_salary) OR p.max_salary IS NULL)
AND (CAST(r.area AS INTEGER) = CAST(p.job_location_area_code AS INTEGER) OR p.job_location_area_code IS NULL)
AND (CAST(r.education AS INTEGER) >=CAST(p.education AS INTEGER) OR p.education IS NULL OR p.education = '-1')
THEN 1
WHEN CAST(j.job_id AS TEXT) = ANY(string_to_array(r.job_title_id, ','))
AND ((CAST(r.salary_min AS INTEGER) &lt;= p.max_salary AND CAST(r.salary_max AS INTEGER) >= p.min_salary) OR p.max_salary IS NULL)
AND (CAST(r.area AS INTEGER) = CAST(p.job_location_area_code AS INTEGER) OR p.job_location_area_code IS NULL)
THEN 2
WHEN CAST(j.job_id AS TEXT) = ANY(string_to_array(r.job_title_id, ','))
AND ((CAST(r.salary_min AS INTEGER) &lt;= p.max_salary AND CAST(r.salary_max AS INTEGER) >= p.min_salary) OR p.max_salary IS NULL)
THEN 3
WHEN (CAST(j.job_id AS TEXT) = ANY(string_to_array(r.job_title_id, ',')) OR p.job_category IS NULL)
THEN 4
ELSE 5
END AS match_level
FROM shz.job p
JOIN shz.app_user r ON r.del_flag = '0'
JOIN shz.job_title j ON j.job_name = p.job_category
WHERE p.job_id = #{jobId}
) c
) t
WHERE best_rn = 1
ORDER BY match_level ASC, login_date DESC
LIMIT (SELECT vacancies FROM shz.job WHERE job_id = #{jobId})
</select>
</mapper>