puzhibing
2024-03-06 f6d50410b2674c2564be93b3887fff60e5769bd1
cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -159,4 +159,36 @@
            group by participantType, participantId, appUserId
        } as aa
    </select>
    <select id="worldCupGameStatisticsInfoList" resultType="map">
        select * from (
            select
            a.participantType,
            a.participantId,
            a.appUserId,
            a.num as totalSession,
            ifnull(b.num, 0) as win,
            (ifnull(b.num, 0) / a.num * 100) as winRate
            from (
                select
                participantType,
                participantId,
                appUserId,
                count(*) as num
                from t_world_cup_competitor
                where worldCupId = #{worldCupId} group by participantType, participantId, appUserId
            ) as a
            left join (
                select
                participantType,
                participantId,
                appUserId,
                count(*) as num
                from t_world_cup_competitor
                where matchResult = 1 and worldCupId = #{worldCupId} group by participantType, participantId, appUserId
            ) as b on (a.participantId = b.participantId and a.participantType = b.participantType)
        ) as aa order by aa.totalSession desc
    </select>
</mapper>