44323
2024-03-08 51f34c714fc3c7a4551d349a918e7ce8fa7f63c2
cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -3,7 +3,11 @@
<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,
@@ -40,13 +44,19 @@
    <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,
@@ -56,7 +66,7 @@
                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
@@ -75,7 +85,7 @@
                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
@@ -143,11 +153,11 @@
    <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">
@@ -157,7 +167,7 @@
                </foreach>
            </if>
            group by participantType, participantId, appUserId
        } as aa
        ) as aa
    </select>