WeCustomerMessgaeResultMapper.xml
2.74 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
<?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.WeCustomerMessgaeResultMapper">
<insert id="batchInsert">
INSERT INTO we_customer_messgaeResult (
messgae_result_id,
message_id,
external_userid,
chat_id,
userid,
`status`,
send_time,
external_name,
user_name,
send_type,
setting_time,
create_by,
create_time,
update_by,
update_time,
del_flag,
chat_name
)
VALUES
<foreach collection="customers" item="item" separator="," index="index" >
(#{item.messgaeResultId},
#{item.messageId},
#{item.externalUserid},
#{item.chatId},
#{item.userid},
#{item.status},
#{item.sendTime},
#{item.externalName},
#{item.userName},
#{item.sendType},
#{item.settingTime},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.delFlag},
#{item.chatName})
</foreach>
</insert>
<update id="updateWeCustomerMessgaeResult">
UPDATE we_customer_messgaeResult
<set>
<if test="sendTime!=null and sendTime!=''">
send_time=#{sendTime},
</if>
<if test="status!=null and status!=''">
status=#{status}
</if>
</set>
<where>
message_id=#{messageId}
<if test="chatId!=null and chatId!=''">
AND chat_id=#{chatId}
</if>
<if test="externalUserid!=null and externalUserid!=''">
AND external_userid=#{externalUserid}
</if>
</where>
</update>
<select id="customerMessagePushs" resultType="com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo">
SELECT
user_name,
GROUP_CONCAT(IFNULL(external_name,chat_name) SEPARATOR '、') customers
FROM
we_customer_messgaeResult
<where>
message_id=#{messageId}
<if test="status!=null">
AND `status`=#{status}
</if>
</where>
GROUP BY user_name
</select>
<select id="checkSendStatus" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
we_customer_messgaeResult
<where>
message_id =#{messageId} AND `status`='1'
</where>
</select>
</mapper>