From 216c9e49dafdb7a5bd025f6d6fa899a33befc38c Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期三, 17 四月 2024 10:33:01 +0800 Subject: [PATCH] 产品添加字段 --- models/operation.go | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-) diff --git a/models/operation.go b/models/operation.go index 1296457..ccf54fd 100644 --- a/models/operation.go +++ b/models/operation.go @@ -49,19 +49,27 @@ ToLocationID int `json:"toLocationId" gorm:"type:int;not null;comment:浠撳簱浣嶇疆id"` //鐩爣浣嶇疆id ToLocation Location `json:"toLocation" gorm:"foreignKey:ToLocationID;references:Id"` //鐩爣浣嶇疆 SalesDetailsNumber string `gorm:"type:varchar(191);comment:閿�鍞槑缁嗙紪鐮�" json:"salesDetailsNumber"` + + ManagerId string `json:"managerId" gorm:"type:varchar(255);comment:涓荤id"` + Manager string `json:"manager" gorm:"type:varchar(255);comment:涓荤鍚嶇О"` + AccountantId string `json:"accountantId" gorm:"type:varchar(255);comment:浼氳id"` + Accountant string `json:"accountant" gorm:"type:varchar(255);comment:浼氳鍚嶇О"` + CustodianId string `json:"custodianId" gorm:"type:varchar(255);comment:淇濈鍛榠d"` + Custodian string `json:"custodian" gorm:"type:varchar(255);comment:淇濈鍛樺悕绉�"` } OperationSearch struct { Operation - Order string - PageNum int - PageSize int - Keyword string - Orm *gorm.DB - Preload bool - Disuse bool - Ids []int - Numbers []string + Order string + PageNum int + PageSize int + Keyword string + Orm *gorm.DB + Preload bool + Disuse bool + Ids []int + SourceNumbers []string + SalesDetailsNumbers []string } ) @@ -118,6 +126,11 @@ return slf } +func (slf *OperationSearch) SetSourceNumbers(numbers []string) *OperationSearch { + slf.SourceNumbers = numbers + return slf +} + func (slf *OperationSearch) SetDisuse(disuse bool) *OperationSearch { slf.Disuse = disuse return slf @@ -143,6 +156,11 @@ return slf } +func (slf *OperationSearch) SetSalesDetailsNumbers(salesDetailsNumbers []string) *OperationSearch { + slf.SalesDetailsNumbers = salesDetailsNumbers + return slf +} + func (slf *OperationSearch) SetOperationSource(operationSource constvar.OperationSource) *OperationSearch { slf.OperationSource = operationSource return slf @@ -164,6 +182,10 @@ if slf.SourceNumber != "" { db = db.Where("source_number = ?", slf.SourceNumber) + } + + if len(slf.SourceNumbers) > 0 { + db = db.Where("source_number in (?)", slf.SourceNumbers) } if slf.Number != "" { @@ -198,6 +220,10 @@ db = db.Where("sales_details_number = ?", slf.SalesDetailsNumber) } + if len(slf.SalesDetailsNumbers) > 0 { + db = db.Where("sales_details_number in (?)", slf.SalesDetailsNumbers) + } + if slf.OperationSource != 0 { db = db.Where("operation_source = ?", slf.OperationSource) } -- Gitblit v1.8.0