diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RankingActivityGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RankingActivityGatewayImpl.java index 466fcbfa..9b322ee7 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RankingActivityGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RankingActivityGatewayImpl.java @@ -187,10 +187,13 @@ public class RankingActivityGatewayImpl implements RankingActivityGateway { .first("userId").as("userId") .first("userSex").as("userSex") .first("activityType").as("activityType") - .first("dimension").as("dimension"), - // 3. 按总数量降序排序 + .first("dimension").as("dimension") + .first("createTime").as("createTime"), + // 3. 按总数量降序排序,createTime升序排序 Aggregation.sort( - org.springframework.data.domain.Sort.Direction.DESC, "quantity" + org.springframework.data.domain.Sort.Direction.DESC, "quantity" + ).and( + org.springframework.data.domain.Sort.Direction.ASC, "createTime" ), // 4. 限制返回数量 Aggregation.limit(topN)