From 5f0170df9787c6f3ff17cc168b3f2e3f511453f6 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 31 十月 2023 20:04:16 +0800
Subject: [PATCH] 支持职级降级的情况
---
model/serviceFollowup.go | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go
index c69cd23..65ffa14 100644
--- a/model/serviceFollowup.go
+++ b/model/serviceFollowup.go
@@ -46,6 +46,7 @@
PageNum int
PageSize int
Preload bool
+ MemberIds []int
}
)
@@ -97,6 +98,13 @@
Preload("OldMember")
}
+ if len(slf.MemberIds) > 0 {
+ db = db.Where("service_followup.member_id in ?", slf.MemberIds)
+ }
+ if slf.Number != "" {
+ db = db.Where("number = ?", slf.Number)
+ }
+
return db
}
@@ -137,6 +145,35 @@
return records, total, err
}
+func (slf *ServiceFollowupSearch) Count() (int64, error) {
+ var db = slf.build()
+ var total int64
+ err := db.Count(&total).Error
+ return total, err
+}
+
+func (slf *ServiceFollowupSearch) MaxAutoIncr() (int, error) {
+ type Result struct {
+ Max int
+ }
+
+ var (
+ result Result
+ db = slf.build()
+ )
+
+ err := db.Select("MAX(id) as max").Scan(&result).Error
+ if err != nil {
+ return result.Max, fmt.Errorf("max err: %v", err)
+ }
+ return result.Max, nil
+}
+
+func (slf *ServiceFollowupSearch) SetNumber(number string) *ServiceFollowupSearch {
+ slf.Number = number
+ return slf
+}
+
func (slf *ServiceFollowupSearch) SetId(id int) *ServiceFollowupSearch {
slf.Id = id
return slf
@@ -176,6 +213,11 @@
return slf
}
+func (slf *ServiceFollowupSearch) SetMemberIds(memberIds []int) *ServiceFollowupSearch {
+ slf.MemberIds = memberIds
+ return slf
+}
+
func (slf *ServiceFollowupSearch) UpdateByMap(data map[string]interface{}) error {
var db = slf.build()
return db.Updates(data).Error
--
Gitblit v1.8.0