From 3369456ac6de01e8703a9b38537406ec7c550bc5 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 25 八月 2023 11:05:45 +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