| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?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="org.dromara.system.mapper.app.ToClientMapper">
- <select id="selectScoreSheetMetadata" resultType="org.dromara.system.domain.vo.ScoreSheetVo">
- SELECT
- e.event_name as eventName,
- p.score_rule as scoreRule,
- p.project_name as projectName,
- p.project_type as projectType,
- p.classification as classification,
- p.gender as gender,
- p.rg_name as rgName,
- p.game_stage as gameStage,
- p.game_round as gameRound,
- DATE_FORMAT(p.start_time, '%Y-%m-%d %H:%i:%s') as startTime,
- (SELECT GROUP_CONCAT(name SEPARATOR ',') FROM game_referee WHERE del_flag = '0'
- AND event_id = p.event_id
- AND (JSON_CONTAINS(p.referee_group, JSON_ARRAY(referee_id))
- OR JSON_CONTAINS(p.referee_group, JSON_ARRAY(CAST(referee_id AS CHAR))))
- ) as refereeName,
- p.timing_format as timingFormat,
- (SELECT config_value FROM game_event_config WHERE event_id = p.event_id
- AND config_key = 'event_tip' AND del_flag = '0' LIMIT 1) as eventTip,
- IFNULL((SELECT COUNT(*) FROM game_athlete a WHERE a.event_id = p.event_id AND a.del_flag = '0'
- AND (JSON_CONTAINS(a.project_value, JSON_ARRAY(p.project_id))
- OR JSON_CONTAINS(a.project_value, JSON_ARRAY(CAST(p.project_id AS CHAR)))))
- , 0) as totalParticipants,
- IFNULL((SELECT COUNT(*)
- FROM game_score s
- JOIN game_athlete a ON s.athlete_id = a.athlete_id AND a.del_flag = '0'
- WHERE s.project_id = p.project_id AND s.del_flag = '0'
- AND ((p.classification = '0' AND s.individual_performance > 0) OR (p.classification = '1' AND s.team_performance > 0))
- )
- , 0) as finishedParticipants
- FROM game_event_project p
- JOIN game_event e ON p.event_id = e.event_id
- WHERE p.event_id = #{eventId} AND p.project_id = #{projectId} AND p.del_flag = '0'
- </select>
- <select id="selectScoreSheetItems" resultType="org.dromara.system.domain.vo.ScoreSheetItemVo">
- SELECT
- a.athlete_id as athleteId,
- a.team_id as teamId,
- a.athlete_code as athleteCode,
- a.name as name,
- t.team_name as teamName,
- a.track_index as trackIndex,
- s.score_id as scoreId,
- CASE
- WHEN p.classification = '0' THEN s.individual_performance
- ELSE s.team_performance
- END as score,
- s.fault_a as faultA,
- s.fault_b as faultB
- FROM game_athlete a
- LEFT JOIN game_team t ON a.team_id = t.team_id AND t.del_flag = '0'
- CROSS JOIN game_event_project p ON p.project_id = #{projectId}
- LEFT JOIN game_score s ON a.athlete_id = s.athlete_id AND s.project_id = #{projectId} AND s.del_flag = '0'
- WHERE a.event_id = #{eventId}
- AND a.del_flag = '0'
- AND (JSON_CONTAINS(a.project_value, JSON_ARRAY(#{projectId}))
- OR JSON_CONTAINS(a.project_value, JSON_ARRAY(CAST(#{projectId} AS CHAR))))
- ORDER BY a.track_index ASC, a.athlete_code ASC
- </select>
- <select id="selectScorePreviewList" resultType="org.dromara.system.domain.vo.ScorePreviewVo">
- SELECT
- s.score_id as scoreId,
- s.athlete_id as athleteId,
- s.team_id as teamId,
- a.athlete_code as athleteCode,
- a.name as name,
- t.team_name as teamName,
- CASE
- WHEN p.classification = '0' THEN CAST(s.individual_performance AS CHAR)
- ELSE CAST(s.team_performance AS CHAR)
- END as score,
- s.score_point as scorePoint,
- s.score_rank as scoreRank
- FROM game_score s
- LEFT JOIN game_athlete a ON s.athlete_id = a.athlete_id AND a.del_flag = '0'
- LEFT JOIN game_team t ON s.team_id = t.team_id AND t.del_flag = '0'
- JOIN game_event_project p ON s.project_id = p.project_id
- WHERE s.project_id = #{projectId} AND s.del_flag = '0'
- ORDER BY s.score_rank ASC, s.score_id DESC
- </select>
- </mapper>
|