WeGroupMessageListMapper.xml
4.52 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
<?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.WeGroupMessageListMapper">
<resultMap type="WeGroupMessageList" id="WeGroupMessageListResult">
<result property="id" column="id" />
<result property="msgTemplateId" column="msg_template_id" />
<result property="msgId" column="msg_id" />
<result property="chatType" column="chat_type" />
<result property="userId" column="user_id" />
<result property="sendTime" column="send_time" />
<result property="createType" column="create_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="groupMsgDetailResult" type="WeGroupMessageListVo">
<result property="msgTemplateId" column="msg_template_id" />
<collection property="attachments" ofType="com.linkwechat.wecom.domain.WeGroupMessageAttachments">
<result property="msgType" column="msg_type"/>
<result property="content" column="content"/>
<result property="appId" column="app_id"/>
<result property="mediaId" column="media_id"/>
<result property="description" column="description"/>
<result property="linkUrl" column="link_url"/>
<result property="picUrl" column="pic_url"/>
</collection>
<collection property="senders" ofType="com.linkwechat.wecom.domain.WeGroupMessageTask">
<result property="userId" column="sender"/>
<result property="userName" column="sender_name"/>
<result property="status" column="task_status"/>
<result property="sendTime" column="task_send_time"/>
</collection>
<collection property="extralInfos" ofType="com.linkwechat.wecom.domain.WeGroupMessageSendResult">
<result property="userId" column="res_sender"/>
<result property="userName" column="res_sender_name"/>
<result property="chatId" column="chat_id"/>
<result property="chatName" column="chat_name"/>
<result property="externalUserid" column="external_userid"/>
<result property="customerName" column="customer_name"/>
<result property="status" column="res_status"/>
<result property="sendTime" column="res_send_time"/>
</collection>
</resultMap>
<sql id="getDetailVo">
select
wgml.msg_template_id,
wgma.msg_type,
wgma.content,
wgma.app_id ,
wgma.media_id ,
wgma.description ,
wgma.link_url ,
wgma.file_url ,
wgma.pic_url ,
wgmt.user_id as sender,
(select user_name from we_user wu where wu.user_id = wgmt.user_id limit 1) as sender_name,
wgmt.status as task_status,
wgmt.send_time as task_send_time,
wgmsr.user_id as res_sender,
(select user_name from we_user wu where wu.user_id = wgmsr.user_id limit 1) as res_sender_name,
wgmsr.chat_id ,
if(wgmsr.chat_id is null,null,(select wg.group_name from we_group wg where wg.chat_id = wgmsr.chat_id limit 1)) as chat_name,
wgmsr.external_userid,
if(wgmsr.external_userid is null,null,(select wc.name from we_customer wc where wc.external_userid = wgmsr.external_userid limit 1)) as customer_name,
wgmsr.status as res_status,
wgmsr.send_time as res_send_time
from
we_group_message_list wgml
left join we_group_message_attachments wgma on
wgma.msg_template_id = wgml.msg_template_id
left join we_group_message_task wgmt on
wgmt.msg_template_id = wgml.msg_template_id
left join we_group_message_send_result wgmsr on
wgmsr.msg_template_id = wgml.msg_template_id
where
1 = 1
</sql>
<select id="getGroupMsgDetails" resultMap="groupMsgDetailResult">
<include refid="getDetailVo"/>
<if test="msgTemplateIds != null and msgTemplateIds.size > 0">
and wgml.msg_template_id in
<foreach collection="msgTemplateIds" index="index" item="msgTemplateId" open="(" separator="," close=")">
#{msgTemplateId}
</foreach>
</if>
</select>
</mapper>