DrawLotsGroupJudgesMapper.xml
7.29 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?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.zhongzhi.dao.DrawLotsGroupJudgesMapper">
<select id="matchJudges" resultType="com.zhongzhi.vo.drawlots.MatchJudgesVO">
SELECT
t2.id,
t.id mapping_id,
t2.username,
t.expector_type,
t.role_type,
t3.group_name,
t2.telephone,
t2.unit,
t2.position
FROM
draw_lots_group_judges t
LEFT JOIN project_judge t2 ON t.judge_id = t2.id
LEFT JOIN draw_lot_group_dict t3 ON t.group_id = t3.id
WHERE
t.delete_time IS NULL
AND t2.delete_time IS NULL
and t3.delete_time is null
and t.scene_id = #{sceneId}
<if test="userName != null and userName != ''">
and (t2.username like concat('%', #{userName}, '%') or t2.telephone like concat('%', #{userName}, '%') )
</if>
<if test="expectorType != null and expectorType != ''">
and t.expector_type = #{expectorType}
</if>
<if test="roleType != null and roleType != ''">
and t.role_type = #{roleType}
</if>
</select>
<select id="selectJudges" resultType="com.zhongzhi.vo.drawlots.SelectJudgesVO">
SELECT
t2.id,
t2.username,
t2.unit,
t2.position,
t2.telephone
FROM
project_judge t2
WHERE
t2.delete_time IS NULL
<if test="userName != null and userName != ''">
and (t2.username like concat('%', #{userName}, '%') or t2.telephone like concat('%', #{userName}, '%') )
</if>
and t2.id not in (
select judge_id from
draw_lots_group_judges t
where t.delete_time is null
AND t.scene_id = #{sceneId}
)
</select>
<select id="allNum" resultType="java.lang.Integer">
SELECT
t.group_num
FROM
draw_lots_judge_num t
WHERE
t.delete_time IS NULL
AND t.group_id = #{groupId}
</select>
<select id="drawJudgeInfo" resultType="com.zhongzhi.vo.drawlots.DrawJudgeInfoVO">
SELECT
t.role_type,
t.expector_type,
t3.username,
t2.group_num
FROM
draw_lots_judge_num t2
left join draw_lots_group_judges t on t2.group_id = t.group_id and t2.group_num = t.group_num
LEFT JOIN project_judge t3 ON t.judge_id = t3.id
WHERE
t.delete_time IS NULL
AND t2.group_id = #{groupId}
order by t2.group_num
</select>
<select id="currentGroupLeaderCnt" resultType="java.lang.Integer">
SELECT
count( 1 )
FROM
draw_lots_group_judges t
WHERE
t.delete_time IS NULL
AND t.role_type = '组长'
AND t.group_id = #{groupId}
</select>
<select id="noLeaderGroup" resultType="com.zhongzhi.model.DrawLotGroupDictDO">
SELECT
*
FROM
draw_lot_group_dict t
WHERE
t.scene_id = #{sceneId}
AND t.id NOT IN (
SELECT
t.group_id
FROM
draw_lots_group_judges t
WHERE
t.scene_id = #{sceneId}
AND t.role_type = '组长'
and t.group_id is not null
)
</select>
<select id="noMemberGroup" resultType="com.zhongzhi.model.DrawLotGroupDictDO">
SELECT
*
FROM
(
SELECT
t.id,
t.group_name,
ifnull( t2.cnt, 0 ) cnt,
t.teach_cnt,
t.field_cnt
FROM
draw_lot_group_dict t
LEFT JOIN (
SELECT
t.scene_id,
t.group_id,
count( 1 ) cnt
FROM
draw_lots_group_judges t
WHERE
t.delete_time IS NULL
AND t.scene_id = #{sceneId}
AND t.expector_type = #{teachType}
GROUP BY
t.scene_id,
t.group_id,
t.expector_type
) t2 ON t.id = t2.group_id
where t.scene_id = #{sceneId}
) t
WHERE
1 = 1
<if test="teachType == '教育专家'">
AND t.teach_cnt > t.cnt
</if>
<if test="teachType == '行业专家'">
AND t.field_cnt > t.cnt
</if>
</select>
<select id="login" resultType="com.zhongzhi.vo.drawlots.LoginVO">
SELECT
*
FROM
(
SELECT
concat( t2.group_name, '', t.group_num ) NAME,
t2.group_name,
t.group_id,
t.group_num,
t2.scene_id
FROM
draw_lots_judge_num t
LEFT JOIN draw_lot_group_dict t2 ON t.group_id = t2.id
WHERE
t.delete_time IS NULL
AND t2.delete_time IS NULL
) t
WHERE
t.NAME = #{name}
</select>
<select id="judgeScoreScreen" resultType="com.zhongzhi.vo.drawlots.ScoreScreenVO">
SELECT
t.judge_id,
t2.score,
t2.submit_status
FROM
draw_lots_group_judges t
LEFT JOIN (
SELECT
t.judge_id,
t.score,
t.submit_status
FROM
draw_lots_scores t
LEFT JOIN draw_lots_group_items t2 ON t.scene_id = t2.scene_id
AND t.group_id = t2.group_id
AND t.project_id = t2.project_id
LEFT JOIN draw_lot_group_dict t3 ON t.group_id = t3.id
WHERE
t.delete_time IS NULL
AND t.group_id = #{groupId}
AND t2.group_num = #{groupNum}
and t.submit_status in ('已提交','弃权')
ORDER BY
t2.group_num
) t2 ON t.judge_id = t2.judge_id
WHERE
t.delete_time IS NULL
AND t.group_id = #{groupId}
</select>
<select id="existNum" resultType="java.lang.Integer">
SELECT
t.group_num
FROM
draw_lots_group_judges t
WHERE
t.delete_time IS NULL
AND t.group_id = #{groupId}
</select>
<select id="judgeInfo" resultType="com.zhongzhi.vo.drawlots.JudgeFullInfoVO">
SELECT
t.judge_id,
t2.username,
t.group_num,
t3.group_name,
t.expector_type,
t.role_type
FROM
draw_lots_group_judges t
LEFT JOIN project_judge t2 ON t.judge_id = t2.id
LEFT JOIN draw_lot_group_dict t3 ON t.group_id = t3.id
WHERE
t.delete_time IS NULL
AND t2.delete_time IS NULL
AND t.group_num = #{groupNum}
AND t.group_id = #{groupId}
</select>
</mapper>