From d91f181819984ed68d928bec6e926da6566e7a3f Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 05 七月 2024 14:53:02 +0800 Subject: [PATCH] 当操作为出库或调拨时,操作详情明细返回产品相应位置的实时库存 --- models/location_product_amount.go | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/models/location_product_amount.go b/models/location_product_amount.go index 98abd13..6b82f7c 100644 --- a/models/location_product_amount.go +++ b/models/location_product_amount.go @@ -36,6 +36,7 @@ ProductIds []string Ids []int Query string + Fields string } LocationProductAmountWithOperation struct { @@ -131,6 +132,11 @@ return slf } +func (slf *LocationProductAmountSearch) SetFields(fields string) *LocationProductAmountSearch { + slf.Fields = fields + return slf +} + func (slf *LocationProductAmountSearch) build() *gorm.DB { var db = slf.Orm.Model(&LocationProductAmount{}) @@ -181,6 +187,10 @@ db = db.Where("warehouse_id = ?", slf.WarehouseId) } + if slf.Fields != "" { + db = db.Select(slf.Fields) + } + return db } -- Gitblit v1.8.0