jinpengyong
2020-05-07 66fd957202742202804a614c766b9b973a26d836
src/main/resources/mapper/HangzhouAqiMapper.xml
@@ -51,4 +51,20 @@
  <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>