| | |
| | | <select id="queryCityCode" resultType="integer"> |
| | | select city_code from area where area_code = #{areaCode} |
| | | </select> |
| | | |
| | | <select id="getAreaAvgDataByAreaCode" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT(time, #{typeFormat}) time, |
| | | round(AVG(case when aqi_json->'$.${sensors}' is null then aqi_json->'$.${sensors1}' else aqi_json->'$.${sensors}' end),4) as '${sensors2}' |
| | | FROM |
| | | hangzhou_aqi ha |
| | | WHERE |
| | | ha.time >= #{start} |
| | | AND ha.time <![CDATA[<]]> #{end} |
| | | AND ha.city_code = #{areaCode} |
| | | GROUP BY |
| | | DATE_FORMAT(time, #{typeFormat}) |
| | | ORDER BY |
| | | time |
| | | </select> |
| | | </mapper> |