lizijie
2020-11-24 15ce40adc82f9277dc60ed29dad710013e99eca9
src/main/resources/mapper/AQIMapper.xml
@@ -24,6 +24,13 @@
        </foreach>
    </select>
    <select id="getAqiFromHangzhou" resultType="java.lang.String">
        select ifnull(aqi_json->'$.${sensorKey}',aqi_json->'$.${sensorKey1}') as '${sensorKey}'
        from hangzhou_aqi
        where city_code=#{cityCode}
        and DATE_FORMAT(time, #{typeFormat})=#{time}
    </select>
    <select id="getAqiByHour" resultType="java.util.Map">
        select DATE_FORMAT(time, '%Y-%m-%d %H:%i:%s') time,
        value
@@ -31,4 +38,11 @@
        where city_code=#{cityCode}
        and DATE_FORMAT(time, '%Y%H')=#{yearAndHour}
    </select>
    <select id="getAqiFromHistory" resultType="java.lang.String">
        select value ->'$.${sensorKey}' as '${sensorKey}'
        from history_aqi_${timeUnits}
        where city_code=#{cityCode}
        and DATE_FORMAT(time, #{typeFormat})=#{time}
    </select>
</mapper>