From 17aaed743ab7a3520ec8eb9e4ab7c776ca807cdd Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期四, 12 十月 2023 20:43:16 +0800 Subject: [PATCH] bug修改 --- model/invoice.go | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/model/invoice.go b/model/invoice.go index 9145a6a..48ddcd2 100644 --- a/model/invoice.go +++ b/model/invoice.go @@ -53,12 +53,30 @@ } } +func (slf *InvoiceSearch) SetSourceType(sourceType constvar.InvoiceSourceType) *InvoiceSearch { + slf.SourceType = sourceType + return slf +} + +func (slf *InvoiceSearch) SetSourceId(sourceId int) *InvoiceSearch { + slf.SourceId = sourceId + return slf +} + func (slf *InvoiceSearch) build() *gorm.DB { var db = slf.Orm.Model(&Invoice{}) if slf.Id != 0 { db = db.Where("id = ?", slf.Id) } + if slf.SourceType > 0 { + db = db.Where("source_type = ?", slf.SourceType) + } + + if slf.SourceId > 0 { + db = db.Where("source_id = ?", slf.SourceId) + } + return db } -- Gitblit v1.8.0