MemberMapper.xml
4.93 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?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.MemberMapper">
<select id="getMembers" resultType="com.subsidy.vo.member.GetAllVO">
SELECT
t2.id,
t2.user_name,
t2.account_name,
t2.account_name_en,
t2.telephone,
t2.gender,
t2.id_card,
t2.status,
t2.email,
t2.work_no,
t2.induction_date
FROM
member_department_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.member_status = 1
and t.department_id = #{departmentId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
<if test="status != null and status !=''">
and t2.status = #{status}
</if>
<if test="startDate != null and startEndDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</select>
<select id="manageMember" parameterType="string" resultType="com.subsidy.vo.member.ManageMemberVO">
SELECT
t.id,
t.user_name,
t.telephone,
t.id_card,
t.account_name,
t2.company_name,
t.check_image,
t.check_time,
t.first_login
FROM
member t
left join company_member_mapping t5 on t5.member_id = t.id and t5.member_status = 1
LEFT JOIN company_dict t2 ON t5.company_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
<if test="userName != null and userName != ''">
AND t.user_name LIKE concat('%',#{userName} ,'%')
</if>
<if test="companyId != null and companyId != ''">
and t5.company_id = #{companyId}
</if>
</select>
<select id="getMemberWithoutPage" resultType="com.subsidy.model.MemberDO">
SELECT
t2.id,
t2.user_name,
t2.account_name,
t2.account_name_en,
t2.telephone,
t2.gender,
t2.id_card,
t2.status,
t2.email,
t2.work_no,
t2.induction_date
FROM
member_department_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 t2.id IS NOT NULL
and t.department_id = #{departmentId}
and t.member_status = 1
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
<if test="status != null and status !=''">
and t2.status = #{status}
</if>
<if test="startDate != null and startEndDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</select>
<select id="getCompanyMember" resultType="com.subsidy.vo.member.GetAllVO">
SELECT
t2.id,
t2.user_name,
t2.account_name,
t2.account_name_en,
t2.telephone,
t2.gender,
t2.id_card,
t2.status,
t2.email,
t2.work_no,
t2.induction_date
FROM
member t2
left join company_member_mapping t5 on t5.member_id = t2.id and t5.member_status = 1
WHERE
t2.delete_date IS NULL
and t5.company_id = #{companyId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
<if test="status != null and status !=''">
and t2.status = #{status}
</if>
<if test="startDate != null and startEndDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</select>
<select id="getDepartments" parameterType="long" resultType="com.subsidy.model.DepartmentDictDO">
SELECT
t2.id,
t2.department_name,
t2.parent_id
FROM
member_department_mapping t
LEFT JOIN department_dict t2 ON t.department_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t.member_status = 1
AND t.member_id = #{memberId}
</select>
</mapper>