From 51c1904dec60bc7bfc92c30ceb9ab3d4756ce462 Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期四, 20 七月 2023 16:41:29 +0800 Subject: [PATCH] fix --- model/orderManage.go | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/model/orderManage.go b/model/orderManage.go index fd9626f..3bb6f81 100644 --- a/model/orderManage.go +++ b/model/orderManage.go @@ -10,6 +10,7 @@ Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍚堝悓鍚嶇О"` 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:鑱旂郴浜篿d"` OrderType int `json:"orderType" gorm:"column:order_type;type:int;comment:宸ュ崟绫诲瀷"` @@ -70,7 +71,7 @@ func (slf *OrderManageSearch) FindAll() ([]*OrderManage, error) { var db = slf.build() var record = make([]*OrderManage, 0) - err := db.Find(&record).Error + err := db.Preload("Client").Find(&record).Error return record, err } -- Gitblit v1.8.0