DrawLotsGroupJudgesMapper.xml
3.73 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
<?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.DrawLotsGroupJudgesMapper">
<update id="clearGroup">
update draw_lots_group_judges set group_id = null where judge_id = #{judgeId}
</update>
<update id="setGroup">
update draw_lots_group_judges set group_id = #{groupId} where judge_id = #{judgeId}
</update>
<select id="matchJudges" resultType="com.subsidy.vo.group.MatchJudgesVO">
SELECT
t2.id,
t2.username,
t2.account_name,
t2.`password`,
t2.unit,
t2.position
FROM
project_judge t2
WHERE
t2.delete_date IS NULL
<if test="userName != null and userName != ''">
and (t2.username like concat('%', #{userName}, '%') or t2.telephone like concat('%', #{userName}, '%') )
</if>
</select>
<select id="selectJudges" resultType="com.subsidy.vo.group.SelectJudgesVO">
SELECT
t2.id,
t2.username,
t2.unit,
t2.position,
t2.telephone
FROM
project_judge t2
WHERE
t2.delete_date 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_date is null
AND t.scene_id = #{sceneId}
)
</select>
<select id="judgeScoreScreen" resultType="com.subsidy.vo.group.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.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_date IS NULL
and t2.delete_date is null
AND t.group_id = #{groupId}
AND t2.project_id = #{groupNum}
and t.submit_status in ('已提交','弃权')
ORDER BY
t2.group_num
) t2 ON t.judge_id = t2.judge_id
WHERE
t.delete_date IS NULL
AND t.group_id = #{groupId}
</select>
<select id="judgeScenes" resultType="com.subsidy.model.DrawLotsScenesDO">
SELECT
distinct t2.*
FROM
draw_lots_group_judges t
LEFT JOIN draw_lots_scenes t2 ON t.scene_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t2.id is not null
AND t.judge_id = #{judgeId}
</select>
<select id="judgeGroups" resultType="com.subsidy.model.DrawLotGroupDictDO">
SELECT
t2.*
FROM
draw_lots_group_judges t
LEFT JOIN draw_lot_group_dict t2 ON t.group_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t2.id is not null
AND t.judge_id = #{judgeId}
and t.scene_id = #{sceneId}
</select>
<select id="judgeCnt" resultType="java.lang.Integer">
SELECT
count(
DISTINCT ( t.judge_id ))
FROM
draw_lots_group_judges t
WHERE
t.scene_id = #{sceneId}
AND t.delete_date IS NULL
</select>
</mapper>