| | |
| | | <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper"> |
| | | |
| | | <select id="getNumberOfGamesRanked" resultType="map"> |
| | | select * from ( |
| | | select |
| | | aa.participantType, |
| | | aa.participantId, |
| | | aa.num |
| | | from ( |
| | | select |
| | | CASE WHEN participantType = 2 THEN 0 ELSE 1 END as participantType, |
| | | participantId, |
| | |
| | | |
| | | |
| | | <select id="getWorldCupRank" resultType="java.util.Map"> |
| | | select * from ( |
| | | select |
| | | aa.participantType, |
| | | aa.participantId, |
| | | aa.appUserId, |
| | | aa.winRate, |
| | | aa.totalSession |
| | | from ( |
| | | select |
| | | a.participantType, |
| | | a.participantId, |
| | | a.appUserId, |
| | | a.num as totalSession, |
| | | (ifnull(b.num, 0) / a.num * 100) as winRate |
| | | ifnull(a.num, 0) as totalSession, |
| | | (ifnull(b.num, 0) / ifnull(a.num, 0) * 100) as winRate |
| | | from ( |
| | | select |
| | | participantType, |
| | |
| | | from t_world_cup_competitor |
| | | where 1 = 1 |
| | | <if test="null != item.year"> |
| | | and DATE_FORMAT(a.startTime, '%Y') = #{item.year} |
| | | and DATE_FORMAT(startTime, '%Y') = #{item.year} |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | |
| | | from t_world_cup_competitor |
| | | where matchResult = 1 |
| | | <if test="null != item.year"> |
| | | and DATE_FORMAT(a.startTime, '%Y') = #{item.year} |
| | | and DATE_FORMAT(startTime, '%Y') = #{item.year} |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | |
| | | |
| | | |
| | | <select id="worldCupRecordsListCount" resultType="int"> |
| | | select count(*) from { |
| | | select count(*) from ( |
| | | select |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | appUserId |
| | | from t_world_cup_competitor |
| | | where 1 = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | } as aa |
| | | ) as aa |
| | | </select> |
| | | |
| | | |