双重预防项目-国泰新华二开定制版
SZH
2022-08-20 f9f0687195e0fe349185437d22c495d74c8d4a20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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>