zhangqian
2023-08-02 6e9274c27ffc8fe7f41e2c3c06a239d4c3fb09e5
model/serviceFollowup.go
@@ -1,6 +1,7 @@
package model
import (
   "aps_crm/constvar"
   "aps_crm/pkg/mysqlx"
   "gorm.io/gorm"
)
@@ -28,13 +29,12 @@
   ServiceFollowupSearch struct {
      ServiceFollowup
            Orm      *gorm.DB
      Keyword  string
      OrderBy  string
      PageNum  int
      PageSize int
      Orm         *gorm.DB
      KeywordType constvar.ServiceFollowupKeywordType
      Keyword     interface{}
      OrderBy     string
      PageNum     int
      PageSize    int
   }
)
@@ -50,11 +50,24 @@
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)
   }
   switch slf.KeywordType {
   case constvar.ServiceFollowupKeywordFollowupNo:
      db = db.Where("number = ?", slf.Keyword)
   case constvar.ServiceFollowupKeywordCustomerName:
      db = db.Where("client_id = ?", slf.Keyword)
   case constvar.ServiceFollowupKeywordContactName:
      db = db.Where("contact_id = ?", slf.Keyword)
   case constvar.ServiceFollowupKeywordCustomerServiceNo:
      db = db.Where("service_id = ?", slf.Keyword)
   case constvar.ServiceFollowupKeywordVisitor:
      db = db.Where("member_id = ?", slf.Keyword)
   case constvar.ServiceFollowupKeywordSatisfactionDegree:
      db = db.Where("satisfaction_id = ?", slf.Keyword)
   }
   return db
@@ -106,7 +119,10 @@
   return slf
}
// 可能性 币种 当前状态(销售机会)
func (slf *ServiceFollowupSearch) SetKeywordType(keyword constvar.ServiceFollowupKeywordType) *ServiceFollowupSearch {
   slf.KeywordType = keyword
   return slf
}
func (slf *ServiceFollowupSearch) SetKeyword(keyword string) *ServiceFollowupSearch {
   slf.Keyword = keyword
@@ -121,4 +137,4 @@
func (slf *ServiceFollowupSearch) SetOrder(order string) *ServiceFollowupSearch {
   slf.OrderBy = order
   return slf
}
}