From 6b3135d32fc3c84be81b0876f1961994088e5dbf Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 09 十月 2023 20:57:05 +0800
Subject: [PATCH] 当前使用的工艺编号置顶

---
 model/process_model.go |   40 ++++++++++++++++++++++++++--------------
 1 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/model/process_model.go b/model/process_model.go
index 9ff8e4f..56ab7be 100644
--- a/model/process_model.go
+++ b/model/process_model.go
@@ -11,24 +11,27 @@
 type (
 	// ProcessModel 宸ヨ壓鍙傛暟
 	ProcessModel struct {
-		gorm.Model `json:"-"`
-		Number     string                 `gorm:"index;column:number;type:varchar(255);not null;default '';comment:宸ヨ壓妯″瀷缂栧彿" json:"number"` //宸ヨ壓妯″瀷缂栧彿
-		Product    string                 `gorm:"column:product;type:varchar(255);not null;default '';comment:浜у搧鍚嶇О" json:"product"`       //浜у搧鍚嶇О
-		Procedure  string                 `gorm:"column:procedure;type:varchar(255);not null;default '';comment:宸ュ簭" json:"procedure"`     //宸ュ簭
-		Params     string                 `gorm:"type:text;comment:宸ヨ壓鍙傛暟閿�煎json涓�"`
-		ParamsMap  map[string]interface{} `json:"paramsMap" gorm:"-"`
-		DeviceId   string                 `json:"deviceId" gorm:"-"`                        //鐢ㄤ簬杩囨护鑾峰彇nsq娑堟伅
-		IsNew      bool                   `json:"isNew" gorm:"column:is_new;comment:鏄惁鏈�鏂扮殑"` //鏄惁鏈�鏂扮殑
-		IsUpdate   bool                   `json:"isUpdate" gorm:"-"`                        //鍓嶇鐢�
+		gorm.Model   `json:"-"`
+		Number       string                 `gorm:"index;column:number;type:varchar(255);not null;default '';comment:宸ヨ壓妯″瀷缂栧彿" json:"number"` //宸ヨ壓妯″瀷缂栧彿
+		Product      string                 `gorm:"column:product;type:varchar(255);not null;default '';comment:浜у搧鍚嶇О" json:"product"`       //浜у搧鍚嶇О
+		Procedure    string                 `gorm:"column:procedure;type:varchar(255);not null;default '';comment:宸ュ簭" json:"procedure"`     //宸ュ簭
+		Params       string                 `gorm:"type:text;comment:宸ヨ壓鍙傛暟閿�煎json涓�"`
+		ParamsMap    map[string]interface{} `json:"paramsMap" gorm:"-"`
+		DeviceId     string                 `json:"deviceId" gorm:"-"`                    //鐢ㄤ簬杩囨护鑾峰彇nsq娑堟伅
+		IsNew        bool                   `json:"-" gorm:"column:is_new;comment:鏄惁鏈�鏂扮殑"` //鏄惁鏈�鏂扮殑
+		IsUpdate     bool                   `json:"isUpdate" gorm:"-"`                    //鍓嶇鐢�
+		NewParamsMap map[string]interface{} `json:"newParamsMap" gorm:"-"`
+		NewNumber    string                 `json:"newNumber" gorm:"-"`
 	}
 
 	ProcessModelSearch struct {
 		ProcessModel
-		Order      string
-		PageNum    int
-		PageSize   int
-		Orm        *gorm.DB
-		Procedures []string
+		Order         string
+		PageNum       int
+		PageSize      int
+		Orm           *gorm.DB
+		Procedures    []string
+		CurrentNumber string
 	}
 )
 
@@ -71,6 +74,11 @@
 
 func (slf *ProcessModelSearch) SetNumber(number string) *ProcessModelSearch {
 	slf.Number = number
+	return slf
+}
+
+func (slf *ProcessModelSearch) SetCurrentNumber(number string) *ProcessModelSearch {
+	slf.CurrentNumber = number
 	return slf
 }
 
@@ -125,6 +133,10 @@
 		db = db.Where("is_new = ?", 1)
 	}
 
+	if len(slf.CurrentNumber) != 0 {
+		db = db.Where("number != ?", slf.CurrentNumber)
+	}
+
 	return db
 }
 

--
Gitblit v1.8.0