From 73b6baf6af3d88cdcb0e2df7932a9bd96b0b85c5 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 01 七月 2024 22:32:34 +0800 Subject: [PATCH] 月度统计出入库按类型汇总报表定时任务和手动跑任务接口 --- models/location_product_amount.go | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/models/location_product_amount.go b/models/location_product_amount.go index f1f2dc3..d4990b1 100644 --- a/models/location_product_amount.go +++ b/models/location_product_amount.go @@ -47,6 +47,7 @@ ProductId string `json:"productId" gorm:"column:product_id"` ProductName string `json:"productName" gorm:"column:product_name"` Amount decimal.Decimal `json:"amount" gorm:"column:amount"` + AmountMoreUnits []UnitItems `json:"amountMoreUnits" gorm:"-"` //鍦ㄥ簱鏁伴噺澶氬崟浣� Unit string `json:"unit" gorm:"column:unit"` CreateDate string `json:"createDate" gorm:"column:create_date"` AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` //宸�� @@ -253,6 +254,9 @@ db = slf.build() ) + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } if err := db.Find(&records).Error; err != nil { return records, fmt.Errorf("find records err: %v", err) } @@ -311,3 +315,13 @@ } return result, nil } + +func (slf *LocationProductAmountSearch) Save(record *LocationProductAmount) error { + var db = slf.build() + + if err := db.Omit("CreatedAt").Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} -- Gitblit v1.8.0