This commit is contained in:
ziming 2025-10-16 11:35:55 +08:00
parent 5a3fefdd19
commit 482e8d7f82
1 changed files with 2 additions and 1 deletions

View File

@ -149,7 +149,8 @@ func (p *OrderRepoImpl) FindInBatches(ctx context.Context, req *bo.FindInBatches
Where("activity_id = ''"). Where("activity_id = ''").
Where("`status` IN (?)", []uint8{vo.OrderStatusSuccess.GetValue(), vo.OrderStatusUse.GetValue()}). Where("`status` IN (?)", []uint8{vo.OrderStatusSuccess.GetValue(), vo.OrderStatusUse.GetValue()}).
Where("receive_success_time BETWEEN ? AND ?", req.StartTime, req.EndTime). 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 // tx.RowsAffected 提供当前批处理中记录的计数the count of records in the current batch
// 'batch' 变量表示当前批号the current batch number // 'batch' 变量表示当前批号the current batch number
// 返回 error 将阻止更多的批处理 // 返回 error 将阻止更多的批处理