LaborServiceDictMapper.xml
4.62 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?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.LaborServiceDictMapper">
<select id="getPermissions" resultType="com.subsidy.vo.administer.PermissionsVO">
SELECT DISTINCT
t4.*
FROM
role_administer_mapping t
LEFT JOIN role_dict t2 ON t.role_id = t2.id
LEFT JOIN role_permission_mapping t3 ON t2.id = t3.role_id
LEFT JOIN permissions_dict t4 ON t3.permission_id = t4.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
<if test="id !=null and id !=''">
and t.administer_id = #{id}
</if>
</select>
<select id="projects" parameterType="long" resultType="com.subsidy.vo.labor.ProjectsVO">
SELECT
t.id,
t.project_name,
t2.id as companyId,
t2.company_name,
t5.id as laborId,
t5.labor_service_name,
t.salary_date,
t.start_date,
t.end_date,
count(distinct t3.member_id) AS cnt
FROM
project t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
LEFT JOIN project_member_mapping t3 ON t.id = t3.project_id and t3.status = 1
LEFT JOIN labor_service_dict t5 ON t.labor_service_id = t5.id
WHERE
t.delete_date IS NULL
and t2.delete_date is null
and t3.delete_date is null
and t5.delete_date is null
<if test="laborId != null and laborId != ''">
AND t.labor_service_id = #{laborId}
</if>
<if test="projectName != null and projectName != ''">
and t.project_name like concat('%', #{projectName},'%')
</if>
GROUP BY
t.id,
t2.id,
t.project_name,
t2.company_name,
t5.labor_service_name,
t.start_date,
t.end_date
</select>
<select id="projectManage" resultType="com.subsidy.vo.labor.ProjectManageVO">
SELECT
t2.id,
t.id as mappingId,
t2.user_name,
t2.gender,
t2.telephone,
t2.id_card,
t2.email,
t2.payroll_account,
t2.bank,
t2.open_id,
t.job_name,
if( t2.open_id IS NULL, '未绑定', '已绑定' ) AS wechatStatus
FROM
project_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.project_id = #{projectId}
and t.status = 1
<if test="userInfo != null and userInfo != ''">
and (t2.user_name like concat('%', #{userInfo},'%') or t2.telephone like concat('%', #{userInfo},'%'))
</if>
</select>
<select id="abnormalRecord" resultType="com.subsidy.vo.labor.AbnormalRecordVO">
SELECT
t2.id,
t2.user_name,
t2.gender,
t2.telephone,
t2.id_card,
t2.payroll_account,
t2.bank,
IF
( t2.open_id IS NULL, '是', '否' ) AS wechatStatus,
IF
( t.`status` = 1, '入职', '入职' ) fireStatus,
t.create_date AS hireTime
FROM
project_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
WHERE
t.project_id = #{projectId}
AND t.delete_date IS NULL
AND t2.delete_date IS NULL
<if test="userInfo != null and userInfo != ''">
and (t2.user_name like concat('%', #{userInfo},'%') or t2.telephone like concat('%', #{userInfo},'%'))
</if>
UNION ALL
SELECT
t2.id,
t2.user_name,
t2.gender,
t2.telephone,
t2.id_card,
t2.payroll_account,
t2.bank,
IF
( t2.open_id IS NULL, '是', '否' ) AS wechatStatus,
IF
( t.`status` = 1, '入职', '离职' ) fireStatus,
t.update_date AS hireTime
FROM
project_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
WHERE
t.project_id = #{projectId}
AND t.delete_date IS NULL
AND t.`status` = 0
AND t2.delete_date IS NULL
<if test="userInfo != null and userInfo != ''">
and (t2.user_name like concat('%', #{userInfo},'%') or t2.telephone like concat('%', #{userInfo},'%'))
</if>
ORDER BY
hireTime
</select>
</mapper>