From a0125ef3d6ce35be7b6dc4919c4192dba4a7329a Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期四, 16 十一月 2023 14:33:51 +0800 Subject: [PATCH] 报废数量bug --- models/operation_details.go | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/models/operation_details.go b/models/operation_details.go index 32e8f9a..067ba63 100644 --- a/models/operation_details.go +++ b/models/operation_details.go @@ -74,6 +74,11 @@ return slf } +func (slf *OperationDetailsSearch) SetProductId(productId string) *OperationDetailsSearch { + slf.ProductId = productId + return slf +} + func (slf *OperationDetailsSearch) build() *gorm.DB { var db = slf.Orm.Model(&OperationDetails{}) @@ -92,6 +97,12 @@ if slf.OperationID != 0 { db = db.Where("operation_id = ?", slf.OperationID) } + if slf.ProductId != "" { + db = db.Where("product_id = ?", slf.ProductId) + } + if slf.Preload { + db = db.Preload("Product") + } return db } -- Gitblit v1.8.0