zhangqian
2023-10-16 1e034f4568c5a54378a2c80447ade3c120e99295
销售机会列表返回联系人对象
1个文件已修改
7 ■■■■ 已修改文件
model/saleChance.go 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/saleChance.go
@@ -11,6 +11,7 @@
        Name                  string                 `json:"name" gorm:"column:name;type:varchar(255);comment:公司名称"`
        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"`
        Contact               Contact                `json:"contact" gorm:"foreignKey:ContactId;references:Id"`
        ClientId              int                    `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户ID"`
        SalesSourcesId        int                    `json:"sales_sources_id" gorm:"column:sales_sources_id;type:int(11);comment:商机来源ID"`
        SaleTypeId            int                    `json:"sale_type_id" gorm:"column:sale_type_id;type:int(11);comment:商机类型ID"`
@@ -42,7 +43,6 @@
        Threats               string                 `json:"threats" gorm:"column:threats;type:text;comment:竞争威胁"`
        DetailAddress         string                 `json:"detail_address" gorm:"column:detail_address;type:text;comment:详细地址"`
        Remark                string                 `json:"remark" gorm:"column:remark;type:text;comment:备注"`
        Contact               Contact                `json:"contact" gorm:"foreignKey:ContactId;references:Id"`
        Client                Client                 `json:"client" gorm:"foreignKey:ClientId;references:Id"`
        CollectionProjections []CollectionProjection `json:"collection_projections" gorm:"foreignKey:SaleChanceId"`
        SalesSources          SalesSources           `json:"sales_sources"`
@@ -160,7 +160,10 @@
        db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
    }
    err := db.Preload("SaleType").Preload("RegularCustomers").Preload("SalesSources").Preload("Member").Preload("SaleStage").Preload("Possibility").Preload("CollectionProjections").Preload("Client").Preload("Province").Preload("City").Order("id desc").Find(&records).Error
    err := db.Preload("SaleType").Preload("RegularCustomers").Preload("SalesSources").
        Preload("Member").Preload("SaleStage").Preload("Possibility").
        Preload("CollectionProjections").Preload("Client").
        Preload("Province").Preload("City").Preload("Contact").Order("id desc").Find(&records).Error
    return records, total, err
}