From 359f2f3fd0da6d69474cce87353beb54bfdbf90c Mon Sep 17 00:00:00 2001 From: lishihai <dslsh@dscom> Date: 星期四, 20 六月 2024 14:24:52 +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