WeMsgTlpMapper.xml
3.91 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
<?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.linkwechat.wecom.mapper.WeMsgTlpMapper">
<resultMap type="WeMsgTlp" id="WeMsgTlpResult">
<result property="id" column="id" />
<result property="welcomeMsg" column="welcome_msg" />
<result property="mediaId" column="media_id" />
<result property="delFlag" column="del_flag" />
<result property="welcomeMsgTplType" column="welcome_msg_tpl_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="materialUrl" column="material_url"/>
</resultMap>
<sql id="selectWeMsgTlpVo">
select id, welcome_msg, media_id, del_flag, welcome_msg_tpl_type,create_by,create_time from we_msg_tlp
</sql>
<select id="selectWeMsgTlpList" parameterType="WeMsgTlp" resultMap="WeMsgTlpResult">
SELECT
wmt.id,
wmt.welcome_msg,
wmt.media_id,
wmt.del_flag,
wmt.welcome_msg_tpl_type,
wmt.create_by,
wmt.create_time,
wm.material_url
FROM
we_msg_tlp wmt
INNER JOIN we_material wm ON wmt.media_id=wm.id
<where>
<if test="welcomeMsg != null and welcomeMsg != ''"> and wmt.welcome_msg like CONCAT('%',#{welcomeMsg,jdbcType=VARCHAR},'%') </if>
<if test="welcomeMsgTplType !=null "> and wmt.welcome_msg_tpl_type = #{welcomeMsgTplType}</if>
and wmt.del_flag = 0
</where>
</select>
<select id="selectWeMsgTlpById" parameterType="Long" resultMap="WeMsgTlpResult">
<include refid="selectWeMsgTlpVo"/>
where id = #{id}
</select>
<insert id="insertWeMsgTlp" parameterType="WeMsgTlp">
insert into we_msg_tlp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="welcomeMsg != null">welcome_msg,</if>
<if test="mediaId != null">media_id,</if>
<if test="delFlag != null">del_flag,</if>
<if test="welcomeMsgTplType != null">welcome_msg_tpl_type,</if>
<if test="createBy != null ">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="welcomeMsg != null">#{welcomeMsg},</if>
<if test="mediaId != null">#{mediaId},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="welcomeMsgTplType != null">#{welcomeMsgTplType},</if>
<if test="createBy != null ">#{createBy},</if>
</trim>
</insert>
<update id="updateWeMsgTlp" parameterType="WeMsgTlp">
update we_msg_tlp
<trim prefix="SET" suffixOverrides=",">
<if test="welcomeMsg != null">welcome_msg = #{welcomeMsg},</if>
<if test="mediaId != null">media_id = #{mediaId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="welcomeMsgTplType != null">welcome_msg_tpl_type = #{welcomeMsgTplType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeMsgTlpById" parameterType="Long">
delete from we_msg_tlp where id = #{id}
</delete>
<delete id="deleteWeMsgTlpByIds" parameterType="String">
delete from we_msg_tlp where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="batchRemoveByids">
update we_msg_tlp set
del_flag = 2
where id in
<foreach collection="msgTlpIds" item="msgTlpId" index="index"
separator="," open="(" close=")">
#{msgTlpId}
</foreach>
</update>
</mapper>