From 040cd381f2e8475e9b4eb336b704ad878f56f4fa Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 14 九月 2023 20:42:01 +0800 Subject: [PATCH] 适应性改动 --- model/production_progress.go | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/model/production_progress.go b/model/production_progress.go index 8305442..166769e 100644 --- a/model/production_progress.go +++ b/model/production_progress.go @@ -15,6 +15,7 @@ ProcedureID string `gorm:"uniqueIndex:idx_product_procedure;type:varchar(191);comment:宸ュ簭ID" json:"procedureId"` DeviceID string `gorm:"type:varchar(191);not null;comment:璁惧ID" json:"deviceId"` FinishedQuantity int64 `gorm:"type:int;not null;comment:瀹屾垚鏁伴噺" json:"finishedQuantity"` + Position int `gorm:"type:int;comment:宸ヤ綔浣嶇疆" json:"position"` //姣忎釜璁惧鍙兘鏈夊涓満浣嶅悓鏃剁敓浜э紝鐢╬osition琛ㄧず浣嶇疆 TotalQuantity int64 `gorm:"type:int;not null;comment:鎬婚噺" json:"totalQuantity"` } @@ -73,6 +74,11 @@ return slf } +func (slf *ProductionProgressSearch) SetPosition(position int) *ProductionProgressSearch { + slf.Position = position + return slf +} + func (slf *ProductionProgressSearch) build() *gorm.DB { var db = slf.Orm.Model(&ProductionProgress{}) @@ -100,6 +106,10 @@ db = db.Where("device_id = ?", slf.DeviceID) } + if slf.Position != 0 { + db = db.Where("position = ?", slf.Position) + } + return db } -- Gitblit v1.8.0