WeGroupMessageTaskMapper.xml
2.13 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
<?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.WeGroupMessageTaskMapper">
<resultMap type="WeGroupMessageTask" id="WeGroupMessageTaskResult">
<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="status" column="status" />
<result property="sendTime" column="send_time" />
</resultMap>
<select id="groupMsgTaskList" resultMap="WeGroupMessageTaskResult">
select
wgmt.id,
wgmt.msg_template_id,
wgmt.msg_id,
wgmt.user_id,
wu.user_name,
wgmt.status,
wgmt.send_time
from we_group_message_task wgmt
left join we_user wu on wu.user_id = wgmt.user_id
<where>
<if test="id != null">
and wgmt.id = #{id}
</if>
<if test="msgId != null and msgId != ''">
and wgmt.msg_id = #{msgId}
</if>
<if test="msgTemplateId != null and msgTemplateId != ''">
and wgmt.msg_template_id = #{msgTemplateId}
</if>
<if test="userName != null and userName != ''">
and wu.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null">
and wgmt.status = #{status}
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wgmt.send_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wgmt.send_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>