From 2c42977a1a38e4f079c5c44fe51a46c27b865f80 Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Fri, 23 Oct 2020 10:29:27 +0800 Subject: [PATCH] 增加天气城市配置表,优化相关接口 --- src/main/resources/mapper/WeatherMapper.xml | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/resources/mapper/RealWeatherMapper.xml b/src/main/resources/mapper/WeatherMapper.xml similarity index 86% rename from src/main/resources/mapper/RealWeatherMapper.xml rename to src/main/resources/mapper/WeatherMapper.xml index 90e1c55..11c492c 100644 --- a/src/main/resources/mapper/RealWeatherMapper.xml +++ b/src/main/resources/mapper/WeatherMapper.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 -- Gitblit v1.8.0