WeGroupSopMapper.xml
3.53 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
103
<?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.WeGroupSopMapper">
<resultMap id="WeGroupSopResult" type="WeGroupSopVo">
<result property="ruleId" column="rule_id" />
<result property="ruleName" column="rule_name" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="startExeTime" column="start_time" />
<result property="stopExeTime" column="end_time" />
<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>
<sql id="selectGroupVo">
SELECT
rule_id,
rule_name,
title,
content,
start_time,
end_time,
create_by,
create_time,
update_by,
update_time
FROM
we_group_sop
</sql>
<select id="getGroupSopById" resultMap="WeGroupSopResult">
<include refid="selectGroupVo" />
WHERE rule_id = #{ruleId} AND del_flag = 0
</select>
<select id="getGroupSopList" resultMap="WeGroupSopResult">
<include refid="selectGroupVo" />
<where>
del_flag = 0
<if test="ruleName != null and ruleName!=''">
AND rule_name LIKE CONCAT("%",#{ruleName},"%")
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
</if>
<if test="createBy!=null and createBy!=''">
AND create_by LIKE CONCAT("%",#{createBy},"%")
</if>
</where>
order by create_time DESC
</select>
<select id="getChatIdListByRuleId" resultType="String">
SELECT
wg.chat_id
FROM
we_group_sop wgs
LEFT JOIN we_group_sop_chat wgsc ON wgs.rule_id = wgsc.rule_id
LEFT JOIN we_group wg ON wg.chat_id = wgsc.chat_id
WHERE wgs.rule_id = #{ruleId}
</select>
<select id="getMaterialIdListByRuleId" resultType="Long">
SELECT
wm.id
FROM
we_group_sop wgs
LEFT JOIN we_group_sop_material wgsm ON wgs.rule_id = wgsm.rule_id
LEFT JOIN we_material wm ON wm.id = wgsm.material_id
WHERE wgs.rule_id = #{ruleId}
</select>
<select id="getEmplTaskList" resultMap="WeGroupSopResult">
SELECT
wgs.rule_id,
wgs.rule_name,
wgs.title,
wgs.content,
wgs.start_time,
wgs.end_time,
wgs.create_by,
wgs.create_time,
wgs.update_by,
wgs.update_time
FROM
we_user wu
LEFT JOIN we_group wg ON wu.user_id = wg.`owner`
LEFT JOIN we_group_sop_chat wgsc ON wg.chat_id = wgsc.chat_id
LEFT JOIN we_group_sop wgs ON wgs.rule_id = wgsc.rule_id
WHERE
wu.user_id = #{emplId} AND wgsc.is_done = #{isDone}
</select>
</mapper>