From aeed976c2999e2cea097cdee38d8baeefe323f3d Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期六, 30 三月 2024 16:15:59 +0800
Subject: [PATCH] 修改
---
models/warehouse.go | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/models/warehouse.go b/models/warehouse.go
index ebdf7b3..0b1c74f 100644
--- a/models/warehouse.go
+++ b/models/warehouse.go
@@ -25,7 +25,7 @@
Address string `json:"address" gorm:"type:varchar(512);comment:鍦板潃"` //鍦板潃
InboundTransportation int `json:"inboundTransportation" gorm:"type:int;comment:鍏ュ悜杩愯緭"` //鍏ュ悜杩愯緭
OutboundTransportation int `json:"outboundTransportation" gorm:"type:int;comment:鍑哄簱杩愯緭"` //鍑哄簱杩愯緭
- LocationId int `json:"locationId" gorm:"type:int;comment:浣嶇疆id"` //浣嶇疆id
+ LocationId int `json:"locationId" gorm:"type:int;comment:浣嶇疆id"` //榛樿浣嶇疆id
WarehouseLocation string `json:"warehouseLocation" gorm:"-"` //搴撳瓨浣嶇疆
Contacts string `json:"contacts" gorm:"type:varchar(255);comment:鑱旂郴浜�"` //鑱旂郴浜�
}
@@ -38,6 +38,7 @@
Keyword string
Orm *gorm.DB
Preload bool
+ Codes []string
}
)
@@ -79,6 +80,11 @@
return slf
}
+func (slf *WarehouseSearch) SetCodes(codes []string) *WarehouseSearch {
+ slf.Codes = codes
+ return slf
+}
+
func (slf *WarehouseSearch) SetName(name string) *WarehouseSearch {
slf.Name = name
return slf
@@ -116,10 +122,15 @@
if slf.Preload {
db = db.Preload("Company")
}
+
if slf.Code != "" {
db = db.Where("code = ?", slf.Code)
}
+ if len(slf.Codes) > 0 {
+ db = db.Where("code in ?", slf.Codes)
+ }
+
return db
}
--
Gitblit v1.8.0