| | |
| | | |
| | | type ( |
| | | 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"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:合同编号"` |
| | | ContactId int `json:"contactId" gorm:"column:contact_id;type:int;comment:联系人id"` |
| | | ServiceId int `json:"serviceId" gorm:"column:service_id;type:int;comment:客户服务单id"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:服务人员id"` |
| | | PlanId int `json:"planId" gorm:"column:plan_id;type:int;comment:服务计划id"` |
| | | Satisfaction int `json:"satisfaction" gorm:"column:satisfaction;type:int;comment:满意度"` |
| | | TimelyRate int `json:"timelyRate" gorm:"column:timely_rate;type:int;comment:及时率"` |
| | | SolveRate int `json:"solveRate" gorm:"column:solve_rate;type:int;comment:解决率"` |
| | | IsVisit int `json:"isVisit" gorm:"column:is_visit;type:int;comment:服务人员是否来过"` |
| | | OldMemberId int `json:"oldMemberId" gorm:"column:old_member_id;type:int;comment:原服务人员"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | File string `json:"file" gorm:"column:file;type:varchar(255);comment:附件"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:合同编号"` |
| | | ContactId int `json:"contactId" gorm:"column:contact_id;type:int;comment:联系人id"` |
| | | ServiceId int `json:"serviceId" gorm:"column:service_id;type:int;comment:客户服务单id"` |
| | | CustomerServiceSheet CustomerServiceSheet `json:"customerServiceSheet" gorm:"foreignKey:ServiceId"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:服务人员id"` |
| | | PlanId int `json:"planId" gorm:"column:plan_id;type:int;comment:服务计划id"` |
| | | SatisfactionId int `json:"satisfactionId" gorm:"column:satisfaction_id;type:int;comment:满意度id"` |
| | | TimelyRateId int `json:"timelyRateId" gorm:"column:timely_rate_id;type:int;comment:及时率id"` |
| | | SolveRateId int `json:"solveRateId" gorm:"column:solve_rate_id;type:int;comment:解决率id"` |
| | | IsVisitId int `json:"isVisitId" gorm:"column:is_visit_id;type:int;comment:服务人员是否来过id"` |
| | | OldMemberId int `json:"oldMemberId" gorm:"column:old_member_id;type:int;comment:原服务人员"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | File string `json:"file" gorm:"column:file;type:varchar(255);comment:附件"` |
| | | |
| | | gorm.Model `json:"-"` |
| | | } |
| | | |
| | | ServiceFollowupSearch struct { |
| | | ServiceFollowup |
| | | Orm *gorm.DB |
| | | |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | | |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | 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) |
| | | } |
| | |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *ServiceFollowupSearch) FindAll() ([]*ServiceFollowup, error) { |
| | | func (slf *ServiceFollowupSearch) FindAll() ([]*ServiceFollowup, int64, error) { |
| | | var db = slf.build() |
| | | var records = make([]*ServiceFollowup, 0) |
| | | err := db.Find(&records).Error |
| | | return records, err |
| | | var total int64 |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, err |
| | | } |
| | | if slf.PageNum > 0 && slf.PageSize > 0 { |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) |
| | | } |
| | | |
| | | if slf.PageNum > 0 && slf.PageSize > 0 { |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) |
| | | } |
| | | |
| | | err := db.Preload("CustomerServiceSheet").Find(&records).Error |
| | | return records, total, err |
| | | } |
| | | |
| | | func (slf *ServiceFollowupSearch) SetId(id int) *ServiceFollowupSearch { |
| | | slf.Id = id |
| | | return slf |
| | | } |
| | | |
| | | // 可能性 币种 当前状态(销售机会) |
| | | |
| | | 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 |
| | | } |