45 lines
2.2 KiB
XML
45 lines
2.2 KiB
XML
|
<?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.fourfaith.iot.drought.mapper.GridIndexSpiValueMapper">
|
||
|
|
||
|
<sql id="spi">
|
||
|
SELECT
|
||
|
t1.id,index_value as indexValue, t1.time_range AS timeRange,t3.irrigate_name as address,t3.id as siteName,
|
||
|
t3.lon,t3.lat,
|
||
|
case
|
||
|
WHEN index_value > -0.5 THEN '无旱'
|
||
|
WHEN index_value > -1.0 and -0.5 >= index_value THEN '轻度干旱'
|
||
|
WHEN index_value > -1.5 and -1.0 >= index_value THEN '中度干旱'
|
||
|
WHEN index_value > -2.0 and -1.5 >= index_value THEN '严重干旱'
|
||
|
WHEN -2.0 >= index_value THEN '特大干旱'
|
||
|
END AS level
|
||
|
FROM
|
||
|
grid_index_spi_value_primary t1
|
||
|
LEFT JOIN grid_setting t2 on t1.grid_setting_id = t2.id
|
||
|
LEFT JOIN hq_point t3 on t2.grid_id = t3.grid_id
|
||
|
WHERE t3.grid_id is not null and t1.time_type = #{timeType} and time_window = #{timeWindow}
|
||
|
and #{endDate} >= index_date and index_date >= #{startDate}
|
||
|
</sql>
|
||
|
<select id="spiDrought" resultType="com.fourfaith.iot.drought.pojo.vo.MeteorologicDroughtVO">
|
||
|
<include refid="spi"></include>
|
||
|
</select>
|
||
|
|
||
|
<select id="exportSpiDrought" resultType="com.fourfaith.iot.drought.pojo.vo.MeteorologicDroughtVO">
|
||
|
<include refid="spi"></include>
|
||
|
order by t1.index_value desc
|
||
|
</select>
|
||
|
|
||
|
<select id="gridSpi" resultType="com.fourfaith.iot.drought.pojo.vo.HeatMapPoint">
|
||
|
SELECT
|
||
|
t1.id,index_value as indexValue,
|
||
|
t3.lon,t3.lat,t3.irrigate_name as address,t3.id as hqPointId,t4.area
|
||
|
FROM
|
||
|
grid_index_spi_value_primary t1
|
||
|
LEFT JOIN grid_setting t2 on t1.grid_setting_id = t2.id
|
||
|
LEFT JOIN hq_point t3 on t2.grid_id = t3.grid_id
|
||
|
LEFT JOIN hq_generate_grid t4 on t3.id = t4.hq_point_id
|
||
|
WHERE t3.grid_id is not null and t1.time_type = #{timeType} and time_window = #{timeWindow}
|
||
|
and #{endDate} = index_date
|
||
|
</select>
|
||
|
</mapper>
|