From 1e034f4568c5a54378a2c80447ade3c120e99295 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 16 十月 2023 13:43:22 +0800 Subject: [PATCH] 销售机会列表返回联系人对象 --- model/saleChance.go | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/model/saleChance.go b/model/saleChance.go index a1ca0fd..86fcb5f 100644 --- a/model/saleChance.go +++ b/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:鑱旂郴浜篒D"` + 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 } -- Gitblit v1.8.0