From 2f856eaa7e46c884f1cb7ad721919a086d7f34a3 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 13 六月 2024 15:57:45 +0800 Subject: [PATCH] 出入库明细列表和报表增加多单位 --- models/move_history.go | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/models/move_history.go b/models/move_history.go index a83a53a..4d7b10d 100644 --- a/models/move_history.go +++ b/models/move_history.go @@ -19,6 +19,7 @@ OperationTypeName string `json:"operationTypeName" gorm:"type:varchar(127);not null;comment:浣滀笟绫诲瀷鍚嶇О"` //浣滀笟绫诲瀷鍚嶇О OperationId int `json:"operationId" gorm:"type:int;not null;comment:鎿嶄綔id"` //鎿嶄綔id ProductId string `json:"productId" gorm:"type:varchar(255);not null;comment:浜у搧id"` //浜у搧id + Product Material `json:"-" gorm:"foreignKey:ProductId"` //浜у搧 ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺 Unit string `json:"unit" gorm:"type:char(10);not null;comment:鍗曚綅"` //鍗曚綅 @@ -94,6 +95,10 @@ db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) } + if slf.Preload { + db = db.Model(&MoveHistory{}).Preload("Product") + } + return db } -- Gitblit v1.8.0