From 65f900c88f0f90ee3b29e9b985723b8f94aaeb0b Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期三, 27 九月 2023 14:14:35 +0800 Subject: [PATCH] 1.修改上架规则列表bug --- models/material.go | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/models/material.go b/models/material.go index d8098fd..df61270 100644 --- a/models/material.go +++ b/models/material.go @@ -152,6 +152,10 @@ slf.TemplateID = id return slf } +func (slf *MaterialSearch) SetCategoryId(id int) *MaterialSearch { + slf.CategoryId = id + return slf +} // //func (slf *MaterialSearch) SetSetTemplateType(setType constvar.SetTemplateType) *MaterialSearch { @@ -207,7 +211,7 @@ //} if slf.Keyword != "" { - db = db.Where("name LIKE ? or id LIKE ? ", "%"+slf.Keyword+"%", "%"+slf.Keyword+"%") + db = db.Where("name LIKE ? ", "%"+slf.Keyword+"%") } if slf.Order != "" { @@ -222,6 +226,9 @@ } if slf.IsSale { db = db.Where("is_sale = ?", 1) + } + if slf.CategoryId > 0 { + db = db.Where("category_id = ?", slf.CategoryId) } return db @@ -475,3 +482,24 @@ } return result.Max, nil } + +type ResponseDisuseList struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Number string `json:"number" gorm:"type:varchar(255)"` //鍗曞彿 + SourceNumber string `json:"sourceNumber" gorm:"type:varchar(255)"` //婧愬崟鍙� + Status constvar.OperationStatus `json:"status" gorm:"type:int(11);not null;comment:鐘舵��"` //鐘舵�� + FromLocationID int `json:"fromLocationId" gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d + FromLocation Location `json:"fromLocation" gorm:"foreignKey:FromLocationID;references:Id"` //婧愪綅缃� + ToLocation Location `json:"toLocation" gorm:"foreignKey:ToLocationID;references:Id"` //鐩爣浣嶇疆 + ToLocationID int `json:"toLocationId" gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id + OperationDate string `json:"operationDate" gorm:"type:varchar(31);comment:瀹夋帓鏃ユ湡"` + ContacterID int `json:"contacterID" gorm:"type:int;comment:鑱旂郴浜篒D"` + ContacterName string `json:"contacterName" gorm:"type:varchar(63);comment:鑱旂郴浜哄鍚�"` + CompanyID int `json:"companyID" gorm:"type:int;comment:鍏徃ID-瀹㈡埛"` + CompanyName string `json:"companyName" gorm:"type:varchar(127);comment:鍏徃鍚嶇О-瀹㈡埛"` + Comment string `json:"comment" gorm:"type:text;comment:澶囨敞"` + ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:浜у搧id"` //浜у搧id + 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:varchar(31);comment:鍗曚綅"` +} -- Gitblit v1.8.0