| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?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.ufo.project.weather.mapper.WeatherAreaMapper">
-
- <resultMap type="WeatherArea" id="WeatherAreaResult">
- <result property="areaId" column="area_id" />
- <result property="nameCn" column="name_cn" />
- <result property="districtCn" column="district_cn" />
- <result property="provcnCn" column="provcn_cn" />
- <result property="nationCn" column="nation_cn" />
- <result property="continentCn" column="continent_cn" />
- <result property="cityId" column="city_id" />
- <result property="cityName" column="city_name" />
- <result property="parentName" column="parent_name" />
- <result property="longitude" column="longitude" />
- <result property="latitude" column="latitude" />
- <result property="areaName" column="area_name" />
- <result property="areaNumber" column="area_number" />
- </resultMap>
- <sql id="selectWeatherAreaVo">
- select area_id, name_cn, district_cn, provcn_cn, nation_cn, continent_cn, city_id, city_name, parent_name, longitude, latitude, area_name, area_number from weather_area
- </sql>
- <select id="selectWeatherAreaList" parameterType="WeatherArea" resultMap="WeatherAreaResult">
- <include refid="selectWeatherAreaVo"/>
- <where>
- <if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
- <if test="nameCn != null and nameCn != ''"> and name_cn = #{nameCn}</if>
- <if test="districtCn != null and districtCn != ''"> and district_cn = #{districtCn}</if>
- <if test="provcnCn != null and provcnCn != ''"> and provcn_cn = #{provcnCn}</if>
- <if test="nationCn != null and nationCn != ''"> and nation_cn = #{nationCn}</if>
- <if test="continentCn != null and continentCn != ''"> and continent_cn = #{continentCn}</if>
- <if test="cityId != null "> and city_id = #{cityId}</if>
- <if test="cityName != null and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
- <if test="parentName != null and parentName != ''"> and parent_name like concat('%', #{parentName}, '%')</if>
- <if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
- <if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
- <if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
- <if test="areaNumber != null and areaNumber != ''"> and area_number = #{areaNumber}</if>
- </where>
- </select>
-
- <select id="selectWeatherAreaByAreaId" parameterType="String" resultMap="WeatherAreaResult">
- <include refid="selectWeatherAreaVo"/>
- where area_id = #{areaId}
- </select>
-
- <insert id="insertWeatherArea" parameterType="WeatherArea">
- insert into weather_area
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="areaId != null and areaId != ''">area_id,</if>
- <if test="nameCn != null">name_cn,</if>
- <if test="districtCn != null">district_cn,</if>
- <if test="provcnCn != null">provcn_cn,</if>
- <if test="nationCn != null">nation_cn,</if>
- <if test="continentCn != null">continent_cn,</if>
- <if test="cityId != null">city_id,</if>
- <if test="cityName != null">city_name,</if>
- <if test="parentName != null">parent_name,</if>
- <if test="longitude != null">longitude,</if>
- <if test="latitude != null">latitude,</if>
- <if test="areaName != null">area_name,</if>
- <if test="areaNumber != null">area_number,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="areaId != null and areaId != ''">#{areaId},</if>
- <if test="nameCn != null">#{nameCn},</if>
- <if test="districtCn != null">#{districtCn},</if>
- <if test="provcnCn != null">#{provcnCn},</if>
- <if test="nationCn != null">#{nationCn},</if>
- <if test="continentCn != null">#{continentCn},</if>
- <if test="cityId != null">#{cityId},</if>
- <if test="cityName != null">#{cityName},</if>
- <if test="parentName != null">#{parentName},</if>
- <if test="longitude != null">#{longitude},</if>
- <if test="latitude != null">#{latitude},</if>
- <if test="areaName != null">#{areaName},</if>
- <if test="areaNumber != null">#{areaNumber},</if>
- </trim>
- </insert>
- <update id="updateWeatherArea" parameterType="WeatherArea">
- update weather_area
- <trim prefix="SET" suffixOverrides=",">
- <if test="nameCn != null">name_cn = #{nameCn},</if>
- <if test="districtCn != null">district_cn = #{districtCn},</if>
- <if test="provcnCn != null">provcn_cn = #{provcnCn},</if>
- <if test="nationCn != null">nation_cn = #{nationCn},</if>
- <if test="continentCn != null">continent_cn = #{continentCn},</if>
- <if test="cityId != null">city_id = #{cityId},</if>
- <if test="cityName != null">city_name = #{cityName},</if>
- <if test="parentName != null">parent_name = #{parentName},</if>
- <if test="longitude != null">longitude = #{longitude},</if>
- <if test="latitude != null">latitude = #{latitude},</if>
- <if test="areaName != null">area_name = #{areaName},</if>
- <if test="areaNumber != null">area_number = #{areaNumber},</if>
- </trim>
- where area_id = #{areaId}
- </update>
- <delete id="deleteWeatherAreaByAreaId" parameterType="String">
- delete from weather_area where area_id = #{areaId}
- </delete>
- <delete id="deleteWeatherAreaByAreaIds" parameterType="String">
- delete from weather_area where area_id in
- <foreach item="areaId" collection="array" open="(" separator="," close=")">
- #{areaId}
- </foreach>
- </delete>
- </mapper>
|