添加功能
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
<mapper namespace="com.ruoyi.cms.mapper.ModelWarningIndicatorDataMapper">
|
||||
|
||||
<insert id="insert" parameterType="com.ruoyi.cms.domain.ModelWarningIndicatorData">
|
||||
INSERT INTO model_warning_indicator_data (indicator_code, data_value, year, month, region_code, region_name, remark)
|
||||
INSERT INTO model_warning_indicator_data (indicator_code, data_value, year, month, region_code, region_name,
|
||||
remark)
|
||||
VALUES (#{indicatorCode}, #{dataValue}, #{year}, #{month}, #{regionCode}, #{regionName}, #{remark})
|
||||
</insert>
|
||||
|
||||
@@ -29,8 +30,17 @@
|
||||
|
||||
<select id="selectById" parameterType="com.ruoyi.cms.domain.ModelWarningIndicatorData"
|
||||
resultType="com.ruoyi.cms.domain.ModelWarningIndicatorData">
|
||||
SELECT *
|
||||
FROM model_warning_indicator_data
|
||||
SELECT a.id,
|
||||
a.indicator_code,
|
||||
a.data_value,
|
||||
a.year,
|
||||
a.month,
|
||||
a.region_code,
|
||||
a.region_name,
|
||||
a.remark,
|
||||
b.indicator_name
|
||||
FROM model_warning_indicator_data a
|
||||
LEFT JOIN model_warning_indicator b ON a.indicator_code = b.indicator_code
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
@@ -39,12 +49,12 @@
|
||||
SELECT *
|
||||
FROM model_warning_indicator_data
|
||||
WHERE indicator_code = #{indicatorCode}
|
||||
AND year = #{year}
|
||||
AND month = #{month}
|
||||
AND year = #{year}
|
||||
AND month = #{month}
|
||||
AND region_code = #{regionCode}
|
||||
</select>
|
||||
|
||||
<select id="selectByIndicatorCode" parameterType="java.lang.String"
|
||||
<select id="selectByIndicatorCode"
|
||||
resultType="com.ruoyi.cms.domain.ModelWarningIndicatorData">
|
||||
SELECT *
|
||||
FROM model_warning_indicator_data
|
||||
@@ -52,15 +62,26 @@
|
||||
<if test="indicatorCode != null and indicatorCode != ''">
|
||||
AND indicator_code = #{indicatorCode}
|
||||
</if>
|
||||
<if test="regionCode != null and regionCode != ''">
|
||||
AND region_code = #{regionCode}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY year DESC, month DESC, indicator_code
|
||||
</select>
|
||||
|
||||
|
||||
<select id="list" parameterType="com.ruoyi.cms.domain.ModelWarningIndicatorData"
|
||||
resultType="com.ruoyi.cms.domain.ModelWarningIndicatorData">
|
||||
SELECT *
|
||||
FROM model_warning_indicator_data
|
||||
SELECT a.id,
|
||||
a.indicator_code,
|
||||
a.data_value,
|
||||
a.year,
|
||||
a.month,
|
||||
a.region_code,
|
||||
a.region_name,
|
||||
a.remark,
|
||||
b.indicator_name
|
||||
FROM model_warning_indicator_data a
|
||||
LEFT JOIN model_warning_indicator b ON a.indicator_code = b.indicator_code
|
||||
<where>
|
||||
<if test="id != null ">
|
||||
AND id = #{id}
|
||||
@@ -84,4 +105,124 @@
|
||||
ORDER BY year DESC, month DESC, indicator_code
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listUnemploymentRateMonitor" parameterType="java.lang.String"
|
||||
resultType="com.ruoyi.cms.domain.dto.ModelWarningIndicatorDataResultDto">
|
||||
|
||||
WITH ranked_data AS (
|
||||
SELECT
|
||||
a.year,
|
||||
a.month,
|
||||
ROW_NUMBER() OVER (ORDER BY year DESC, month DESC) as row_num,
|
||||
COUNT(*) OVER () as total_count
|
||||
FROM model_warning_indicator_data a
|
||||
INNER JOIN model_unemployment_rate_monitor b ON a.indicator_code = b.indicator_code
|
||||
WHERE a.region_code = #{regionCode}
|
||||
),
|
||||
year_month AS (
|
||||
SELECT
|
||||
year,
|
||||
month
|
||||
FROM ranked_data
|
||||
WHERE row_num = LEAST(36, total_count) LIMIT 1 )
|
||||
|
||||
SELECT a.id,
|
||||
a.indicator_code,
|
||||
a.data_value,
|
||||
a.year,
|
||||
a.month,
|
||||
a.region_code,
|
||||
a.region_name,
|
||||
a.remark,
|
||||
c.indicator_name
|
||||
FROM year_month d
|
||||
LEFT JOIN model_warning_indicator_data a
|
||||
ON a.year >= d.year AND a.month >= d.month
|
||||
AND a.region_code = #{regionCode}
|
||||
INNER JOIN model_unemployment_rate_monitor b ON a.indicator_code = b.indicator_code
|
||||
LEFT JOIN model_warning_indicator c ON a.indicator_code = c.indicator_code;
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="listEmploymentMonitorComposite" parameterType="java.lang.String"
|
||||
resultType="com.ruoyi.cms.domain.dto.ModelWarningIndicatorDataResultDto">
|
||||
|
||||
WITH ranked_data AS (
|
||||
SELECT
|
||||
a.year,
|
||||
a.month,
|
||||
ROW_NUMBER() OVER (ORDER BY year DESC, month DESC) as row_num,
|
||||
COUNT(*) OVER () as total_count
|
||||
FROM model_warning_indicator_data a
|
||||
INNER JOIN model_employment_monitor_composite b ON a.indicator_code = b.indicator_code
|
||||
WHERE a.region_code = #{regionCode}
|
||||
),
|
||||
year_month AS (
|
||||
SELECT
|
||||
year,
|
||||
month
|
||||
FROM ranked_data
|
||||
WHERE row_num = LEAST(36, total_count) LIMIT 1 )
|
||||
|
||||
SELECT a.id,
|
||||
a.indicator_code,
|
||||
a.data_value,
|
||||
a.year,
|
||||
a.month,
|
||||
a.region_code,
|
||||
a.region_name,
|
||||
a.remark,
|
||||
c.indicator_name,
|
||||
b.indicator_weight,
|
||||
b.indicator_type
|
||||
FROM year_month d
|
||||
LEFT JOIN model_warning_indicator_data a
|
||||
ON a.year >= d.year AND a.month >= d.month
|
||||
AND a.region_code = #{regionCode}
|
||||
INNER JOIN model_employment_monitor_composite b ON a.indicator_code = b.indicator_code
|
||||
LEFT JOIN model_warning_indicator c ON a.indicator_code = c.indicator_code;
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listUnemploymentWarningDiffusion" parameterType="java.lang.String"
|
||||
resultType="com.ruoyi.cms.domain.dto.ModelWarningIndicatorDataResultDto">
|
||||
|
||||
WITH ranked_data AS (
|
||||
SELECT
|
||||
a.year,
|
||||
a.month,
|
||||
ROW_NUMBER() OVER (ORDER BY year DESC, month DESC) as row_num,
|
||||
COUNT(*) OVER () as total_count
|
||||
FROM model_warning_indicator_data a
|
||||
INNER JOIN model_unemployment_warning_diffusion b ON a.indicator_code = b.indicator_code
|
||||
WHERE a.region_code = #{regionCode}
|
||||
),
|
||||
year_month AS (
|
||||
SELECT
|
||||
year,
|
||||
month
|
||||
FROM ranked_data
|
||||
WHERE row_num = LEAST(36, total_count) LIMIT 1 )
|
||||
|
||||
SELECT a.id,
|
||||
a.indicator_code,
|
||||
a.data_value,
|
||||
a.year,
|
||||
a.month,
|
||||
a.region_code,
|
||||
a.region_name,
|
||||
a.remark,
|
||||
c.indicator_name,
|
||||
b.indicator_weight,
|
||||
b.indicator_type,
|
||||
b.lead_period
|
||||
FROM year_month d
|
||||
LEFT JOIN model_warning_indicator_data a
|
||||
ON a.year >= d.year AND a.month >= d.month
|
||||
AND a.region_code = #{regionCode}
|
||||
INNER JOIN model_unemployment_warning_diffusion b ON a.indicator_code = b.indicator_code
|
||||
LEFT JOIN model_warning_indicator c ON a.indicator_code = c.indicator_code;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user