<?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.ruoyi.project.tool.cityCode.mapper.CityCodeMapper">
|
|
<resultMap type="CityCode" id="CityCodeResult">
|
<result property="id" column="id" />
|
<result property="pid" column="pid" />
|
<result property="cityCode" column="city_code" />
|
<result property="cityName" column="city_name" />
|
<result property="postCode" column="post_code" />
|
<result property="areaCode" column="area_code" />
|
<result property="ctime" column="ctime" />
|
</resultMap>
|
|
<sql id="selectCityCodeVo">
|
select id, pid, city_code, city_name, post_code, area_code, ctime from tool_city_code
|
</sql>
|
|
<select id="selectCityCodeList" parameterType="CityCode" resultMap="CityCodeResult">
|
<include refid="selectCityCodeVo"/>
|
<where>
|
<if test="pid != null "> and pid = #{pid}</if>
|
<if test="cityCode != null "> and city_code = #{cityCode}</if>
|
<if test="cityName != null and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
|
<if test="postCode != null and postCode != '' "> and post_code = #{postCode}</if>
|
<if test="areaCode != null and areaCode != '' "> and area_code = #{areaCode}</if>
|
<if test="ctime != null "> and ctime = #{ctime}</if>
|
</where>
|
</select>
|
|
<select id="selectCityCodeById" parameterType="Integer" resultMap="CityCodeResult">
|
<include refid="selectCityCodeVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertCityCode" parameterType="CityCode">
|
insert into tool_city_code
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null ">id,</if>
|
<if test="pid != null ">pid,</if>
|
<if test="cityCode != null ">city_code,</if>
|
<if test="cityName != null and cityName != ''">city_name,</if>
|
<if test="postCode != null and postCode != ''">post_code,</if>
|
<if test="areaCode != null and areaCode != ''">area_code,</if>
|
<if test="ctime != null ">ctime,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null ">#{id},</if>
|
<if test="pid != null ">#{pid},</if>
|
<if test="cityCode != null ">#{cityCode},</if>
|
<if test="cityName != null and cityName != ''">#{cityName},</if>
|
<if test="postCode != null and postCode != ''">#{postCode},</if>
|
<if test="areaCode != null and areaCode != ''">#{areaCode},</if>
|
<if test="ctime != null ">#{ctime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateCityCode" parameterType="CityCode">
|
update tool_city_code
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="pid != null ">pid = #{pid},</if>
|
<if test="cityCode != null ">city_code = #{cityCode},</if>
|
<if test="cityName != null and cityName != ''">city_name = #{cityName},</if>
|
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
|
<if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
|
<if test="ctime != null ">ctime = #{ctime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteCityCodeById" parameterType="Integer">
|
delete from tool_city_code where id = #{id}
|
</delete>
|
|
<delete id="deleteCityCodeByIds" parameterType="String">
|
delete from tool_city_code where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|