This commit is contained in:
ziming 2025-10-16 11:37:06 +08:00
parent 482e8d7f82
commit 93873c6fd6
1 changed files with 6 additions and 0 deletions

View File

@ -55,6 +55,8 @@ func (p *OrderRepoImpl) SpecifyFindInBatches(ctx context.Context, req *bo.FindIn
tx = tx.Where("voucher_no IN (?)", req.VoucherNos)
}
tx.Order("") // 显式清除排序,移除默认的 ORDER BY
var results = make([]*model.Order, 0)
result := tx.FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
@ -93,6 +95,8 @@ func (p *OrderRepoImpl) FinSucByStockIdInBatches(ctx context.Context, req *do.We
var results = make([]*model.Order, 0)
tx.Order("") // 显式清除排序,移除默认的 ORDER BY
result := tx.FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
return fun(ctx, p.ToBos(results))
@ -112,6 +116,7 @@ func (p *OrderRepoImpl) FinFailByStockIdInBatches(ctx context.Context, batchNo s
result := p.DB(ctx).
Where("batch_no = ?", batchNo).
Where("`status` = ?", vo.OrderStatusFail.GetValue()).
Order(""). // 显式清除排序,移除默认的 ORDER BY
FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
return fun(ctx, p.ToBos(results))
})
@ -130,6 +135,7 @@ func (p *OrderRepoImpl) FindIngInBatches(ctx context.Context, fun func(ctx conte
result := p.DB(ctx).
Where("`status` = ?", vo.OrderStatusIng.GetValue()).
Limit(20).
Order(""). // 显式清除排序,移除默认的 ORDER BY
FindInBatches(&results, 10, func(tx *gorm.DB, batch int) error {
return fun(ctx, p.ToBos(results))
})