@ -245,7 +245,6 @@
t1.group_name AS groupName,
t1.name,
count( t2.id ) as count
-- GROUP_CONCAT( t1.NAME ) AS eightNames
FROM
(
SELECT
@ -311,8 +310,422 @@
) t
GROUP BY groupName
</select>
<select id= "queryEightFancyRope" resultType= "com.ccsens.mt.bean.vo.CompeteExcelVo$BeforeEight" >
select t1.group_name as groupName, GROUP_CONCAT(t1.name) as eightNames from
<select id= "queryEightGroupLimit" resultType= "com.ccsens.mt.bean.vo.CompeteExcelVo$BeforeEight" >
select t.group_name as groupName, GROUP_CONCAT(t.name order by t.final_score desc) as eightNames from
(select t1.* from
(SELECT
CONCAT(
CASE team.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE team.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS group_name,
GROUP_CONCAT(player.name SEPARATOR '、') as name,
score.final_score
FROM
t_compete_count_score score,
t_compete_start_order startOrder,
t_compete_team team,
t_compete_team_member tm,
t_compete_player player
WHERE
score.compete_time_id = #{competeTimeId}
AND score.project_id = #{projectId}
AND score.site_order_id = startOrder.id
AND startOrder.player_id = team.id
AND team.id = tm.compete_team_id
AND tm.player_id = player.id
AND score.rec_status = 0
AND player.rec_status = 0
AND startOrder.rec_status = 0
AND team.rec_status = 0
AND tm.rec_status = 0
group by score.id) t1,
(SELECT
CONCAT(
CASE team.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE team.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS group_name,
GROUP_CONCAT(player.name) as name,
score.final_score
FROM
t_compete_count_score score,
t_compete_start_order startOrder,
t_compete_team team,
t_compete_team_member tm,
t_compete_player player
WHERE
score.compete_time_id = #{competeTimeId}
AND score.project_id = #{projectId}
AND score.site_order_id = startOrder.id
AND startOrder.player_id = team.id
AND team.id = tm.compete_team_id
AND tm.player_id = player.id
AND score.rec_status = 0
AND player.rec_status = 0
AND startOrder.rec_status = 0
AND team.rec_status = 0
AND tm.rec_status = 0
group by score.id) t2
WHERE
t1.group_name = t2.group_name
AND t1.final_score < = t2.final_score
GROUP BY t1.group_name, t1.name
HAVING count( * ) < = 8) t
group by t.group_name
</select>
<select id= "queryEightGroupNotLimit" resultType= "com.ccsens.mt.bean.vo.CompeteExcelVo$BeforeEight" >
SELECT
team.group_name as groupName,
team.members as eightNames
FROM
(
SELECT
id,
site_order_id,
sum(
CASE CODE
WHEN 'setUp' THEN score / 3
WHEN 'show' THEN score / 3
WHEN 'spaceUse' THEN score / 3
WHEN 'accuracy' THEN score / 3
WHEN 'step' THEN score / 3
WHEN 'perfor' THEN score / 3
WHEN 'skilled' THEN score / 3
WHEN 'agree' THEN score / 3
WHEN 'notEnoughTime' THEN -score
WHEN 'footfault' THEN -score
WHEN 'ceremony' THEN -score
ELSE -score END
) AS final_score
FROM
t_compete_variety_score
WHERE
compete_time_id = #{competeTimeId}
AND project_id = #{projectId}
AND rec_status = 0
GROUP BY
site_order_id
) t,
t_compete_start_order o,
(SELECT
t.id,
CONCAT(
CASE t.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE t.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS group_name,
GROUP_CONCAT( p.NAME separator '、' ) as members
FROM
t_compete_team t,
t_compete_team_member m,
t_compete_player p
WHERE
t.id = m.compete_team_id
AND m.player_id = p.id
AND m.rec_status = 0
AND t.rec_status = 0
AND p.rec_status = 0
GROUP BY
t.id,
t.group_remark,
t.gender_group) team
WHERE
t.site_order_id = o.id
AND o.player_id = team.id
AND o.rec_status = 0
order by t. final_score desc
limit 8
</select>
<select id= "queryEightVarietyGroupLimit" resultType= "com.ccsens.mt.bean.vo.CompeteExcelVo$BeforeEight" >
select t1.groupName, GROUP_CONCAT(t1.eightNames order by t1.final_score desc) from
(SELECT
team.group_name as groupName,
team.members as eightNames,
t.final_score
FROM
(
SELECT
id,
site_order_id,
sum(
CASE CODE
WHEN 'setUp' THEN score / 3
WHEN 'show' THEN score / 3
WHEN 'spaceUse' THEN score / 3
WHEN 'accuracy' THEN score / 3
WHEN 'step' THEN score / 3
WHEN 'perfor' THEN score / 3
WHEN 'skilled' THEN score / 3
WHEN 'agree' THEN score / 3
WHEN 'notEnoughTime' THEN -score
WHEN 'footfault' THEN -score
WHEN 'ceremony' THEN -score
ELSE -score END
) AS final_score
FROM
t_compete_variety_score
WHERE
compete_time_id = #{competeTimeId}
AND project_id = #{projectId}
AND rec_status = 0
GROUP BY
site_order_id
) t,
t_compete_start_order o,
(SELECT
t.id,
CONCAT(
CASE t.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE t.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS group_name,
GROUP_CONCAT( p.NAME separator '、' ) as members
FROM
t_compete_team t,
t_compete_team_member m,
t_compete_player p
WHERE
t.id = m.compete_team_id
AND m.player_id = p.id
AND m.rec_status = 0
AND t.rec_status = 0
AND p.rec_status = 0
GROUP BY
t.id,
t.group_remark,
t.gender_group) team
WHERE
t.site_order_id = o.id
AND o.player_id = team.id
AND o.rec_status = 0
) t1,
(SELECT
team.group_name as groupName,
team.members as eightNames,
t.final_score
FROM
(
SELECT
id,
site_order_id,
sum(
CASE CODE
WHEN 'setUp' THEN score / 3
WHEN 'show' THEN score / 3
WHEN 'spaceUse' THEN score / 3
WHEN 'accuracy' THEN score / 3
WHEN 'step' THEN score / 3
WHEN 'perfor' THEN score / 3
WHEN 'skilled' THEN score / 3
WHEN 'agree' THEN score / 3
WHEN 'notEnoughTime' THEN -score
WHEN 'footfault' THEN -score
WHEN 'ceremony' THEN -score
ELSE -score END
) AS final_score
FROM
t_compete_variety_score
WHERE
compete_time_id = #{competeTimeId}
AND project_id = #{projectId}
AND rec_status = 0
GROUP BY
site_order_id
) t,
t_compete_start_order o,
(SELECT
t.id,
CONCAT(
CASE t.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE t.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS group_name,
GROUP_CONCAT( p.NAME separator '、' ) as members
FROM
t_compete_team t,
t_compete_team_member m,
t_compete_player p
WHERE
t.id = m.compete_team_id
AND m.player_id = p.id
AND m.rec_status = 0
AND t.rec_status = 0
AND p.rec_status = 0
GROUP BY
t.id,
t.group_remark,
t.gender_group) team
WHERE
t.site_order_id = o.id
AND o.player_id = team.id
AND o.rec_status = 0
) t2
where t1.groupName = t2.groupName and t1.final_score < = t2.final_score
group by t1.groupName
having count(t2.groupName) < = 8
</select>
<select id= "queryCountScoreTeam" resultType= "com.ccsens.mt.bean.vo.ScoreVo$CountScorePublicity" >
select t1.*, count(*) as rangee from
(SELECT
CONCAT(
CASE team.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE team.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS groupName,
GROUP_CONCAT(player.name SEPARATOR '、') as name,
company.name as companyName,
score.judgment_a_score as mainOneScore,
score.judgment_b_score2 as mainTwoScore,
score.should_times as shouldScore,
score.deduct_times as deductTime,
score.final_score as finalScore
FROM
t_compete_count_score score,
t_compete_start_order startOrder,
t_compete_team team,
t_compete_team_member tm,
t_compete_player player,
t_compete_company company
WHERE
score.project_id = #{projectId}
AND score.site_order_id = startOrder.id
AND startOrder.player_id = team.id
AND team.id = tm.compete_team_id
AND tm.player_id = player.id
AND player.company_id = company.id
AND company.rec_status = 0
AND score.rec_status = 0
AND player.rec_status = 0
AND startOrder.rec_status = 0
AND team.rec_status = 0
AND tm.rec_status = 0
group by score.id) t1,
(SELECT
CONCAT(
CASE team.group_remark WHEN 1 THEN '小学' WHEN 2 THEN '中学' WHEN 3 THEN '高职院校' WHEN 4 THEN '本科院校' ELSE '俱乐部'END,
CASE team.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END
) AS groupName,
GROUP_CONCAT(player.name SEPARATOR '、') as name,
company.name as companyName,
score.judgment_a_score as mainOneScore,
score.judgment_b_score2 as mainTwoScore,
score.should_times as shouldScore,
score.deduct_times as deductTime,
score.final_score as finalScore
FROM
t_compete_count_score score,
t_compete_start_order startOrder,
t_compete_team team,
t_compete_team_member tm,
t_compete_player player,
t_compete_company company
WHERE
score.project_id = #{projectId}
AND score.site_order_id = startOrder.id
AND startOrder.player_id = team.id
AND team.id = tm.compete_team_id
AND tm.player_id = player.id
AND player.company_id = company.id
AND company.rec_status = 0
AND score.rec_status = 0
AND player.rec_status = 0
AND startOrder.rec_status = 0
AND team.rec_status = 0
AND tm.rec_status = 0
group by score.id) t2
WHERE
t1.groupName = t2.groupName
AND t1.finalScore < = t2.finalScore
GROUP BY t1.groupName, t1.name
order by rangee desc
</select>
<select id= "queryCountScorePerson" resultType= "com.ccsens.mt.bean.vo.ScoreVo$CountScorePublicity" >
select t1.*, count(t2.id) as rangee from
(SELECT
competeGroup.group_name as groupName,
player.NAME as name,
score.final_score as finalScore,
p.NAME as companyName,
score.id,
score.judgment_a_score as mainOneScore,
score.judgment_b_score2 as mainTwoScore,
score.should_times as shouldScore,
score.deduct_times as deductTime
FROM
t_compete_count_score score,
t_compete_start_order startOrder,
t_compete_project_player pp,
t_compete_player player,
t_compete_group competeGroup,
t_compete_company p
WHERE
score.project_id = #{projectId}
AND score.site_order_id = startOrder.id
AND startOrder.player_id = pp.id
AND pp.player_id = player.id
AND player.compete_group_id = competeGroup.id
and player.company_id = p.id
AND score.rec_status = 0
AND player.rec_status = 0
AND startOrder.rec_status = 0
AND competeGroup.rec_status = 0)t1,
(SELECT
competeGroup.group_name as groupName,
player.NAME as name,
score.final_score as finalScore,
p.NAME as companyName,
score.id,
score.judgment_a_score as mainOneScore,
score.judgment_b_score2 as mainTwoScore,
score.should_times as shouldScore,
score.deduct_times as deductTime
FROM
t_compete_count_score score,
t_compete_start_order startOrder,
t_compete_project_player pp,
t_compete_player player,
t_compete_group competeGroup,
t_compete_company p
WHERE
score.project_id = #{projectId}
AND score.site_order_id = startOrder.id
AND startOrder.player_id = pp.id
AND pp.player_id = player.id
AND player.compete_group_id = competeGroup.id
and player.company_id = p.id
AND score.rec_status = 0
AND player.rec_status = 0
AND startOrder.rec_status = 0
AND competeGroup.rec_status = 0)t2
where t1.groupName = t2.groupName and t1.finalScore < = t2.finalScore
group by t1.id
order by t1.groupName, rangee
</select>
<select id= "queryVarietyScore" resultType= "com.ccsens.mt.bean.vo.CompeteVo$TotalScoreDisplay" >
select s.*, c.name as companyName, GROUP_CONCAT(p.name) as peopleName, (ifnull(s.referee1,0)+ifnull(s.referee2,0)+ifnull(s.referee3,0))/3 as avg1To3,
(ifnull(s.referee4,0)+ifnull(s.referee5,0)+ifnull(s.referee6,0))/3 as avg4To6,
(ifnull(s.referee1,0)+ifnull(s.referee2,0)+ifnull(s.referee3,0))/3 + (ifnull(s.referee4,0)+ifnull(s.referee5,0)+ifnull(s.referee6,0))/3 - s.referee0 as result,
@rownum := @rownum + 1 AS rownum
from
(select site_order_id, max(if(chief_judgment = 0, score, null)) as referee0, max(if(chief_judgment = 1, score, null)) as referee1,
max(if(chief_judgment = 2, score, null)) as referee2, max(if(chief_judgment = 3, score, null)) as referee3,
max(if(chief_judgment = 4, score, null)) as referee4, max(if(chief_judgment = 5, score, null)) as referee5,
max(if(chief_judgment = 6, score, null)) as referee6, max(if(chief_judgment = 7, score, null)) as referee7
from
(select s.site_order_id, j.chief_judgment, sum(s.score) as score from t_compete_variety_score s, t_compete_judgment j where s.judgment_id = j.id and s.project_id = #{projectId} and s.rec_status = 0 and j.rec_status = 0 group by s.site_order_id,j.chief_judgment) t
group by t.site_order_id) s,
t_compete_start_order o,
t_compete_team t,
t_compete_team_member m,
t_compete_player p,
t_compete_company c,
( SELECT @rownum := 0 ) r
where s.site_order_id = o.id and o.player_id = t.id and t.id = m.compete_team_id and m.player_id = p.id and p.company_id = c.id
and o.rec_status = 0 and t.rec_status = 0 and m.rec_status = 0 and p.rec_status = 0 and c.rec_status = 0
group by s.site_order_id
order by result desc
</select>
<!-- <select id="queryEightGroupLimit" resultType="com.ccsens.mt.bean.vo.CompeteExcelVo$BeforeEight">
select t1.group_name as groupName, GROUP_CONCAT(t1.name) as eightNames from
(SELECT
t.id,
CONCAT( team.group_remark, CASE team.gender_group WHEN 0 THEN '女子组' WHEN 1 THEN '男子组' ELSE '混合组' END ) AS group_name,
@ -457,11 +870,10 @@
AND c.rec_status = 0
order by t. final_score
) t2
where t1.final_score < = t2.final_score
where t1.group_name = t2.group_name and t1.final_score < = t2.final_score
GROUP BY t1.group_name
HAVING count(t2.id) < = 8
</select>
</select> -->
</mapper>