From a31f930fff45db997d25b74182ef4ff37492e9ec Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期一, 01 七月 2024 09:18:31 +0800
Subject: [PATCH] 字典查询去除字典类型判断
---
models/operation_type.go | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/models/operation_type.go b/models/operation_type.go
index ed03f46..25af9ff 100644
--- a/models/operation_type.go
+++ b/models/operation_type.go
@@ -36,16 +36,18 @@
ReturnOperationType string `json:"returnOperationType" gorm:"-"` //閫�璐х被鍨嬪悕绉�
ReadyCount int `json:"readyCount" gorm:"-"` //灏辩华鏁伴噺
FinishCount int `json:"finishCount" gorm:"-"` //瀹屾垚鏁伴噺
+ CancelCount int `json:"cancelCount" gorm:"-"` //鍙栨秷1鏁伴噺
}
OperationTypeSearch struct {
OperationType
- Order string
- PageNum int
- PageSize int
- Keyword string
- Orm *gorm.DB
- Preload bool
+ Order string
+ PageNum int
+ PageSize int
+ Keyword string
+ Orm *gorm.DB
+ Preload bool
+ WarehouseIds []int
}
OperationTypeByStatus struct {
@@ -108,6 +110,11 @@
return slf
}
+func (slf *OperationTypeSearch) SetWarehouseIds(warehouseIds []int) *OperationTypeSearch {
+ slf.WarehouseIds = warehouseIds
+ return slf
+}
+
func (slf *OperationTypeSearch) build() *gorm.DB {
var db = slf.Orm.Model(&OperationType{})
@@ -135,6 +142,10 @@
db = db.Where("warehouse_id = ?", slf.WarehouseId)
}
+ if len(slf.WarehouseIds) > 0 {
+ db = db.Where("warehouse_id in ?", slf.WarehouseIds)
+ }
+
if int(slf.BaseOperationType) != 0 {
db = db.Where("base_operation_type = ?", slf.BaseOperationType)
}
--
Gitblit v1.8.0