jinpengyong
2020-11-23 d3c68dd9fec28c76e0bb61879dffaa7b0ec1e690
update
2 files modified
33 ■■■■■ changed files
src/main/resources/mapper/AQIMapper.xml 10 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/WeatherMapper.xml 23 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/AQIMapper.xml
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.moral.mapper.AQIMapper">
    <cache/>
    <select id="getCityAqiConfig" resultType="java.util.LinkedHashMap">
        select * from city_aqi_config;
    </select>
@@ -26,8 +24,8 @@
        </foreach>
    </select>
    <select id="getO3ByTime" resultType="java.lang.String" useCache="true">
        select ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') as 'O3'
    <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}
@@ -41,8 +39,8 @@
        and DATE_FORMAT(time, '%Y%H')=#{yearAndHour}
    </select>
    <select id="getO3FromHistory" resultType="java.lang.String" useCache="true">
        select value ->'$.O3C' as 'O3'
    <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}
src/main/resources/mapper/WeatherMapper.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.moral.mapper.WeatherMapper">
    <cache/>
    <select id="getCityWeatherConfig" resultType="java.util.Map">
        select city_code AS cityCode,
@@ -116,11 +115,20 @@
        )
    </select>
    <select id="getSampleFromHistoryWeather" resultType="java.lang.String" useCache="true">
    <select id="getSampleFromHistoryWeather" resultType="java.lang.String">
        select DATE_FORMAT(time, #{typeFormat}) as time
        from history_weather_${timeUnits}
        <where>
            city_code=#{cityCode}
            <if test="windDir != null">
                and value->'$.windDir' = #{windDir}
            </if>
            <if test="windScale != null">
                and value->'$.windScale' = #{windScale}
            </if>
            <if test="condition == 0">
                and cast(value->'$.condition' as UNSIGNED integer) > #{score}
            </if>
@@ -160,10 +168,13 @@
                </foreach>
            </if>
            <if test="month != null">
                and DATE_FORMAT(time, '%m') = #{month}
            </if>
        </where>
    </select>
    <select id="getSampleFromRealWeather" resultType="java.lang.String" useCache="true">
    <select id="getSampleFromRealWeather" resultType="java.lang.String">
        select DATE_FORMAT(time, #{typeFormat}) as time
        from real_weather
        <where>
@@ -171,6 +182,10 @@
            <if test="windDir != null">
                and json->'$.windDir' = #{windDir}
            </if>
            <if test="windScale != null">
                and json->'$.windScale' = #{windScale}
            </if>
            <if test="condition == 0">
@@ -213,7 +228,7 @@
            </if>
            <if test="month != null">
                and DATE_FORMAT(time, '%m')=#{month}
                and DATE_FORMAT(time, '%m') = #{month}
            </if>
        </where>
    </select>