充值排行处理分页排序不稳定的情况

This commit is contained in:
tianfeng 2026-03-20 10:33:48 +08:00
parent 70b1dba4b1
commit d3bf87c5fc

View File

@ -14,14 +14,15 @@
<select id="pageRechargeRank" resultType="com.red.circle.other.infra.database.rds.dto.activity.ActivityRechargeRankDTO">
SELECT
user_id AS userId,
SUM(amount) AS totalAmount
SUM(amount) AS totalAmount,
MIN(create_time) AS firstTime
FROM user_activity_recharge
WHERE activity_id = #{activityId}
<if test="rechargeType != null and rechargeType != ''">
AND recharge_type = #{rechargeType}
</if>
GROUP BY user_id
ORDER BY totalAmount DESC
ORDER BY totalAmount DESC, firstTime
</select>
<select id="getUserTotalAmount" resultType="java.math.BigDecimal">