From 126bd860fef173507941e9afefacc2744f46a449 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 13 Oct 2023 11:19:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=9C=B0=E5=9B=BE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8E=82=E5=95=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dto/publishedGi/publishedGi.go | 5 +++-- service/publishedGi.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dto/publishedGi/publishedGi.go b/dto/publishedGi/publishedGi.go index 58d1d88..53b86be 100644 --- a/dto/publishedGi/publishedGi.go +++ b/dto/publishedGi/publishedGi.go @@ -13,10 +13,11 @@ type PublishedGiReqDto struct { } type PublishedGiListReqDto struct { - Name string `json:"name" form:"name"` + Name string `json:"name" form:"name"` + Type int32 `json:"type" form:"type"` + Category string `json:"category" form:"category"` Time dto.JsonTime `json:"time" form:"time" time_format:"2006-01-02 15:04:05"` - Type int32 `json:"type" form:"type"` } type PublishReqDto struct { diff --git a/service/publishedGi.go b/service/publishedGi.go index 3ea8471..b76b5f8 100644 --- a/service/publishedGi.go +++ b/service/publishedGi.go @@ -36,6 +36,9 @@ func ListQueryPublishedGi(req *publishedGi.PublishedGiListReqDto) []*publishedGi if req.Type != 0 { where = where.Where(dbquery.PublishedGi.Type.Eq(req.Type)) } + if req.Category != "" { + where = where.Where(dbquery.PublishedGi.Category.Eq(req.Category)) + } find, err := where.Debug().Find() if err != nil { panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})