From 08eae4fc75fe36b66d4c3c4d32675004e35df4f0 Mon Sep 17 00:00:00 2001 From: RunsTp Date: Tue, 7 Mar 2023 22:53:51 +0800 Subject: [PATCH] =?UTF-8?q?[feature]=20#18=20#30=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/app/api/service/bilbil_video.go | 1 + internal/repository/bilbil_video_pg.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/app/api/service/bilbil_video.go b/internal/app/api/service/bilbil_video.go index 4a69c42..f6d81ea 100644 --- a/internal/app/api/service/bilbil_video.go +++ b/internal/app/api/service/bilbil_video.go @@ -105,6 +105,7 @@ func queryCheck() map[string]func(item query_parser.QueryItem) (bool, string) { return map[string]func(item query_parser.QueryItem) (bool, string){ "tag": _stringCheck, "name": _stringCheck, + "title": _stringCheck, "mid": _numericCheck, "view": _numericCheck, "pubdate": _numericCheck, diff --git a/internal/repository/bilbil_video_pg.go b/internal/repository/bilbil_video_pg.go index 81dddf2..a135c6c 100644 --- a/internal/repository/bilbil_video_pg.go +++ b/internal/repository/bilbil_video_pg.go @@ -102,7 +102,7 @@ func (impl *BilibiliVideoPostgresImpl) builderQueryItems(tx *gorm.DB, queryItems switch item.Type { case query_parser.TypeAND: for _, value := range item.Values { - tx = tx.Where(fmt.Sprintf("%s = ?", item.Key), value) + tx = tx.Where(fmt.Sprintf("%s LIKE ?", item.Key), "%"+value+"%") } case query_parser.TypeOR: tx = tx.Where(fmt.Sprintf("%s IN (?)", item.Key), item.Values)