From 0551df1d2a65876b2427df112e37625f128b67e4 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期一, 23 十月 2023 11:59:34 +0800 Subject: [PATCH] 1.库存盘点列表增加基础作业类型 --- models/location_product_amount.go | 46 ++++++++++++++++++++++++++++------------------ 1 files changed, 28 insertions(+), 18 deletions(-) diff --git a/models/location_product_amount.go b/models/location_product_amount.go index 9686a30..0700984 100644 --- a/models/location_product_amount.go +++ b/models/location_product_amount.go @@ -20,28 +20,30 @@ LocationProductAmountSearch struct { LocationProductAmount - Order string - PageNum int - PageSize int - Keyword string - Orm *gorm.DB - Preload bool + Order string + PageNum int + PageSize int + Keyword string + Orm *gorm.DB + Preload bool + LocationProductIds []int } LocationProductAmountWithOperation struct { //LocationProductAmount LocationProductAmount `json:"locationProductAmount"` - LocationProductAmountId int `json:"locationProductAmount" gorm:"location_product_amount_id"` - LocationId int `json:"locationId" gorm:"column:location_id"` - LocationName string `json:"locationName" gorm:"column:location_name"` - ProductId string `json:"productId" gorm:"column:product_id"` - ProductName string `json:"productName" gorm:"column:product_name"` - Amount decimal.Decimal `json:"amount" gorm:"column:amount"` - Unit string `json:"unit" gorm:"column:unit"` - CreateDate string `json:"createDate" gorm:"column:create_date"` - AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` - DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"` - OperationId int `json:"operationId" gorm:"column:operation_id"` - Status constvar.OperationStatus `json:"status" gorm:"status"` + LocationProductAmountId int `json:"locationProductAmountId" gorm:"location_product_amount_id"` + LocationId int `json:"locationId" gorm:"column:location_id"` + LocationName string `json:"locationName" gorm:"column:location_name"` + ProductId string `json:"productId" gorm:"column:product_id"` + ProductName string `json:"productName" gorm:"column:product_name"` + Amount decimal.Decimal `json:"amount" gorm:"column:amount"` + Unit string `json:"unit" gorm:"column:unit"` + CreateDate string `json:"createDate" gorm:"column:create_date"` + AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` + DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"` + OperationId int `json:"operationId" gorm:"column:operation_id"` + Status constvar.OperationStatus `json:"status" gorm:"status"` + BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"base_operation_type"` } ) @@ -88,6 +90,11 @@ return slf } +func (slf *LocationProductAmountSearch) SetLocationProductIds(ids []int) *LocationProductAmountSearch { + slf.LocationProductIds = ids + return slf +} + func (slf *LocationProductAmountSearch) build() *gorm.DB { var db = slf.Orm.Model(&LocationProductAmount{}) @@ -108,6 +115,9 @@ if slf.LocationProductId != 0 { db = db.Where("location_product_id=?", slf.LocationProductId) } + if len(slf.LocationProductIds) > 0 { + db = db.Where("location_product_id in (?)", slf.LocationProductIds) + } return db } -- Gitblit v1.8.0