From b932538cd4d2090ae82c790441002ad44b0da46a Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 21 七月 2023 13:37:02 +0800
Subject: [PATCH] add
---
model/orderManage.go | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/model/orderManage.go b/model/orderManage.go
index 8dde20b..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:宸ュ崟绫诲瀷"`
@@ -17,6 +18,7 @@
SourceSheet int `json:"sourceSheet" gorm:"column:source_sheet;type:int;comment:鏉ユ簮鍗曟嵁"`
ProblemDescription string `json:"problemDescription" gorm:"column:problem_description;type:text;comment:闂鎻忚堪"`
File string `json:"file" gorm:"column:file;type:varchar(255);comment:闄勪欢"`
+ gorm.Model `json:"-"`
}
OrderManageSearch struct {
@@ -69,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