order by
This commit is contained in:
parent
482e8d7f82
commit
93873c6fd6
|
|
@ -55,6 +55,8 @@ func (p *OrderRepoImpl) SpecifyFindInBatches(ctx context.Context, req *bo.FindIn
|
||||||
tx = tx.Where("voucher_no IN (?)", req.VoucherNos)
|
tx = tx.Where("voucher_no IN (?)", req.VoucherNos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tx.Order("") // 显式清除排序,移除默认的 ORDER BY
|
||||||
|
|
||||||
var results = make([]*model.Order, 0)
|
var results = make([]*model.Order, 0)
|
||||||
|
|
||||||
result := tx.FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
|
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)
|
var results = make([]*model.Order, 0)
|
||||||
|
|
||||||
|
tx.Order("") // 显式清除排序,移除默认的 ORDER BY
|
||||||
|
|
||||||
result := tx.FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
|
result := tx.FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
|
||||||
|
|
||||||
return fun(ctx, p.ToBos(results))
|
return fun(ctx, p.ToBos(results))
|
||||||
|
|
@ -112,6 +116,7 @@ func (p *OrderRepoImpl) FinFailByStockIdInBatches(ctx context.Context, batchNo s
|
||||||
result := p.DB(ctx).
|
result := p.DB(ctx).
|
||||||
Where("batch_no = ?", batchNo).
|
Where("batch_no = ?", batchNo).
|
||||||
Where("`status` = ?", vo.OrderStatusFail.GetValue()).
|
Where("`status` = ?", vo.OrderStatusFail.GetValue()).
|
||||||
|
Order(""). // 显式清除排序,移除默认的 ORDER BY
|
||||||
FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
|
FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
|
||||||
return fun(ctx, p.ToBos(results))
|
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).
|
result := p.DB(ctx).
|
||||||
Where("`status` = ?", vo.OrderStatusIng.GetValue()).
|
Where("`status` = ?", vo.OrderStatusIng.GetValue()).
|
||||||
Limit(20).
|
Limit(20).
|
||||||
|
Order(""). // 显式清除排序,移除默认的 ORDER BY
|
||||||
FindInBatches(&results, 10, func(tx *gorm.DB, batch int) error {
|
FindInBatches(&results, 10, func(tx *gorm.DB, batch int) error {
|
||||||
return fun(ctx, p.ToBos(results))
|
return fun(ctx, p.ToBos(results))
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue