WeGroupMessageSendResultMapper.xml
3.07 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
<?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.WeGroupMessageSendResultMapper">
<resultMap type="WeGroupMessageSendResult" id="WeGroupMessageSendResultResult">
<result property="id" column="id" />
<result property="msgTemplateId" column="msg_template_id" />
<result property="msgId" column="msg_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="externalUserid" column="external_userid" />
<result property="customerName" column="customer_name" />
<result property="chatId" column="chat_id" />
<result property="chatName" column="chat_name" />
<result property="status" column="status" />
<result property="sendTime" column="send_time" />
</resultMap>
<select id="groupMsgSendResultList" resultMap="WeGroupMessageSendResultResult">
select
wgmsr.id,
wgmsr.msg_id,
wgmsr.msg_template_id,
wgmsr.external_userid,
wc.name as customer_name,
wgmsr.user_id,
wu.user_name,
wgmsr.chat_id,
wg.group_name as chat_name,
wgmsr.status,
wgmsr.send_time
from
we_group_message_send_result wgmsr
left join we_user wu on
wu.user_id = wgmsr.user_id
left join we_customer wc on
wc.external_userid = wgmsr.external_userid
left join we_group wg on
wg.chat_id = wgmsr.chat_id
<where>
<if test="id !=null">
and wgmsr.id = #{id}
</if>
<if test="msgTemplateId != null and msgTemplateId != ''">
and wgmsr.msg_template_id = #{msgTemplateId}
</if>
<if test="msgId != null and msgId != ''">
and wgmsr.msg_id = #{msgId}
</if>
<if test="status != null and status != ''">
and wgmsr.status = #{status}
</if>
<if test="customerName != null and customerName != ''">
and wc.name like concat('%', #{customerName}, '%')
</if>
<if test="userName != null and userName != ''">
and wu.user_name like concat('%', #{userName}, '%')
</if>
<if test="chatName != null and chatName != ''">
and wg.group_name like concat('%', #{chatName}, '%')
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wgmsr.send_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wgmsr.send_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>