From bd379cf89e0091f931cd1db569560dd4fe63ad3b Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期三, 03 一月 2024 15:00:28 +0800 Subject: [PATCH] 报价单统计 --- model/quotation.go | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/model/quotation.go b/model/quotation.go index 2ea3ad6..c4618ee 100644 --- a/model/quotation.go +++ b/model/quotation.go @@ -65,6 +65,9 @@ if slf.Number != "" { db = db.Where("number = ?", slf.Number) } + if slf.QuotationStatusId != 0 { + db = db.Where("quotation_status_id = ?", slf.QuotationStatusId) + } if len(slf.SearchMap) > 0 { for key, value := range slf.SearchMap { @@ -134,7 +137,7 @@ db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) } - err := db.Preload("Products").Preload("Member").Preload("QuotationStatus").Preload("Client").Preload("Contact").Order("id desc").Find(&records).Error + err := db.Preload("Products").Preload("Member").Preload("QuotationStatus").Preload("Client").Preload("Contact").Preload("SaleChance").Order("id desc").Find(&records).Error return records, total, err } @@ -191,7 +194,13 @@ slf.Number = number return slf } + func (slf *QuotationSearch) SetIds(ids []int) *QuotationSearch { slf.Orm = slf.Orm.Where("id in (?)", ids) return slf } + +func (slf *QuotationSearch) SetQuotationStatusId(id int) *QuotationSearch { + slf.QuotationStatusId = id + return slf +} -- Gitblit v1.8.0