添加岗位列表数量统计接口

This commit is contained in:
zk
2026-08-05 11:23:23 +08:00
parent 9ce99ab3d7
commit 243b1ffc5a
4 changed files with 114 additions and 31 deletions
@@ -21,4 +21,10 @@ public interface JobMapper extends CommonMapper<Job> {
* 分页查询岗位列表
*/
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, @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>过滤条件与 selectJobPage 共用同一段 SQLjobPageWhere),保证列表与总数口径一致</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);
}
+48 -31
View File
@@ -30,37 +30,11 @@
<result column="company_industry_id" property="companyIndustryId"/>
</resultMap>
<select id="selectJobPage" resultMap="JobListItemVoMap">
SELECT
j.id,
j.title,
j.salary,
j.education,
j.tags,
j.source_url,
j.required_industry_id,
j.min_experience,
j.required_major_ids,
j.major_sensitivity,
j.status,
j.expire_at,
j.pyname,
j.recruit_category,
c.id AS company_id,
c.name AS company_name,
c.short_name AS company_short_name,
c.company_type,
c.logo_url AS company_logo_url,
c.tags AS company_tags,
c.industry_id AS company_industry_id,
c.region_code,
r.name AS region_name,
cat.id AS category_id,
cat.name AS category_name
FROM bg_job j force index (`PRIMARY`)
INNER JOIN bg_company c ON j.company_id = c.id
INNER JOIN bg_china_regions_code r ON c.region_code = r.code
INNER JOIN bg_job_category cat ON j.category_id = cat.id
<!--
岗位查询过滤条件(selectJobPage 与 countJobPage 共用)
新增/修改筛选条件只需改这里,保证列表与总数口径一致
-->
<sql id="jobPageWhere">
WHERE c.status = 1
<!-- 岗位状态过滤 -->
<if test="statusFilter != null and statusFilter.size() > 0">
@@ -168,7 +142,50 @@
<if test="publishEndTime != null">
AND j.expire_at &lt;= #{publishEndTime}
</if>
</sql>
<select id="selectJobPage" resultMap="JobListItemVoMap">
SELECT
j.id,
j.title,
j.salary,
j.education,
j.tags,
j.source_url,
j.required_industry_id,
j.min_experience,
j.required_major_ids,
j.major_sensitivity,
j.status,
j.expire_at,
j.pyname,
j.recruit_category,
c.id AS company_id,
c.name AS company_name,
c.short_name AS company_short_name,
c.company_type,
c.logo_url AS company_logo_url,
c.tags AS company_tags,
c.industry_id AS company_industry_id,
c.region_code,
r.name AS region_name,
cat.id AS category_id,
cat.name AS category_name
FROM bg_job j force index (`PRIMARY`)
INNER JOIN bg_company c ON j.company_id = c.id
INNER JOIN bg_china_regions_code r ON c.region_code = r.code
INNER JOIN bg_job_category cat ON j.category_id = cat.id
<include refid="jobPageWhere"/>
ORDER BY j.id DESC
</select>
<select id="countJobPage" resultType="java.lang.Long">
SELECT COUNT(*)
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
INNER JOIN bg_job_category cat ON j.category_id = cat.id
<include refid="jobPageWhere"/>
</select>
</mapper>