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}