添加热门城市 行业 地区
This commit is contained in:
@@ -8,6 +8,9 @@ import org.jiayunet.pojo.dto.job.JobDetailDto;
|
||||
import org.jiayunet.pojo.dto.job.JobDto;
|
||||
import org.jiayunet.pojo.dto.job.JobAgentRecommendDto;
|
||||
import org.jiayunet.pojo.param.job.*;
|
||||
import org.jiayunet.pojo.vo.HotCityVo;
|
||||
import org.jiayunet.pojo.vo.HotIndustryVo;
|
||||
import org.jiayunet.pojo.vo.HotJobCategoryVo;
|
||||
import org.jiayunet.pojo.vo.JobApplyCountVo;
|
||||
import java.util.List;
|
||||
import org.jiayunet.pojo.vo.JobFavoriteCountVo;
|
||||
@@ -64,6 +67,39 @@ public class JobController {
|
||||
return jobService.countJobs(param, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位热门行业
|
||||
* <p>按上架岗位数量倒序返回二级行业,接口允许不登录访问</p>
|
||||
*
|
||||
* @param limit 返回条数,默认10
|
||||
*/
|
||||
@GetMapping("/industry/hot")
|
||||
public List<HotIndustryVo> listHotIndustries(@RequestParam(required = false, defaultValue = "10") Integer limit) {
|
||||
return jobService.listHotIndustries(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门岗位类型
|
||||
* <p>按上架岗位数量倒序返回二级岗位类型,接口允许不登录访问</p>
|
||||
*
|
||||
* @param limit 返回条数,默认10
|
||||
*/
|
||||
@GetMapping("/category/hot")
|
||||
public List<HotJobCategoryVo> listHotJobCategories(@RequestParam(required = false, defaultValue = "10") Integer limit) {
|
||||
return jobService.listHotJobCategories(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门城市
|
||||
* <p>按上架岗位数量倒序返回城市,接口允许不登录访问</p>
|
||||
*
|
||||
* @param limit 返回条数,默认10
|
||||
*/
|
||||
@GetMapping("/city/hot")
|
||||
public List<HotCityVo> listHotCities(@RequestParam(required = false, defaultValue = "10") Integer limit) {
|
||||
return jobService.listHotCities(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位详情
|
||||
* <p>返回岗位完整信息、公司信息、匹配度、收藏状态</p>
|
||||
|
||||
@@ -22,6 +22,9 @@ import org.jiayunet.pojo.po.*;
|
||||
import org.jiayunet.tool.HttpTool;
|
||||
import org.jiayunet.exception.BusinessException;
|
||||
import org.jiayunet.exception.BusinessExpCodeEnum;
|
||||
import org.jiayunet.pojo.vo.HotCityVo;
|
||||
import org.jiayunet.pojo.vo.HotIndustryVo;
|
||||
import org.jiayunet.pojo.vo.HotJobCategoryVo;
|
||||
import org.jiayunet.pojo.vo.JobApplyCountVo;
|
||||
import org.jiayunet.pojo.vo.JobFavoriteCountVo;
|
||||
import org.jiayunet.pojo.vo.JobListItemVo;
|
||||
@@ -204,6 +207,33 @@ public class JobService {
|
||||
return total == null ? 0L : total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门行业查询(二级行业)
|
||||
* <p>岗位关联公司、公司关联行业(bg_industry level=2),按上架岗位数量倒序取前 limit 个</p>
|
||||
* <p>只返回行业ID和名称,岗位数量仅用于排序不对外暴露</p>
|
||||
*/
|
||||
public List<HotIndustryVo> listHotIndustries(Integer limit) {
|
||||
return jobMapper.selectHotIndustries(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门岗位类型查询(二级岗位类型)
|
||||
* <p>bg_job.category_id 存三级叶子,SQL 内自关联上溯到二级后按二级分组,按上架岗位数量倒序取前 limit 个</p>
|
||||
* <p>只返回岗位类型ID和名称,岗位数量仅用于排序不对外暴露</p>
|
||||
*/
|
||||
public List<HotJobCategoryVo> listHotJobCategories(Integer limit) {
|
||||
return jobMapper.selectHotJobCategories(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门城市查询
|
||||
* <p>岗位关联公司、公司关联地区,按上架岗位数量倒序取前 limit 个</p>
|
||||
* <p>只返回地区编码和名称,岗位数量仅用于排序不对外暴露</p>
|
||||
*/
|
||||
public List<HotCityVo> listHotCities(Integer limit) {
|
||||
return jobMapper.selectHotCities(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩展地区编码(包含自身和所有子级)
|
||||
* <p>一次查询:code本身 + provinceCode匹配 + cityCode匹配</p>
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jiayunet.pojo.po.Job;
|
||||
import org.jiayunet.pojo.vo.HotCityVo;
|
||||
import org.jiayunet.pojo.vo.HotIndustryVo;
|
||||
import org.jiayunet.pojo.vo.HotJobCategoryVo;
|
||||
import org.jiayunet.pojo.vo.JobListItemVo;
|
||||
|
||||
import java.time.Instant;
|
||||
@@ -27,4 +30,22 @@ public interface JobMapper extends CommonMapper<Job> {
|
||||
* <p>过滤条件与 selectJobPage 共用同一段 SQL(jobPageWhere),保证列表与总数口径一致</p>
|
||||
*/
|
||||
Long countJobPage(@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, @Param("recruitCategory") Integer recruitCategory, @Param("companyTypes") List<String> companyTypes, @Param("companyId") Long companyId, @Param("educations") List<Integer> educations, @Param("publishStartTime") Instant publishStartTime, @Param("publishEndTime") Instant publishEndTime);
|
||||
|
||||
/**
|
||||
* 查询热门行业(二级行业)
|
||||
* <p>岗位关联公司、公司关联行业,按上架岗位数量倒序取前 limit 个</p>
|
||||
*/
|
||||
List<HotIndustryVo> selectHotIndustries(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 查询热门岗位类型(二级岗位类型)
|
||||
* <p>岗位类型表自关联,从三级叶子上溯到二级后分组,按上架岗位数量倒序取前 limit 个</p>
|
||||
*/
|
||||
List<HotJobCategoryVo> selectHotJobCategories(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 查询热门城市
|
||||
* <p>岗位关联公司、公司关联地区,按上架岗位数量倒序取前 limit 个</p>
|
||||
*/
|
||||
List<HotCityVo> selectHotCities(@Param("limit") Integer limit);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.jiayunet.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 热门城市VO
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Data
|
||||
public class HotCityVo {
|
||||
|
||||
/** 地区编码 */
|
||||
private String code;
|
||||
|
||||
/** 地区名称 */
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.jiayunet.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 热门行业VO(二级行业)
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Data
|
||||
public class HotIndustryVo {
|
||||
|
||||
/** 行业ID */
|
||||
private Long id;
|
||||
|
||||
/** 行业名称 */
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.jiayunet.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 热门岗位类型VO(二级岗位类型)
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Data
|
||||
public class HotJobCategoryVo {
|
||||
|
||||
/** 岗位类型ID */
|
||||
private Long id;
|
||||
|
||||
/** 岗位类型名称 */
|
||||
private String name;
|
||||
}
|
||||
@@ -188,4 +188,65 @@
|
||||
<include refid="jobPageWhere"/>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
热门行业查询(二级行业)
|
||||
岗位 → 公司 → 公司所属行业,按上架岗位数量倒序取前 limit 个
|
||||
-->
|
||||
<select id="selectHotIndustries" resultType="org.jiayunet.pojo.vo.HotIndustryVo">
|
||||
SELECT
|
||||
i.id,
|
||||
i.name
|
||||
FROM bg_job j
|
||||
INNER JOIN bg_company c ON j.company_id = c.id
|
||||
INNER JOIN bg_industry i ON c.industry_id = i.id
|
||||
WHERE j.status = 0
|
||||
AND c.status = 1
|
||||
AND i.level = 2
|
||||
GROUP BY i.id, i.name
|
||||
ORDER BY COUNT(j.id) DESC
|
||||
<if test="limit != null">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
热门岗位类型查询(二级岗位类型)
|
||||
bg_job.category_id 存三级叶子,自关联上溯到二级后按二级分组,按上架岗位数量倒序取前 limit 个
|
||||
-->
|
||||
<select id="selectHotJobCategories" resultType="org.jiayunet.pojo.vo.HotJobCategoryVo">
|
||||
SELECT
|
||||
cat2.id,
|
||||
cat2.name
|
||||
FROM bg_job j
|
||||
INNER JOIN bg_job_category cat3 ON j.category_id = cat3.id
|
||||
INNER JOIN bg_job_category cat2 ON cat3.parent_id = cat2.id
|
||||
WHERE j.status = 0
|
||||
AND cat2.level = 2
|
||||
GROUP BY cat2.id, cat2.name
|
||||
ORDER BY COUNT(j.id) DESC
|
||||
<if test="limit != null">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
热门城市查询
|
||||
岗位 → 公司 → 公司所在地区,按上架岗位数量倒序取前 limit 个
|
||||
-->
|
||||
<select id="selectHotCities" resultType="org.jiayunet.pojo.vo.HotCityVo">
|
||||
SELECT
|
||||
r.code,
|
||||
r.name
|
||||
FROM bg_job j
|
||||
INNER JOIN bg_company c ON j.company_id = c.id
|
||||
INNER JOIN bg_china_regions_code r ON c.region_code = r.code
|
||||
WHERE j.status = 0
|
||||
AND c.status = 1
|
||||
GROUP BY r.code, r.name
|
||||
ORDER BY COUNT(j.id) DESC
|
||||
<if test="limit != null">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user