fuliqi
2024-09-11 b14531e3b850fe6d2fa916ba7b88b3e2bd2ff30a
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?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.ycl.platform.mapper.TPlatformMapper">
    
    <resultMap type="TPlatform" id="TPlatformResult">
        <result property="id"    column="id"    />
        <result property="platformCode"    column="platform_code"    />
        <result property="platformName"    column="platform_name"    />
        <result property="platformContact"    column="platform_contact"    />
        <result property="platformContactPhone"    column="platform_contact_phone"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
 
    <sql id="selectTPlatformVo">
        select id,
               platform_code,
               platform_name,
               platform_contact,
               platform_contact_phone,
               status,
               remark,
               create_time,
               update_time,
               deleted
        from t_platform
    </sql>
 
    <select id="selectTPlatformList" parameterType="TPlatform" resultMap="TPlatformResult">
        <include refid="selectTPlatformVo"/>
        <where>  
            <if test="platformCode != null  and platformCode != ''"> and platform_code = #{platformCode}</if>
            <if test="platformName != null  and platformName != ''"> and platform_name like concat('%', #{platformName}, '%')</if>
            <if test="platformContact != null  and platformContact != ''"> and platform_contact = #{platformContact}</if>
            <if test="platformContactPhone != null  and platformContactPhone != ''"> and platform_contact_phone = #{platformContactPhone}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>
        </where>
    </select>
    
    <select id="selectTPlatformById" parameterType="Long" resultMap="TPlatformResult">
        <include refid="selectTPlatformVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTPlatform" parameterType="TPlatform" useGeneratedKeys="true" keyProperty="id">
        insert into t_platform
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="platformCode != null and platformCode != ''">platform_code,</if>
            <if test="platformName != null and platformName != ''">platform_name,</if>
            <if test="platformContact != null and platformContact != ''">platform_contact,</if>
            <if test="platformContactPhone != null and platformContactPhone != ''">platform_contact_phone,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="deleted != null">deleted,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="platformCode != null and platformCode != ''">#{platformCode},</if>
            <if test="platformName != null and platformName != ''">#{platformName},</if>
            <if test="platformContact != null and platformContact != ''">#{platformContact},</if>
            <if test="platformContactPhone != null and platformContactPhone != ''">#{platformContactPhone},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="deleted != null">#{deleted},</if>
         </trim>
    </insert>
 
    <update id="updateTPlatform" parameterType="TPlatform">
        update t_platform
        <trim prefix="SET" suffixOverrides=",">
            <if test="platformCode != null and platformCode != ''">platform_code = #{platformCode},</if>
            <if test="platformName != null and platformName != ''">platform_name = #{platformName},</if>
            <if test="platformContact != null and platformContact != ''">platform_contact = #{platformContact},</if>
            <if test="platformContactPhone != null and platformContactPhone != ''">platform_contact_phone = #{platformContactPhone},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteTPlatformById" parameterType="Long">
        delete from t_platform where id = #{id}
    </delete>
 
    <delete id="deleteTPlatformByIds" parameterType="String">
        delete from t_platform where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>