From 5f0170df9787c6f3ff17cc168b3f2e3f511453f6 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 31 十月 2023 20:04:16 +0800
Subject: [PATCH] 支持职级降级的情况
---
model/collectionProjection.go | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/model/collectionProjection.go b/model/collectionProjection.go
index e6d758b..6275bb2 100644
--- a/model/collectionProjection.go
+++ b/model/collectionProjection.go
@@ -13,16 +13,17 @@
Modifier int `json:"modifier" gorm:"column:modifier;type:int(11);comment:淇敼浜�"`
EstimatedCollectionDate *string `json:"estimated_collection_date" gorm:"column:estimated_collection_date;type:datetime;comment:棰勮鏀舵鏃ユ湡"`
EstimatedCollectionAmount float64 `json:"estimated_collection_amount" gorm:"column:estimated_collection_amount;type:decimal(10,2);comment:棰勮鏀舵閲戦"`
- gorm.Model
+ gormModel
}
CollectionProjectionSearch struct {
CollectionProjection
- Orm *gorm.DB
- OrderBy string
- PageNum int
- PageSize int
+ Orm *gorm.DB
+ SearchMap map[string]interface{}
+ OrderBy string
+ PageNum int
+ PageSize int
}
)
@@ -40,6 +41,21 @@
var db = slf.Orm.Model(&CollectionProjection{})
if slf.Id != 0 {
db = db.Where("id = ?", slf.Id)
+ }
+
+ if len(slf.SearchMap) > 0 {
+ for key, value := range slf.SearchMap {
+ switch v := value.(type) {
+ case string:
+ if key == "estimated_collection_date" {
+ db = db.Where(key+" = ?", v)
+ }
+ case int:
+ if key == "client_id" || key == "sale_chance_id" {
+ db = db.Where(key+" = ?", v)
+ }
+ }
+ }
}
return db
@@ -92,3 +108,8 @@
slf.PageNum, slf.PageSize = page, size
return slf
}
+
+func (slf *CollectionProjectionSearch) SetSearchMap(data map[string]interface{}) *CollectionProjectionSearch {
+ slf.SearchMap = data
+ return slf
+}
--
Gitblit v1.8.0