liujiandao
2023-10-24 6aa75c2a266a2522ae713b13dc702b5ad0a08f87
model/serviceFollowup.go
@@ -101,6 +101,9 @@
   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
}
@@ -142,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