fix
zhangqian
2023-08-10 8fab255a4509a7ec5bfc7439b6e352054d677e29
model/serviceFollowup.go
@@ -10,8 +10,10 @@
   ServiceFollowup struct {
      Id                   int                  `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      ClientId             int                  `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
      Client               Client               `json:"client" gorm:"foreignKey:ClientId"`
      Number               string               `json:"number" gorm:"column:number;type:varchar(255);comment:合同编号"`
      ContactId            int                  `json:"contactId" gorm:"column:contact_id;type:int;comment:联系人id"`
      Contact              Contact              `json:"contact"  gorm:"foreignKey:ContactId"`
      ServiceId            int                  `json:"serviceId" gorm:"column:service_id;type:int;comment:客户服务单id"`
      ServiceOrder         ServiceOrder         `gorm:"foreignKey:ServiceId"`
      CustomerServiceSheet CustomerServiceSheet `json:"customerServiceSheet" gorm:"foreignKey:ServiceId"`
@@ -36,6 +38,7 @@
      OrderBy     string
      PageNum     int
      PageSize    int
      Preload     bool
   }
)
@@ -69,6 +72,13 @@
   case constvar.ServiceFollowupKeywordSatisfactionDegree:
      db = db.Where("satisfaction_id = ?", slf.Keyword)
   }
   if slf.Preload {
      db = db.Preload("CustomerServiceSheet").
         Preload("ServiceOrder").
         Preload("Client").
         Preload("Contact")
   }
   return db
@@ -111,7 +121,7 @@
      db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
   }
   err := db.Preload("CustomerServiceSheet").Preload("ServiceOrder").Find(&records).Error
   err := db.Find(&records).Error
   return records, total, err
}
@@ -120,6 +130,11 @@
   return slf
}
func (slf *ServiceFollowupSearch) SetPreload(preload bool) *ServiceFollowupSearch {
   slf.Preload = preload
   return slf
}
func (slf *ServiceFollowupSearch) SetKeywordType(keyword constvar.ServiceFollowupKeywordType) *ServiceFollowupSearch {
   slf.KeywordType = keyword
   return slf