fix(invoice):修正对于发票的检索。

This commit is contained in:
徐涛 2023-06-27 17:01:14 +08:00
parent b7eaaffc3a
commit 9dc846c044

View File

@ -40,6 +40,7 @@ func (ir _InvoiceRepository) ListInvoice(pid *string, startDate, endDate *types.
Select("i.*") Select("i.*")
countQuery := ir.ds. countQuery := ir.ds.
From(goqu.T("invoice").As("i")). From(goqu.T("invoice").As("i")).
Join(goqu.T("tenement").As("t"), goqu.On(goqu.I("i.tenement_id").Eq(goqu.I("t.id")))).
Select(goqu.COUNT("*")) Select(goqu.COUNT("*"))
if pid != nil && len(*pid) > 0 { if pid != nil && len(*pid) > 0 {
@ -76,8 +77,10 @@ func (ir _InvoiceRepository) ListInvoice(pid *string, startDate, endDate *types.
if endDate != nil { if endDate != nil {
queryRange.SetUpper(endDate.ToEndingOfDate()) queryRange.SetUpper(endDate.ToEndingOfDate())
} }
invoiceQuery = invoiceQuery.Where(goqu.L("i.issued_at <@ ?", queryRange)) if !queryRange.IsEmptyOrWild() {
countQuery = countQuery.Where(goqu.L("i.issued_at <@ ?", queryRange)) invoiceQuery = invoiceQuery.Where(goqu.L("i.issued_at <@ ?", queryRange))
countQuery = countQuery.Where(goqu.L("i.issued_at <@ ?", queryRange))
}
startRow := (page - 1) * config.ServiceSettings.ItemsPageSize startRow := (page - 1) * config.ServiceSettings.ItemsPageSize
invoiceQuery = invoiceQuery. invoiceQuery = invoiceQuery.