From 2234e8fa97e85e1e69a6f970416602f283e09df6 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期日, 07 四月 2024 21:57:28 +0800
Subject: [PATCH] 解决联调问题,增加纤度检验相关接口

---
 models/fineness.go |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/models/fineness.go b/models/fineness.go
index a323ce0..bed5a7a 100644
--- a/models/fineness.go
+++ b/models/fineness.go
@@ -11,14 +11,14 @@
 	// FinenessRegister 绾ゅ害鐧昏
 	FinenessRegister struct {
 		gorm.Model
-		Number        string          `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"`        //缂栧彿
-		FinishDate    string          `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"`  //钀戒笣鏃堕棿
-		Workshop      string          `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"`          //杞﹂棿
-		WorkshopGroup int             `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍
-		Market        string          `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"`        //搴勫彛
-		Spec          string          `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"`          //瑙勬牸
-		Circle        uint8           `gorm:"not null;comment:鍥炴暟" json:"circle"`                          //鍥炴暟
-		TotalCircle   uint8           `gorm:"not null;comment:鎬诲洖鏁�" json:"totalCircle"`                    //鎬诲洖鏁�
+		Number        string          `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"`             //缂栧彿
+		FinishDate    string          `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"`       //钀戒笣鏃堕棿
+		Workshop      string          `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"`               //杞﹂棿
+		WorkshopGroup int             `gorm:"type:int(11);not null;default:0;comment:杞︾粍" json:"workshopGroup"` //杞︾粍
+		Market        string          `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"`             //搴勫彛
+		Spec          string          `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"`               //瑙勬牸
+		Circle        uint8           `gorm:"not null;comment:鍥炴暟" json:"circle"`                               //鍥炴暟
+		TotalCircle   uint8           `gorm:"not null;comment:鎬诲洖鏁�" json:"totalCircle"`                         //鎬诲洖鏁�
 		FinenessList  []FinenessItem  `gorm:"foreignkey:FinenessRegisterID;references:ID" json:"finenessList"`
 		SumFineness   decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣绾ゅ害" json:"sumFineness"`
 		SumQuantity   decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣鏁伴噺" json:"sumQuantity"`
@@ -30,6 +30,7 @@
 		PageSize int
 		Orm      *gorm.DB
 		Preload  bool
+		Keyword  string
 	}
 )
 
@@ -71,6 +72,11 @@
 	return slf
 }
 
+func (slf *FinenessRegisterSearch) SetKeyword(keyword string) *FinenessRegisterSearch {
+	slf.Keyword = keyword
+	return slf
+}
+
 func (slf *FinenessRegisterSearch) build() *gorm.DB {
 	var db = slf.Orm.Table(slf.TableName())
 
@@ -90,6 +96,10 @@
 		db = db.Model(&FinenessRegister{}).Preload("FinenessList")
 	}
 
+	if slf.Keyword != "" {
+		db = db.Where("number like ?", fmt.Sprintf("%%%s%%", slf.Keyword))
+	}
+
 	return db
 }
 

--
Gitblit v1.8.0