MassUserMapper.xml
5.01 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?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="cn.com.glsx.entmicro.mapper.MassUserMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.MassUser">
<!--@Table scrm_mass_user-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="mass_id" jdbcType="INTEGER" property="massId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="msg_id" jdbcType="VARCHAR" property="msgId" />
<result column="is_send" jdbcType="TINYINT" property="isSend" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, mass_id, user_id, msg_id, is_send, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from scrm_mass_user
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByMassId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select t.id, t.mass_id, t.user_id, t.msg_id, t.is_send, t.del_flag from scrm_mass_user t
left join entmicro_staff s on t.user_id = s.user_id left join entmicro_department d on d.id = s.department_id
where t.mass_id = #{id,jdbcType=INTEGER} and t.del_flag = 0
</select>
<select id="selectByCondition" parameterType="cn.com.glsx.entmicro.model.request.MassUserRequest" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from scrm_mass_user
where 1 = 1 and del_flag = 0
<if test="obj.massId != null">
and mass_id = #{obj.massId,jdbcType=INTEGER}
</if>
<if test="obj.userId != null and obj.userId != ''">
and user_id = #{obj.userId,jdbcType=VARCHAR}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from scrm_mass_user
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.com.glsx.entmicro.entity.MassUser" useGeneratedKeys="true">
insert into scrm_mass_user (mass_id, user_id, is_send,
del_flag)
values (#{massId,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{isSend,jdbcType=TINYINT},
#{delFlag,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.com.glsx.entmicro.entity.MassUser" useGeneratedKeys="true">
insert into scrm_mass_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="massId != null">
mass_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="isSend != null">
is_send,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="massId != null">
#{massId,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="isSend != null">
#{isSend,jdbcType=TINYINT},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.com.glsx.entmicro.entity.MassUser">
update scrm_mass_user
<set>
<if test="massId != null">
mass_id = #{massId,jdbcType=INTEGER},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="isSend != null">
is_send = #{isSend,jdbcType=TINYINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.com.glsx.entmicro.entity.MassUser">
update scrm_mass_user
set mass_id = #{massId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=VARCHAR},
is_send = #{isSend,jdbcType=TINYINT},
del_flag = #{delFlag,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateDataByMassIdAndUserId" >
update scrm_mass_user
<set>
<if test="isSend != null">
is_send = #{isSend,jdbcType=TINYINT},
</if>
<if test="msgId != null and msgId != ''">
msg_id = #{msgId,jdbcType=VARCHAR},
</if>
</set>
where 1 = 1 and del_flag = 0 and mass_id = #{massId,jdbcType=INTEGER}
<if test="userId != null and userId != ''">
and user_id = #{userId,jdbcType=VARCHAR}
</if>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into scrm_mass_user (mass_id, user_id, is_send,del_flag)
values
<foreach collection="list" item="item" separator=",">
(
#{item.massId,jdbcType=INTEGER}, #{item.userId,jdbcType=VARCHAR},
#{item.isSend,jdbcType=TINYINT}, #{item.delFlag,jdbcType=TINYINT}
)
</foreach>
</insert>
</mapper>