From e0a433e9c31594527a3bf7766c0bfb2cbbceffdb Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 26 七月 2023 10:09:04 +0800
Subject: [PATCH] fix add pageInfo, keyword to all the list

---
 model/serviceFollowup.go |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go
index 6f8f179..fab5cf9 100644
--- a/model/serviceFollowup.go
+++ b/model/serviceFollowup.go
@@ -28,7 +28,13 @@
 
 	ServiceFollowupSearch struct {
 		ServiceFollowup
-		Orm *gorm.DB
+
+				Orm      *gorm.DB
+		Keyword  string
+		OrderBy  string
+		PageNum  int
+		PageSize int
+
 	}
 )
 
@@ -44,6 +50,9 @@
 
 func (slf *ServiceFollowupSearch) build() *gorm.DB {
 	var db = slf.Orm.Model(&ServiceFollowup{})
+	if slf.Keyword != "" {
+		db = db.Where("name LIKE ?", "%"+slf.Keyword+"%")
+	}
 	if slf.Id != 0 {
 		db = db.Where("id = ?", slf.Id)
 	}
@@ -86,3 +95,18 @@
 }
 
 // 鍙兘鎬� 甯佺 褰撳墠鐘舵�侊紙閿�鍞満浼氾級
+
+func (slf *ServiceFollowupSearch) SetKeyword(keyword string) *ServiceFollowupSearch {
+	slf.Keyword = keyword
+	return slf
+}
+
+func (slf *ServiceFollowupSearch) SetPage(page, size int) *ServiceFollowupSearch {
+	slf.PageNum, slf.PageSize = page, size
+	return slf
+}
+
+func (slf *ServiceFollowupSearch) SetOrder(order string) *ServiceFollowupSearch {
+	slf.OrderBy = order
+	return slf
+}

--
Gitblit v1.8.0