fix
wangpengfei
2023-08-18 3de2a199ae8449a66b8495d16051d61ef796a84c
model/followRecord.go
@@ -7,27 +7,28 @@
type (
   FollowRecord struct {
      Id                   int          `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      ClientId             int          `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户id"`
      ClientStatusId       int          `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:客户状态id"`
      ClientStatus         ClientStatus `json:"client_status" gorm:"foreignKey:ClientStatusId"`
      MemberId             int          `json:"member_id" gorm:"column:member_id;type:int(11);comment:跟进人id"`
      Member               User         `json:"member" gorm:"foreignKey:MemberId"`
      Number               string       `json:"number" gorm:"column:number;type:varchar(255);comment:跟进编号"`
      ContactId            int          `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:联系人id"`
      Topic                string       `json:"topic" gorm:"column:topic;type:varchar(255);comment:跟进主题"`
      Record               string       `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:跟进记录"`
      SaleChanceId         int          `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:销售机会id"`
      SaleChance           SaleChance   `json:"sale_chance" gorm:"foreignKey:SaleChanceId"`
      SalesLeadsId         int          `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:销售线索id"`
      SalesLeads           SalesLeads   `json:"sales_leads" gorm:"foreignKey:SalesLeadsId"`
      ContactInformationId int          `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:联系方式id"`
      FollowTime           *CustomTime  `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:跟进时间"`
      NextFollowTime       *CustomTime  `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:下次跟进时间"`
      Purpose              string       `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:跟进目的"`
      Content              string       `json:"content" gorm:"column:content;type:MEDIUMTEXT;comment:跟进内容"`
      Client               Client       `json:"client" gorm:"foreignKey:ClientId"`
      Contact              Contact      `json:"contact" gorm:"foreignKey:ContactId"`
      Id                   int                `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      ClientId             int                `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户id"`
      ClientStatusId       int                `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:客户状态id"`
      ClientStatus         ClientStatus       `json:"client_status" gorm:"foreignKey:ClientStatusId"`
      MemberId             int                `json:"member_id" gorm:"column:member_id;type:int(11);comment:跟进人id"`
      Member               User               `json:"member" gorm:"foreignKey:MemberId"`
      Number               string             `json:"number" gorm:"column:number;type:varchar(255);comment:跟进编号"`
      ContactId            int                `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:联系人id"`
      Topic                string             `json:"topic" gorm:"column:topic;type:varchar(255);comment:跟进主题"`
      Record               string             `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:跟进记录"`
      SaleChanceId         int                `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:销售机会id"`
      SaleChance           SaleChance         `json:"sale_chance" gorm:"foreignKey:SaleChanceId"`
      SalesLeadsId         int                `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:销售线索id"`
      SalesLeads           SalesLeads         `json:"sales_leads" gorm:"foreignKey:SalesLeadsId"`
      ContactInformationId int                `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:联系方式id"`
      FollowTime           *CustomTime        `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:跟进时间"`
      NextFollowTime       *CustomTime        `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:下次跟进时间"`
      Purpose              string             `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:跟进目的"`
      Content              string             `json:"content" gorm:"column:content;type:MEDIUMTEXT;comment:跟进内容"`
      Client               Client             `json:"client" gorm:"foreignKey:ClientId"`
      Contact              Contact            `json:"contact" gorm:"foreignKey:ContactId"`
      ContactInformation   ContactInformation `json:"contact_information" gorm:"foreignKey:ContactInformationId"`
      gorm.Model           `json:"-"`
   }
@@ -126,7 +127,7 @@
      db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
   }
   err := db.Preload("SalesLeads").Preload("SaleChance").Preload("ClientStatus").Preload("Member").Preload("Client").Preload("Contact").Order("id desc").Find(&records).Error
   err := db.Preload("SalesLeads").Preload("SaleChance").Preload("ClientStatus").Preload("Member").Preload("Client").Preload("Contact").Preload("ContactInformation").Order("id desc").Find(&records).Error
   return records, total, err
}