|
@ -405,64 +405,61 @@ |
|
|
</select> |
|
|
</select> |
|
|
<select id="getJoinRuleTeamNumByType" resultMap="teamNum1"> |
|
|
<select id="getJoinRuleTeamNumByType" resultMap="teamNum1"> |
|
|
SELECT |
|
|
SELECT |
|
|
|
|
|
g.id as groupId, |
|
|
|
|
|
g.group_name, |
|
|
|
|
|
g.projectId, |
|
|
|
|
|
g.`projectName`, |
|
|
|
|
|
g.`certificate`, |
|
|
|
|
|
g.`team`, |
|
|
|
|
|
g.`joinRule`, |
|
|
|
|
|
if(count(t.teamId) = 0,'/',count(t.teamId)) as aNum |
|
|
|
|
|
FROM |
|
|
|
|
|
( |
|
|
|
|
|
SELECT |
|
|
|
|
|
gr.*, |
|
|
p.id as projectId, |
|
|
p.id as projectId, |
|
|
p.`name` as projectName, |
|
|
p.`name` as projectName, |
|
|
p.certificate as certificate, |
|
|
p.certificate as certificate, |
|
|
a.groupId as groupId, |
|
|
|
|
|
a.aNum as aNum, |
|
|
|
|
|
p.team as team, |
|
|
p.team as team, |
|
|
p.join_rule as joinRule |
|
|
p.join_rule as joinRule |
|
|
FROM |
|
|
FROM |
|
|
t_compete_project p |
|
|
t_compete_project p , |
|
|
LEFT JOIN( |
|
|
t_compete_group gr |
|
|
SELECT |
|
|
|
|
|
g.id as groupId, |
|
|
|
|
|
g.group_name as groupName, |
|
|
|
|
|
g.sequence as sequence, |
|
|
|
|
|
t.projectId, |
|
|
|
|
|
if(t.num is null,'/',t.num) as aNum |
|
|
|
|
|
FROM |
|
|
|
|
|
t_compete_group g |
|
|
|
|
|
LEFT JOIN |
|
|
|
|
|
( |
|
|
|
|
|
SELECT |
|
|
|
|
|
g.id as gid, |
|
|
|
|
|
g.group_name, |
|
|
|
|
|
count(t.teamId) as num, |
|
|
|
|
|
t.projectId as projectId |
|
|
|
|
|
FROM |
|
|
|
|
|
t_compete_group g |
|
|
|
|
|
LEFT JOIN |
|
|
|
|
|
( |
|
|
|
|
|
SELECT |
|
|
|
|
|
t.id as teamId, |
|
|
|
|
|
t.project_id as projectId, |
|
|
|
|
|
t.gender_group, |
|
|
|
|
|
t.group_remark |
|
|
|
|
|
FROM |
|
|
|
|
|
t_compete_team t |
|
|
|
|
|
LEFT JOIN t_compete_company c on t.company_id = c.id |
|
|
|
|
|
WHERE |
|
|
|
|
|
(t.rec_status = 0 or t.rec_status is null) |
|
|
|
|
|
and (c.rec_status = 0 or c.rec_status is null) |
|
|
|
|
|
)t on ((t.gender_group = g.sex and t.group_remark = g.group_remark) or t.teamId is null) |
|
|
|
|
|
WHERE |
|
|
|
|
|
g.type = 0 |
|
|
|
|
|
and g.rec_status = 0 |
|
|
|
|
|
GROUP BY g.id,t.projectId |
|
|
|
|
|
ORDER BY g.sequence |
|
|
|
|
|
)t |
|
|
|
|
|
on (t.gid = g.id or t.gid is null) |
|
|
|
|
|
WHERE |
|
|
|
|
|
g.type = 0 |
|
|
|
|
|
and g.rec_status = 0 |
|
|
|
|
|
)a on (p.id = a.projectId or a.projectId is null) |
|
|
|
|
|
WHERE |
|
|
WHERE |
|
|
p.type = #{type} |
|
|
p.type = 0 |
|
|
|
|
|
and gr.type = 0 |
|
|
and p.team = 1 |
|
|
and p.team = 1 |
|
|
and p.`level` = 2 |
|
|
and p.`level` = 2 |
|
|
and p.join_rule = 0 |
|
|
and p.join_rule = 0 |
|
|
and p.rec_status = 0 |
|
|
and p.rec_status = 0 |
|
|
ORDER BY p.id,a.sequence |
|
|
and gr.rec_status = 0 |
|
|
|
|
|
)g |
|
|
|
|
|
left join |
|
|
|
|
|
( |
|
|
|
|
|
SELECT |
|
|
|
|
|
t.id as teamId, |
|
|
|
|
|
t.project_id as projectId, |
|
|
|
|
|
t.gender_group, |
|
|
|
|
|
t.group_remark |
|
|
|
|
|
FROM |
|
|
|
|
|
t_compete_team t |
|
|
|
|
|
LEFT JOIN t_compete_company c on t.company_id = c.id |
|
|
|
|
|
LEFT JOIN t_compete_project p on t.project_id = p.id |
|
|
|
|
|
WHERE |
|
|
|
|
|
t.rec_status = 0 |
|
|
|
|
|
and p.type = 0 |
|
|
|
|
|
and p.team = 1 |
|
|
|
|
|
and p.`level` = 2 |
|
|
|
|
|
and p.join_rule = 0 |
|
|
|
|
|
and p.rec_status = 0 |
|
|
|
|
|
and c.rec_status = 0 |
|
|
|
|
|
)t on t.gender_group = g.sex |
|
|
|
|
|
and t.group_remark = g.group_remark |
|
|
|
|
|
and t.projectId = g.projectId |
|
|
|
|
|
WHERE |
|
|
|
|
|
g.type = 0 |
|
|
|
|
|
and g.rec_status = 0 |
|
|
|
|
|
GROUP BY g.projectId,g.id |
|
|
|
|
|
ORDER BY g.projectId,g.sequence |
|
|
</select> |
|
|
</select> |
|
|
</mapper> |
|
|
</mapper> |