From 3508a0975f50ea277f59cc034d41d282ab82623c Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Mon, 20 Jul 2020 11:34:42 +0800 Subject: [PATCH] update --- src/main/java/com/moral/entity/RealTimeWeather.java | 15 +++++++ src/main/resources/mapper/RealTimeWeatherMapper.xml | 3 + /dev/null | 13 ------ src/main/java/com/moral/entity/City.java | 1 src/main/java/com/moral/entity/Area.java | 1 src/main/resources/mapper/MonitorPointMapper.xml | 16 +++++++ src/main/resources/mapper/ProvinceMapper.xml | 6 ++ src/main/resources/mapper/AreaMapper.xml | 7 +++ src/main/resources/mapper/CityMapper.xml | 7 +++ src/main/java/com/moral/entity/Province.java | 1 10 files changed, 53 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/moral/entity/Area.java b/src/main/java/com/moral/entity/Area.java index e378d07..9f88f0b 100644 --- a/src/main/java/com/moral/entity/Area.java +++ b/src/main/java/com/moral/entity/Area.java @@ -7,6 +7,7 @@ @Data public class Area { + @Id private Integer areaCode; private String areaName; diff --git a/src/main/java/com/moral/entity/City.java b/src/main/java/com/moral/entity/City.java index e82999e..2b5dba7 100644 --- a/src/main/java/com/moral/entity/City.java +++ b/src/main/java/com/moral/entity/City.java @@ -7,6 +7,7 @@ @Data public class City { + @Id private Integer cityCode; private String cityName; diff --git a/src/main/java/com/moral/entity/Province.java b/src/main/java/com/moral/entity/Province.java index 34ea87a..71239ae 100644 --- a/src/main/java/com/moral/entity/Province.java +++ b/src/main/java/com/moral/entity/Province.java @@ -7,6 +7,7 @@ @Data public class Province { + @Id private Integer provinceCode; private String provinceName; diff --git a/src/main/java/com/moral/entity/RealTimeWeather.java b/src/main/java/com/moral/entity/RealTimeWeather.java new file mode 100644 index 0000000..288230f --- /dev/null +++ b/src/main/java/com/moral/entity/RealTimeWeather.java @@ -0,0 +1,15 @@ +package com.moral.entity; + +import java.util.Date; + +import lombok.Data; + +import javax.persistence.Id; + +@Data +public class RealTimeWeather { + @Id + private Integer monitorPointId; + private Date time; + private String json; +} \ No newline at end of file diff --git a/src/main/resources/mapper/AreaMapper.xml b/src/main/resources/mapper/AreaMapper.xml index 2f2048c..b5a2b7e 100644 --- a/src/main/resources/mapper/AreaMapper.xml +++ b/src/main/resources/mapper/AreaMapper.xml @@ -1,7 +1,12 @@ <?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.AreaMapper"> - <select id="getAreaByAreaCode" resultType="com.moral.entity.Area"> + <resultMap id="BaseResultMap" type="com.moral.entity.Area" > + <id column="area_code" property="areaCode" jdbcType="INTEGER" /> + <result column="area_name" property="areaName" jdbcType="VARCHAR" /> + <result column="city_code" property="cityCode" jdbcType="INTEGER" /> + </resultMap> + <select id="getAreaByAreaCode" resultType="com.moral.entity.Area" resultMap="BaseResultMap"> select * from area where area_code=#{areaCode} </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/CityMapper.xml b/src/main/resources/mapper/CityMapper.xml index 4cacae0..9188b15 100644 --- a/src/main/resources/mapper/CityMapper.xml +++ b/src/main/resources/mapper/CityMapper.xml @@ -1,7 +1,12 @@ <?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.CityMapper"> - <select id="getCityByCityCode" resultType="com.moral.entity.City"> + <resultMap id="BaseResultMap" type="com.moral.entity.City"> + <id column="city_code" property="cityCode" jdbcType="INTEGER"/> + <result column="city_name" property="cityName" jdbcType="VARCHAR"/> + <result column="province_code" property="provinceCode" jdbcType="INTEGER"/> + </resultMap> + <select id="getCityByCityCode" resultType="com.moral.entity.City" resultMap="BaseResultMap"> select * from city where city_code=#{cityCode} </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/MonitorPointMapper.xml b/src/main/resources/mapper/MonitorPointMapper.xml index 53cd8f1..3914466 100644 --- a/src/main/resources/mapper/MonitorPointMapper.xml +++ b/src/main/resources/mapper/MonitorPointMapper.xml @@ -1,7 +1,21 @@ <?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.MonitorPointMapper"> - <select id="getMonitorPointList" resultType="com.moral.entity.MonitorPoint"> + <resultMap id="BaseResultMap" type="com.moral.entity.MonitorPoint"> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="name" jdbcType="VARCHAR" property="name" /> + <result column="longitude" jdbcType="REAL" property="longitude" /> + <result column="latitude" jdbcType="REAL" property="latitude" /> + <result column="province_code" jdbcType="INTEGER" property="provinceCode" /> + <result column="city_code" jdbcType="INTEGER" property="cityCode" /> + <result column="area_code" jdbcType="INTEGER" property="areaCode" /> + <result column="organization_id" jdbcType="INTEGER" property="organizationId" /> + <result column="address" jdbcType="VARCHAR" property="address" /> + <result column="is_delete" jdbcType="CHAR" property="isDelete" /> + <result column="description" jdbcType="VARCHAR" property="description" /> + <result column="state" jdbcType="INTEGER" property="state" /> + </resultMap> + <select id="getMonitorPointList" resultType="com.moral.entity.MonitorPoint" resultMap="BaseResultMap"> select * from monitor_point </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ProvinceMapper.xml b/src/main/resources/mapper/ProvinceMapper.xml index 86958f7..dda9531 100644 --- a/src/main/resources/mapper/ProvinceMapper.xml +++ b/src/main/resources/mapper/ProvinceMapper.xml @@ -1,7 +1,11 @@ <?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.ProvinceMapper"> - <select id="getProvinceByProvinceCode" resultType="com.moral.entity.Province"> + <resultMap id="BaseResultMap" type="com.moral.entity.Province" > + <id column="province_code" property="provinceCode" jdbcType="INTEGER" /> + <result column="province_name" property="provinceName" jdbcType="VARCHAR" /> + </resultMap> + <select id="getProvinceByProvinceCode" resultType="com.moral.entity.Province" resultMap="BaseResultMap"> select * from province where province_code=#{provinceCode} </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/RealTimeWeatherMapper.xml b/src/main/resources/mapper/RealTimeWeatherMapper.xml index 26c4d2e..e68f7b7 100644 --- a/src/main/resources/mapper/RealTimeWeatherMapper.xml +++ b/src/main/resources/mapper/RealTimeWeatherMapper.xml @@ -1,6 +1,9 @@ <?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.RealTimeWeatherMapper"> + <resultMap id="BaseResultMap" type="com.moral.entity.RealTimeWeather" > + <id column="monitor_point_id" property="monitorPointId" jdbcType="INTEGER" /> + </resultMap> <insert id="insertRealTimeWeather"> insert into realtime_weather diff --git a/src/main/resources/mapper/mybatis-config.xml b/src/main/resources/mapper/mybatis-config.xml deleted file mode 100644 index 2891d41..0000000 --- a/src/main/resources/mapper/mybatis-config.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE configuration - PUBLIC "-//mybatis.org//DTD Config 3.0//EN" - "http://mybatis.org/dtd/mybatis-3-config.dtd"> - -<configuration> - <settings> - <setting name="mapUnderscoreToCamelCase" value="true"/> - </settings> - <typeAliases> - <package name="com.moral.entity" /> - </typeAliases> -</configuration> \ No newline at end of file -- Gitblit v1.8.0