DrawLotsScoresMapper.xml
5.36 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
<?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.DrawLotsScoresMapper">
<select id="groupScores" resultType="com.zhongzhi.vo.drawlots.GroupScoresVO">
SELECT
t2.id,
t2.project_name,
t2.college,
t3.id as groupId,
t.group_num,
t3.group_name
FROM
draw_lots_group_items t
LEFT JOIN project t2 ON t.project_id = t2.id
left join draw_lot_group_dict t3 on t.group_id = t3.id
WHERE
t.delete_time IS NULL
<if test="projectName != null and projectName != ''">
AND t2.project_name like concat('%', #{projectName}, '%')
</if>
and t.scene_id = #{sceneId}
<if test="groupId != null and groupId != ''">
and t.group_id = #{groupId}
</if>
</select>
<select id="groupJudgeScores" resultType="com.zhongzhi.vo.drawlots.GroupJudgeScoresVO">
SELECT
t2.id,
t2.username,
t3.expector_type,
t3.role_type,
t.score
FROM
draw_lots_scores t
left join project_judge t2 on t.judge_id = t2.id
left join draw_lots_group_judges t3 on t.scene_id = t3.scene_id and t.judge_id = t3.judge_id
WHERE
t.submit_status in ('已提交','弃权')
and t.group_id = #{groupId}
and t.project_id = #{projectId}
</select>
<select id="queryItems" resultType="com.zhongzhi.vo.drawlots.QueryItemsVO">
SELECT
t4.id,
t2.group_name,
t3.group_num,
t4.project_name,
t5.submit_status,
t5.score
FROM
draw_lots_group_judges t
LEFT JOIN draw_lot_group_dict t2 ON t.group_id = t2.id
LEFT JOIN draw_lots_group_items t3 ON t.group_id = t3.group_id
LEFT JOIN project t4 ON t3.project_id = t4.id
LEFT JOIN draw_lots_scores t5 ON t.judge_id = t5.judge_id
AND t.group_id = t5.group_id and t3.project_id = t5.project_id
WHERE
t.delete_time IS NULL
AND t.judge_id = #{judgeId}
order by t3.group_num
</select>
<select id="groupRank" resultType="com.zhongzhi.vo.drawlots.GroupRankVO">
SELECT
t.id,
t2.project_name,
t2.college,
t3.group_name,
t.group_num,
t.total_score
FROM
draw_lots_group_items t
LEFT JOIN project t2 ON t.project_id = t2.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}
ORDER BY
t.total_score desc
</select>
<select id="hand4Project" resultType="com.zhongzhi.model.DrawLotsGroupItemsDO">
SELECT
t.id,
t2.project_name,
t2.college,
t3.group_name,
t.order_no,
t.group_num
FROM
draw_lots_group_items t
LEFT JOIN project t2 ON t.project_id = t2.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}
ORDER BY
t.total_score desc
LIMIT 4
</select>
<select id="beforeHand4Project" resultType="com.zhongzhi.vo.drawlots.RankListVO">
SELECT
t.id,
t2.project_name,
t2.college,
t3.group_name,
t.order_no,
t.group_num
FROM
draw_lots_group_items t
LEFT JOIN project t2 ON t.project_id = t2.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}
ORDER BY
t.total_score
LIMIT 4
</select>
<select id="groupLeader" resultType="java.lang.String">
SELECT
t2.username
FROM
draw_lots_group_judges t
left join project_judge t2 on t.judge_id = t2.id
WHERE
t.delete_time IS NULL
AND t.group_id = #{groupId}
and t.role_type = '组长'
</select>
<select id="rank" resultType="com.zhongzhi.vo.drawlots.RankListVO">
SELECT
t.id,
t3.project_name,
t3.college,
t2.group_name,
t.group_num,
t.order_no,
t5.username leader
FROM
draw_lots_group_items t
LEFT JOIN draw_lot_group_dict t2 ON t.group_id = t2.id
LEFT JOIN project t3 ON t.project_id = t3.id
LEFT JOIN draw_lots_group_judges t4 ON t.group_id = t4.group_id
AND t4.role_type = '组长'
LEFT JOIN project_judge t5 ON t4.judge_id = t5.id
WHERE
t.delete_time IS NULL
AND t.scene_id = #{sceneId}
<if test="groupId != null and groupId != ''">
AND t.group_id = #{groupId}
</if>
<if test="projectName != null and projectName != ''">
AND t.project_name LIKE like concat('%', #{projectName}, '%')
</if>
order by t.order_no
</select>
</mapper>