From 0409a5d0235f4a87ecf08b12baa9149279a90447 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 18 八月 2023 22:25:58 +0800
Subject: [PATCH] fix

---
 model/quotation.go |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/model/quotation.go b/model/quotation.go
index 6bd3f8b..091c34b 100644
--- a/model/quotation.go
+++ b/model/quotation.go
@@ -43,9 +43,12 @@
 	return "quotation"
 }
 
-func NewQuotationSearch() *QuotationSearch {
+func NewQuotationSearch(db *gorm.DB) *QuotationSearch {
+	if db == nil {
+		db = mysqlx.GetDB()
+	}
 	return &QuotationSearch{
-		Orm: mysqlx.GetDB(),
+		Orm: db,
 	}
 }
 
@@ -104,7 +107,7 @@
 func (slf *QuotationSearch) Find() (*Quotation, error) {
 	var db = slf.build()
 	var record Quotation
-	err := db.Preload("Client").Preload("Contact").Preload("SaleChance").First(&record).Error
+	err := db.Preload("Products").Preload("Client").Preload("Contact").Preload("SaleChance").First(&record).Error
 	return &record, err
 }
 

--
Gitblit v1.8.0