From a07fc02a9f0aa49aaaf273f5ff9cce4c6d546de9 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期四, 21 九月 2023 15:25:36 +0800 Subject: [PATCH] 位置字段添加 --- models/operation_details.go | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/models/operation_details.go b/models/operation_details.go index 6792f45..270e34d 100644 --- a/models/operation_details.go +++ b/models/operation_details.go @@ -12,12 +12,12 @@ OperationDetails struct { WmsModel - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - OperationId int `json:"OperationId" gorm:"type:int;not null;comment:鎿嶄綔璁板綍id"` //鎿嶄綔id - ProductId int `json:"productId" gorm:"type:int;not null;comment:浜у搧id"` //浜у搧id - ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О - Quantity decimal.Decimal `json:"quantity" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺 - FinishQuantity decimal.Decimal `json:"finishQuantity" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //瀹屾垚鏁伴噺 + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + OperationId int `json:"OperationId" gorm:"type:int;not null;comment:鎿嶄綔璁板綍id"` //鎿嶄綔id + ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:浜у搧id"` //浜у搧id + ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О + Quantity decimal.Decimal `json:"quantity" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺 + Unit string `json:"unit" gorm:"type:varchar(31);comment:鍗曚綅"` } OperationDetailsSearch struct { @@ -154,7 +154,7 @@ func (slf *OperationDetailsSearch) Delete() error { var db = slf.build() - return db.Delete(&OperationDetails{}).Error + return db.Unscoped().Delete(&OperationDetails{}).Error } func (slf *OperationDetailsSearch) First() (*OperationDetails, error) { @@ -243,3 +243,16 @@ return records, nil } + +func (slf *OperationDetailsSearch) FindAll() ([]*OperationDetails, error) { + var ( + records = make([]*OperationDetails, 0) + db = slf.build() + ) + + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find records err: %v", err) + } + + return records, nil +} -- Gitblit v1.8.0