lefengyang
2026-08-14 b1fcf9eb27ed1b19eeba0880411555f77a69d558
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
104
<?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.system.mapper.SysContactMapper">
 
    <resultMap type="SysContact" id="SysContactResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="wxNickname"    column="wx_nickname"    />
        <result property="phone"    column="phone"    />
        <result property="wxVoiceFlag"    column="wx_voice_flag"    />
        <result property="wxVideoFlag"    column="wx_video_flag"    />
        <result property="phoneFlag"    column="phone_flag"    />
        <result property="noAnswerFlag"    column="no_answer_flag"    />
        <result property="avatar"    column="avatar"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>
 
    <sql id="selectSysContactVo">
        select id, user_id, wx_nickname, phone, wx_voice_flag, wx_video_flag, phone_flag, no_answer_flag, avatar, create_by, create_time, del_flag from sys_contact
    </sql>
 
    <select id="selectSysContactList" parameterType="SysContact" resultMap="SysContactResult">
        <include refid="selectSysContactVo"/>
        <where>
            del_flag != '1'
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="wxNickname != null  and wxNickname != ''"> and wx_nickname like concat('%', #{wxNickname}, '%')</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="wxVoiceFlag != null "> and wx_voice_flag = #{wxVoiceFlag}</if>
            <if test="wxVideoFlag != null "> and wx_video_flag = #{wxVideoFlag}</if>
            <if test="phoneFlag != null "> and phone_flag = #{phoneFlag}</if>
            <if test="noAnswerFlag != null "> and no_answer_flag = #{noAnswerFlag}</if>
            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
        </where>
    </select>
 
    <select id="selectSysContactById" parameterType="Long" resultMap="SysContactResult">
        <include refid="selectSysContactVo"/>
        where del_flag != '1' and  id = #{id}
    </select>
 
    <insert id="insertSysContact" parameterType="SysContact" useGeneratedKeys="true" keyProperty="id">
        insert into sys_contact
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null">user_id,</if>
            <if test="wxNickname != null">wx_nickname,</if>
            <if test="phone != null">phone,</if>
            <if test="wxVoiceFlag != null">wx_voice_flag,</if>
            <if test="wxVideoFlag != null">wx_video_flag,</if>
            <if test="phoneFlag != null">phone_flag,</if>
            <if test="noAnswerFlag != null">no_answer_flag,</if>
            <if test="avatar != null">avatar,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null">#{userId},</if>
            <if test="wxNickname != null">#{wxNickname},</if>
            <if test="phone != null">#{phone},</if>
            <if test="wxVoiceFlag != null">#{wxVoiceFlag},</if>
            <if test="wxVideoFlag != null">#{wxVideoFlag},</if>
            <if test="phoneFlag != null">#{phoneFlag},</if>
            <if test="noAnswerFlag != null">#{noAnswerFlag},</if>
            <if test="avatar != null">#{avatar},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>
 
    <update id="updateSysContact" parameterType="SysContact">
        update sys_contact
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="wxNickname != null">wx_nickname = #{wxNickname},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="wxVoiceFlag != null">wx_voice_flag = #{wxVoiceFlag},</if>
            <if test="wxVideoFlag != null">wx_video_flag = #{wxVideoFlag},</if>
            <if test="phoneFlag != null">phone_flag = #{phoneFlag},</if>
            <if test="noAnswerFlag != null">no_answer_flag = #{noAnswerFlag},</if>
            <if test="avatar != null">avatar = #{avatar},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteSysContactById" parameterType="Long">
        update sys_contact set del_flag = '1' where id = #{id}
    </delete>
 
    <delete id="deleteSysContactByIds" parameterType="String">
        update sys_contact set del_flag = '1' where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>