feat: 完善跨域招聘会统计与时间范围查询
This commit is contained in:
@@ -91,6 +91,62 @@
|
||||
ORDER BY f.job_fair_start_time DESC NULLS LAST, f.job_fair_id DESC
|
||||
</select>
|
||||
|
||||
<!-- 线上招聘会时间范围汇总:企业和岗位均跨招聘会去重。 -->
|
||||
<select id="selectOnlineFairStatisticsAggregate"
|
||||
resultType="com.ruoyi.cms.domain.vo.FairStatisticsAggregate">
|
||||
WITH selected_fairs AS (
|
||||
SELECT job_fair_id
|
||||
FROM public_job_fair
|
||||
WHERE del_flag = '0'
|
||||
AND job_fair_type = '1'
|
||||
AND job_fair_start_time <![CDATA[ >= ]]> #{startTime}
|
||||
AND job_fair_start_time <![CDATA[ < ]]> #{endTime}
|
||||
),
|
||||
approved_companies AS (
|
||||
SELECT DISTINCT company_relation.company_id
|
||||
FROM public_job_fair_company company_relation
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.job_fair_id = company_relation.job_fair_id
|
||||
WHERE company_relation.del_flag = '0'
|
||||
AND coalesce(company_relation.review_status, '1') = '1'
|
||||
),
|
||||
unique_jobs AS (
|
||||
SELECT DISTINCT fair_job.job_id
|
||||
FROM public_job_fair_job fair_job
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.job_fair_id = fair_job.job_fair_id
|
||||
INNER JOIN job job_info
|
||||
ON job_info.job_id = fair_job.job_id
|
||||
AND job_info.del_flag = '0'
|
||||
WHERE fair_job.del_flag = '0'
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM public_job_fair_company company_relation
|
||||
WHERE company_relation.job_fair_id = fair_job.job_fair_id
|
||||
AND company_relation.company_id = fair_job.company_id
|
||||
AND company_relation.del_flag = '0'
|
||||
AND coalesce(company_relation.review_status, '1') = '1'
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
(SELECT COUNT(company_id) FROM approved_companies) AS "companyCount",
|
||||
(SELECT COUNT(1) FROM unique_jobs) AS "jobCount",
|
||||
coalesce((
|
||||
SELECT SUM(CASE
|
||||
WHEN job_info.vacancies IS NULL OR job_info.vacancies <![CDATA[ <= ]]> 0 THEN 1
|
||||
ELSE job_info.vacancies
|
||||
END)
|
||||
FROM unique_jobs
|
||||
INNER JOIN job job_info ON job_info.job_id = unique_jobs.job_id
|
||||
), 0) AS "demandCount",
|
||||
coalesce((
|
||||
SELECT COUNT(DISTINCT apply_record.job_id)
|
||||
FROM job_apply apply_record
|
||||
INNER JOIN unique_jobs ON unique_jobs.job_id = apply_record.job_id
|
||||
WHERE apply_record.del_flag = '0'
|
||||
), 0) AS "interactionCount"
|
||||
</select>
|
||||
|
||||
<!--
|
||||
户外招聘会没有投递入口,因此 interactionCount 只汇总签到人员记录。
|
||||
户外岗位也使用 job.vacancies;为空或非正数时按“若干=1 人”处理。
|
||||
@@ -144,4 +200,50 @@
|
||||
</choose>
|
||||
ORDER BY f.hold_time DESC NULLS LAST, f.id DESC
|
||||
</select>
|
||||
|
||||
<!-- 户外招聘会时间范围汇总:企业和岗位均跨招聘会去重。 -->
|
||||
<select id="selectOutdoorFairStatisticsAggregate"
|
||||
resultType="com.ruoyi.cms.domain.vo.FairStatisticsAggregate">
|
||||
WITH selected_fairs AS (
|
||||
SELECT id
|
||||
FROM cms_outdoor_fair
|
||||
WHERE coalesce(del_flag, '0') = '0'
|
||||
AND hold_time <![CDATA[ >= ]]> #{startTime}
|
||||
AND hold_time <![CDATA[ < ]]> #{endTime}
|
||||
),
|
||||
unique_jobs AS (
|
||||
SELECT DISTINCT fair_job.job_id
|
||||
FROM cms_outdoor_fair_job fair_job
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.id = fair_job.fair_id
|
||||
INNER JOIN job job_info
|
||||
ON job_info.job_id = fair_job.job_id
|
||||
AND job_info.del_flag = '0'
|
||||
WHERE coalesce(fair_job.del_flag, '0') = '0'
|
||||
)
|
||||
SELECT
|
||||
coalesce((
|
||||
SELECT COUNT(DISTINCT company_relation.company_id)
|
||||
FROM fair_company company_relation
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.id = company_relation.job_fair_id
|
||||
WHERE coalesce(company_relation.del_flag, '0') = '0'
|
||||
), 0) AS "companyCount",
|
||||
(SELECT COUNT(1) FROM unique_jobs) AS "jobCount",
|
||||
coalesce((
|
||||
SELECT SUM(CASE
|
||||
WHEN job_info.vacancies IS NULL OR job_info.vacancies <![CDATA[ <= ]]> 0 THEN 1
|
||||
ELSE job_info.vacancies
|
||||
END)
|
||||
FROM unique_jobs
|
||||
INNER JOIN job job_info ON job_info.job_id = unique_jobs.job_id
|
||||
), 0) AS "demandCount",
|
||||
coalesce((
|
||||
SELECT COUNT(1)
|
||||
FROM cms_outdoor_fair_attendee attendee
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.id = attendee.fair_id
|
||||
WHERE coalesce(attendee.del_flag, '0') = '0'
|
||||
), 0) AS "interactionCount"
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="query.jobFairTitle != null and query.jobFairTitle != ''">
|
||||
and job_fair_title like concat('%', cast(#{query.jobFairTitle, jdbcType=VARCHAR} as varchar), '%')
|
||||
and job_fair_title like concat('%', cast(#{query.jobFairTitle, jdbcType=VARCHAR} as varchar), '%') escape '\'
|
||||
</if>
|
||||
<if test="query.jobFairType != null and query.jobFairType != ''">
|
||||
and job_fair_type = #{query.jobFairType}
|
||||
@@ -181,7 +181,8 @@
|
||||
</select>
|
||||
|
||||
<select id="selectCrossDomainJobs" resultType="com.ruoyi.cms.domain.rc.CrossDomainJobVO">
|
||||
select j.job_id as jobId, j.job_title as jobTitle, j.min_salary as minSalary, j.max_salary as maxSalary,
|
||||
select j.job_id as jobId, j.job_title as jobTitle, j."view" as view,
|
||||
j.min_salary as minSalary, j.max_salary as maxSalary,
|
||||
j.education, j.experience, j.vacancies, j.posting_date as postingDate,
|
||||
j.company_id as companyId, j.company_name as companyName,
|
||||
c.industry, c.scale,
|
||||
@@ -190,13 +191,85 @@
|
||||
inner join public_job_fair_job pfj on pfj.job_fair_id = pf.job_fair_id and pfj.del_flag = '0'
|
||||
inner join job j on j.job_id = pfj.job_id and j.del_flag = '0'
|
||||
left join company c on c.company_id = pfj.company_id
|
||||
where pf.is_cross_domain = 'y' and pf.del_flag = '0'
|
||||
where upper(coalesce(pf.is_cross_domain, 'N')) = 'Y'
|
||||
and pf.job_fair_type = '1'
|
||||
and pf.del_flag = '0'
|
||||
and exists (
|
||||
select 1
|
||||
from public_job_fair_company company_relation
|
||||
where company_relation.job_fair_id = pfj.job_fair_id
|
||||
and company_relation.company_id = pfj.company_id
|
||||
and company_relation.del_flag = '0'
|
||||
and coalesce(company_relation.review_status, '1') = '1'
|
||||
)
|
||||
<if test="startDate != null">
|
||||
and pf.job_fair_start_time <![CDATA[ >= ]]> #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and pf.job_fair_start_time <![CDATA[ < ]]> #{endDate}
|
||||
</if>
|
||||
<if test="cityNames != null and cityNames != ''">
|
||||
and string_to_array(pf.cross_domain_cities, ',') && string_to_array(#{cityNames}, ',')
|
||||
</if>
|
||||
order by j.posting_date desc nulls last, j.job_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectCrossDomainStatistics"
|
||||
resultType="com.ruoyi.cms.domain.rc.CrossDomainStatisticsVO">
|
||||
WITH selected_fairs AS (
|
||||
SELECT job_fair_id
|
||||
FROM public_job_fair
|
||||
WHERE upper(coalesce(is_cross_domain, 'N')) = 'Y'
|
||||
AND job_fair_type = '1'
|
||||
AND del_flag = '0'
|
||||
AND job_fair_start_time <![CDATA[ >= ]]> #{startDate}
|
||||
AND job_fair_start_time <![CDATA[ < ]]> #{endDate}
|
||||
),
|
||||
approved_companies AS (
|
||||
SELECT DISTINCT company_relation.company_id
|
||||
FROM public_job_fair_company company_relation
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.job_fair_id = company_relation.job_fair_id
|
||||
WHERE company_relation.del_flag = '0'
|
||||
AND coalesce(company_relation.review_status, '1') = '1'
|
||||
),
|
||||
unique_jobs AS (
|
||||
SELECT DISTINCT fair_job.job_id
|
||||
FROM public_job_fair_job fair_job
|
||||
INNER JOIN selected_fairs selected_fair
|
||||
ON selected_fair.job_fair_id = fair_job.job_fair_id
|
||||
INNER JOIN job job_info
|
||||
ON job_info.job_id = fair_job.job_id
|
||||
AND job_info.del_flag = '0'
|
||||
WHERE fair_job.del_flag = '0'
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM public_job_fair_company company_relation
|
||||
WHERE company_relation.job_fair_id = fair_job.job_fair_id
|
||||
AND company_relation.company_id = fair_job.company_id
|
||||
AND company_relation.del_flag = '0'
|
||||
AND coalesce(company_relation.review_status, '1') = '1'
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
(SELECT COUNT(1) FROM selected_fairs) AS "fairCount",
|
||||
(SELECT COUNT(company_id) FROM approved_companies) AS "companyCount",
|
||||
(SELECT COUNT(1) FROM unique_jobs) AS "jobCount",
|
||||
coalesce((
|
||||
SELECT SUM(CASE
|
||||
WHEN job_info.vacancies IS NULL OR job_info.vacancies <![CDATA[ <= ]]> 0 THEN 1
|
||||
ELSE job_info.vacancies
|
||||
END)
|
||||
FROM unique_jobs
|
||||
INNER JOIN job job_info ON job_info.job_id = unique_jobs.job_id
|
||||
), 0) AS "demandCount",
|
||||
coalesce((
|
||||
SELECT SUM(coalesce(job_info."view", 0))
|
||||
FROM unique_jobs
|
||||
INNER JOIN job job_info ON job_info.job_id = unique_jobs.job_id
|
||||
), 0) AS "viewCount"
|
||||
</select>
|
||||
|
||||
<select id="checkUserSignUp" resultType="java.lang.Integer">
|
||||
select count(1) from rc_job_fair_sign_up
|
||||
where job_fair_id = #{jobFairId}::bigint and user_id = #{personId} and del_flag = '0' and status = '0'
|
||||
|
||||
Reference in New Issue
Block a user