From 482e8d7f82d5899879da1406b8130f878d2a38b7 Mon Sep 17 00:00:00 2001 From: ziming Date: Thu, 16 Oct 2025 11:35:55 +0800 Subject: [PATCH] order by --- internal/data/repoimpl/order.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/data/repoimpl/order.go b/internal/data/repoimpl/order.go index 0e3c64a..0062dd6 100644 --- a/internal/data/repoimpl/order.go +++ b/internal/data/repoimpl/order.go @@ -149,7 +149,8 @@ func (p *OrderRepoImpl) FindInBatches(ctx context.Context, req *bo.FindInBatches Where("activity_id = ''"). Where("`status` IN (?)", []uint8{vo.OrderStatusSuccess.GetValue(), vo.OrderStatusUse.GetValue()}). Where("receive_success_time BETWEEN ? AND ?", req.StartTime, req.EndTime). - FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error { + Order(""). // 显式清除排序,移除默认的 ORDER BY + FindInBatches(&results, 1000, func(tx *gorm.DB, batch int) error { // tx.RowsAffected 提供当前批处理中记录的计数(the count of records in the current batch) // 'batch' 变量表示当前批号(the current batch number) // 返回 error 将阻止更多的批处理