From 10ca8371ece3ea79297dab05d486ae112da7b46a Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期二, 15 八月 2023 11:04:51 +0800 Subject: [PATCH] fix --- model/contract.go | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/model/contract.go b/model/contract.go index 04c87a3..1bef87d 100644 --- a/model/contract.go +++ b/model/contract.go @@ -9,7 +9,9 @@ Contract struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` + Client Client `json:"client" gorm:"foreignKey:ClientId"` MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` + Member User `json:"member" gorm:"foreignKey:MemberId"` Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鍚堝悓缂栧彿"` QuotationId int `json:"quotationId" gorm:"column:quotation_id;type:int;comment:鎶ヤ环鍗昳d"` Quotation Quotation `json:"quotation" gorm:"foreignKey:QuotationId;references:Id"` @@ -110,7 +112,7 @@ db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) } - err := db.Preload("Quotation").Order("id desc").Find(&records).Error + err := db.Preload("Client").Preload("Member").Preload("Quotation").Order("id desc").Find(&records).Error return records, total, err } -- Gitblit v1.8.0