jinpengyong
2020-10-23 2c42977a1a38e4f079c5c44fe51a46c27b865f80
src/main/resources/mapper/WeatherMapper.xml
File was renamed from src/main/resources/mapper/RealWeatherMapper.xml
@@ -1,9 +1,36 @@
<?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.RealWeatherMapper">
    <resultMap id="BaseResultMap" type="com.moral.entity.RealWeather">
        <id column="city_code" property="cityCode" jdbcType="INTEGER"/>
    </resultMap>
<mapper namespace="com.moral.mapper.WeatherMapper">
    <select id="getCityWeatherConfig" resultType="java.util.Map">
        select city_code AS cityCode,
        city_id AS cityId
        from city_weather_config
    </select>
    <insert id="insertForecastWeather">
        insert into
        forecast_weather
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.cityCode},#{item.time},#{item.json})
        </foreach>
    </insert>
    <delete id="deleteByTime">
        delete from forecast_weather
        where
        time >= #{start}
        AND time <![CDATA[<]]> #{end}
        and city_code=#{cityCode}
    </delete>
    <select id="getBeam" resultType="java.lang.String">
        select json->'$.beam' as 'beam'
        from forecast_weather
        where time=#{time}
        and city_code=#{cityCode}
    </select>
    <insert id="insertRealWeather">
        insert into
        real_weather