于紫祥_1901
2020-08-13 72bfd6cfe47b48a183ea3795054dabdcffb543d7
src/main/resources/mapper/HangzhouAqiMapper.xml
@@ -71,13 +71,13 @@
    <select id="getAqiDataByAreaCode" resultType="java.util.Map">
    SELECT
    DATE_FORMAT(time, #{typeFormat}) time,
    ifnull(aqi_json->'$.${sensors}',"") as '${sensors2}'
    ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') as 'O3'
    FROM
    hangzhou_aqi ha
    WHERE
    ha.time >= #{start}
    AND ha.time <![CDATA[<]]> #{end}
    AND ha.city_code = #{areaCode}
    AND ha.city_code = #{cityCode}
    ORDER BY
    time
  </select>
@@ -91,21 +91,20 @@
    WHERE
    time >= #{start}
    AND time <![CDATA[<]]> #{end}
    AND city_code = #{areaCode}
    AND city_code = #{cityCode}
    ORDER BY
    time
    </select>
    <select id="getAvgO3EightHours" resultType="java.util.Map">
    select
    AVG(aqi_json->'$.O3') 'O3指数8小时',
    AVG(aqi_json->'$.O3C') 'O3浓度8小时'
    AVG(case when aqi_json->'$.O3C' is null then aqi_json->'$.O3' else aqi_json->'$.O3C' end)  as 'O3C_8H'
    FROM
    hangzhou_aqi
    WHERE
    time >= #{start}
    AND time <![CDATA[<]]> #{end}
    AND city_code = #{areaCode}
    AND city_code = #{cityCode}
    </select>
</mapper>