GroupMemberMappingMapper.xml
1.3 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
<?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.subsidy.mapper.GroupMemberMappingMapper">
<select id="parentCnt" parameterType="long" resultType="com.subsidy.vo.labor.AllGroupsVO">
SELECT
t.id,
t.group_name,
count( t2.id ) cnt
FROM
labor_group_dict t
LEFT JOIN group_member_mapping t2 ON t.id = t2.group_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.parent_id IS NULL
AND t.labor_id = #{laborId}
GROUP BY
t.id,
t.group_name
</select>
<select id="childCnt" parameterType="long" resultType="com.subsidy.vo.labor.AllGroupsVO">
SELECT
t.id,
t.group_name,
count( t2.member_id ) cnt
FROM
labor_group_dict t
LEFT JOIN group_member_mapping t2 ON t.id = t2.group_id AND t2.delete_date IS NULL
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.parent_id IS NOT NULL
AND t.labor_id = #{laborId}
GROUP BY
t.id,
t.group_name
</select>
</mapper>