多笔立减

This commit is contained in:
ziming 2025-08-12 11:39:29 +08:00
parent 97a1747424
commit 085d3ddb73
1 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ func (p *OrderRepoImpl) SpecifyFindInBatches(ctx context.Context, req *bo.FindIn
func (p *OrderRepoImpl) FinSucByStockIdInBatches(ctx context.Context, req *do.WechatQuery, fun func(ctx context.Context, rows []*bo.OrderBo) error) error { func (p *OrderRepoImpl) FinSucByStockIdInBatches(ctx context.Context, req *do.WechatQuery, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
tx := p.DB(ctx). tx := p.DB(ctx).
Where("status = ?", vo.OrderStatusSuccess.GetValue()). Where("`status` = ?", vo.OrderStatusSuccess.GetValue()).
Where("activity_id = ''") Where("activity_id = ''")
if req.ProductNo != "" { if req.ProductNo != "" {
@ -111,7 +111,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()).
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))
}) })
@ -128,7 +128,7 @@ func (p *OrderRepoImpl) FindIngInBatches(ctx context.Context, fun func(ctx conte
var results = make([]*model.Order, 0) var results = make([]*model.Order, 0)
result := p.DB(ctx). result := p.DB(ctx).
Where("status = ?", vo.OrderStatusIng.GetValue()). Where("`status` = ?", vo.OrderStatusIng.GetValue()).
Limit(20). Limit(20).
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))
@ -147,7 +147,7 @@ func (p *OrderRepoImpl) FindInBatches(ctx context.Context, req *bo.FindInBatches
result := p.DB(ctx). result := p.DB(ctx).
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 { FindInBatches(&results, 100, 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