WeGroupSopChatMapper.xml
1.57 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
<?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.WeGroupSopChatMapper">
<resultMap type="WeCommunityTaskEmplVo" id="WeEmplVoResult">
<result property="userId" column="user_id"/>
<result property="name" column="user_name"/>
<result property="avatar" column="head_image_url"/>
<result property="isDone" column="is_done"/>
</resultMap>
<select id="getScopeListByRuleId" parameterType="Long" resultMap="WeEmplVoResult">
SELECT
wu.user_id,
wu.user_name,
wu.head_image_url,
wgsc.is_done
FROM
we_group_sop_chat wgsc
LEFT JOIN we_group_sop wgs ON wgsc.rule_id = wgs.rule_id
LEFT JOIN we_group wg ON wg.chat_id = wgsc.chat_id
LEFT JOIN we_user wu ON wu.user_id = wg.`owner`
WHERE
wgsc.rule_id = #{ruleId}
</select>
<insert id="batchBindsSopChat">
insert into we_group_sop_chat(rule_id, chat_id, is_done) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.ruleId},#{item.chatId}, #{item.isDone})
</foreach>
</insert>
<update id="updateChatSopStatus">
update we_group_sop_chat wgsc
inner join we_group wg on wgsc.chat_id = wg.chat_id
set wgsc.is_done = TRUE
where wgsc.rule_id = #{ruleId}
and wg.owner = #{emplId}
</update>
</mapper>