添加功能
This commit is contained in:
@@ -12,6 +12,13 @@
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
|
||||
AND (ABE585 IS NULL OR ABE585 > #{endTime})
|
||||
</sql>
|
||||
@@ -29,6 +36,23 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryKindEmploymentCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.dto.EmploymentRegisterSqlDto">
|
||||
|
||||
SELECT
|
||||
COUNT(DISTINCT AAC044) AS totalCount,
|
||||
COUNT(DISTINCT CASE WHEN YCC035 = '1' THEN AAC044 END) AS totalTownEmploymentCount,
|
||||
COUNT(DISTINCT CASE WHEN YCC036 = '1' THEN AAC044 END) AS unEmploymentEmploymentCount,
|
||||
COUNT(DISTINCT CASE WHEN YAR02G = '1' THEN AAC044 END) AS employmentDifficultyEmploymentCount
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryStartupCompanyCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
@@ -359,4 +383,243 @@
|
||||
GROUP BY areaCode
|
||||
ORDER BY areaCode
|
||||
</select>
|
||||
|
||||
<select id="employmentTrendYear"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year - month_num + 1, 1, 1, 0, 0, 0) ) AS start_time,
|
||||
(make_timestamp(p.current_year - month_num + 1 , 12, 31, 23, 59, 59) ) AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 5) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN 1 = 1
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS employmentCount,
|
||||
COUNT(DISTINCT CASE WHEN YCC035 = '1'
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS townEmploymentCount,
|
||||
COUNT(DISTINCT AAC044 ) AS cityAverageEmploymentCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_employment_register
|
||||
ON
|
||||
ADC110 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
AND (ABE585 IS NULL OR ABE585 > #{endTime})
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS code,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS sort,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) || '年' AS "desc",
|
||||
COALESCE(employmentCount, 0) AS employmentCount,
|
||||
COALESCE(townEmploymentCount, 0) AS townEmploymentCount,
|
||||
COALESCE(cityAverageEmploymentCount, 0) AS cityAverageEmploymentCount
|
||||
FROM aggregated_data
|
||||
ORDER BY sort ;
|
||||
</select>
|
||||
|
||||
<select id="employmentTrendQuarter"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * 3 * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * 3 * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 4) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN 1 = 1
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS employmentCount,
|
||||
COUNT(DISTINCT CASE WHEN YCC035 = '1'
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS townEmploymentCount,
|
||||
COUNT(DISTINCT AAC044 ) AS cityAverageEmploymentCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_employment_register
|
||||
ON
|
||||
ADC110 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
AND (ABE585 IS NULL OR ABE585 > #{endTime})
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
'第' || month_num || '季度' AS "desc",
|
||||
COALESCE(employmentCount, 0) AS employmentCount,
|
||||
COALESCE(townEmploymentCount, 0) AS townEmploymentCount,
|
||||
COALESCE(cityAverageEmploymentCount, 0) AS cityAverageEmploymentCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
<select id="employmentTrendMonth"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 12) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN 1 = 1
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS employmentCount,
|
||||
COUNT(DISTINCT CASE WHEN YCC035 = '1'
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS townEmploymentCount,
|
||||
COUNT(DISTINCT AAC044 ) AS cityAverageEmploymentCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_employment_register
|
||||
ON
|
||||
ADC110 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
AND (ABE585 IS NULL OR ABE585 > #{endTime})
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
month_num || '月' AS "desc",
|
||||
COALESCE(employmentCount, 0) AS employmentCount,
|
||||
COALESCE(townEmploymentCount, 0) AS townEmploymentCount,
|
||||
COALESCE(cityAverageEmploymentCount, 0) AS cityAverageEmploymentCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryEmploymentCountByIndustry"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
SUBSTRING(AAB022 FROM 1 FOR 3) AS code
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="queryEmploymentCountByJobType"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
ACA112 AS code
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,310 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.cms.mapper.ThemeRecruitmentJobMapper">
|
||||
|
||||
<!--公共条件 -->
|
||||
<sql id="commonConditions">
|
||||
posting_date BETWEEN #{startTime} AND #{endTime}
|
||||
<if test="area != null and area != ''">
|
||||
AND job_location_area_code = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND industry LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
industry LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="queryMonitorIndustryCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COUNT(DISTINCT SUBSTRING(industry FROM 1 FOR 3))
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryMonitorCompanyCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COUNT(DISTINCT code)
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryEmploymentDemandCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COALESCE(SUM(vacancies), 0)
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="laborDemandTrendYear"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year - month_num + 1, 1, 1, 0, 0, 0) ) AS start_time,
|
||||
(make_timestamp(p.current_year - month_num + 1 , 12, 31, 23, 59, 59) ) AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 5) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COALESCE(SUM(vacancies), 0) AS laborDemandCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_recruitment_job
|
||||
ON
|
||||
posting_date BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND job_location_area_code = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND industry LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
industry LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS code,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS sort,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) || '年' AS "desc",
|
||||
COALESCE(laborDemandCount, 0) AS laborDemandCount
|
||||
FROM aggregated_data
|
||||
ORDER BY sort ;
|
||||
</select>
|
||||
|
||||
<select id="laborDemandTrendQuarter"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * 3 * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * 3 * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 4) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COALESCE(SUM(vacancies), 0) AS laborDemandCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_recruitment_job
|
||||
ON
|
||||
posting_date BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND job_location_area_code = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND industry LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
industry LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
'第' || month_num || '季度' AS "desc",
|
||||
COALESCE(laborDemandCount, 0) AS laborDemandCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
<select id="laborDemandTrendMonth"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 12) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COALESCE(SUM(vacancies), 0) AS laborDemandCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_recruitment_job
|
||||
ON
|
||||
posting_date BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND job_location_area_code = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND industry LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
industry LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
month_num || '月' AS "desc",
|
||||
COALESCE(laborDemandCount, 0) AS laborDemandCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
<select id="queryEmploymentDemandCountByIndustry"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COALESCE(SUM(vacancies), 0) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
vacancies,
|
||||
SUBSTRING(industry FROM 1 FOR 3) AS code
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
<select id="salaryLevel"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COALESCE(ROUND(AVG((salary)), 2), 0) AS amount,
|
||||
COALESCE(ROUND((PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY salary))::NUMERIC, 2), 0) AS anotherAmount
|
||||
FROM (
|
||||
SELECT
|
||||
industry AS code,
|
||||
(min_salary + max_salary)/2 AS salary
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryEmploymentDemandCountByJobType"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COALESCE(SUM(vacancies), 0) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
vacancies,
|
||||
job_category AS code
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
<select id="queryLaborGapCountByIndustry"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COALESCE(SUM(vacancies), 0) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
vacancies,
|
||||
SUBSTRING(industry FROM 1 FOR 3) AS code
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
<select id="heatmap"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.HeatmapVo">
|
||||
|
||||
SELECT
|
||||
areaCode,
|
||||
COUNT(DISTINCT code) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
code,
|
||||
job_location_area_code AS areaCode
|
||||
FROM theme_recruitment_job
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY areaCode
|
||||
ORDER BY areaCode
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,322 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.cms.mapper.ThemeUnemploymentRegisterMapper">
|
||||
|
||||
<!--公共条件 -->
|
||||
<sql id="commonConditions">
|
||||
|
||||
ADC210 BETWEEN #{startTime} AND #{endTime}
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
|
||||
AND (ABE586 IS NULL OR ABE586 > #{endTime})
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="queryUnemploymentCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COUNT(DISTINCT AAC044)
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="unemploymentTrendYear"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year - month_num + 1, 1, 1, 0, 0, 0) ) AS start_time,
|
||||
(make_timestamp(p.current_year - month_num + 1 , 12, 31, 23, 59, 59) ) AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 5) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN 1 = 1
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS unemploymentCount,
|
||||
COUNT(DISTINCT AAC044 ) AS cityAverageUnemploymentCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_unemployment_register
|
||||
ON
|
||||
ADC210 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
AND (ABE586 IS NULL OR ABE586 > #{endTime})
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS code,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS sort,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) || '年' AS "desc",
|
||||
COALESCE(unemploymentCount, 0) AS unemploymentCount,
|
||||
COALESCE(cityAverageUnemploymentCount, 0) AS cityAverageUnemploymentCount
|
||||
FROM aggregated_data
|
||||
ORDER BY sort ;
|
||||
</select>
|
||||
|
||||
<select id="unemploymentTrendQuarter"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * 3 * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * 3 * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 4) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN 1 = 1
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS unemploymentCount,
|
||||
COUNT(DISTINCT AAC044 ) AS cityAverageUnemploymentCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_unemployment_register
|
||||
ON
|
||||
ADC210 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
AND (ABE586 IS NULL OR ABE586 > #{endTime})
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
'第' || month_num || '季度' AS "desc",
|
||||
COALESCE(unemploymentCount, 0) AS unemploymentCount,
|
||||
COALESCE(cityAverageUnemploymentCount, 0) AS cityAverageUnemploymentCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
<select id="unemploymentTrendMonth"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT generate_series(1, 12) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN 1 = 1
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
<if test="industryList != null and industryList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="industryList" item="industry" open="" separator=" OR " close="">
|
||||
AAB022 LIKE #{industry} || '%'
|
||||
</foreach>
|
||||
)
|
||||
</if> THEN AAC044 END) AS unemploymentCount,
|
||||
COUNT(DISTINCT AAC044 ) AS cityAverageUnemploymentCount
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_unemployment_register
|
||||
ON
|
||||
ADC210 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
AND (ABE586 IS NULL OR ABE586 > #{endTime})
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
month_num || '月' AS "desc",
|
||||
COALESCE(unemploymentCount, 0) AS unemploymentCount,
|
||||
COALESCE(cityAverageUnemploymentCount, 0) AS cityAverageUnemploymentCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
<select id="queryUnemploymentCountByIndustry"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
SUBSTRING(AAB022 FROM 1 FOR 3) AS code
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
|
||||
</select>
|
||||
|
||||
<select id="industryDistribution"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
SUBSTRING(AAB022 FROM 1 FOR 3) AS code
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
|
||||
</select>
|
||||
|
||||
<select id="gender"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
AAC004 AS code
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
<select id="queryUnemploymentCountByJobType"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
ACA112 AS code
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryLayoffCountByIndustry"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
SUBSTRING(AAB022 FROM 1 FOR 3) AS code
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
AND AJC093 IN ('21','22','23','32')
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="heatmap"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.HeatmapVo">
|
||||
|
||||
SELECT
|
||||
areaCode,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
AAB301 AS areaCode
|
||||
FROM theme_unemployment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY areaCode
|
||||
ORDER BY areaCode
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user