From 3905ec8b8d2184fdd716e6eef4cb42e943eb9400 Mon Sep 17 00:00:00 2001 From: Roozen <93673944+Roozenlz@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:54:56 +0800 Subject: [PATCH] fix: change the ref parameter type in the list method of comment finder api to map (#4773) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug #### What this PR does / why we need it: 在主题使用如下FinderAPI时 ![image](https://github.com/halo-dev/halo/assets/93673944/723e9f4e-0192-48e4-be18-2300579215bd) 将产生如下错误 ![image](https://github.com/halo-dev/halo/assets/93673944/d36c9dd7-d754-4d41-a6d2-06027359bb4e) 因为方法定义为 ![image](https://github.com/halo-dev/halo/assets/93673944/a3b95df3-96f8-427e-b9c0-7e97e5d2335d) 所以修改方法参数 #### Which issue(s) this PR fixes: Fixes # #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note NONE ``` --- .../run/halo/app/theme/finders/CommentFinder.java | 4 ++-- .../app/theme/finders/impl/CommentFinderImpl.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/run/halo/app/theme/finders/CommentFinder.java b/application/src/main/java/run/halo/app/theme/finders/CommentFinder.java index a8cb0a2107..88a22a34bf 100644 --- a/application/src/main/java/run/halo/app/theme/finders/CommentFinder.java +++ b/application/src/main/java/run/halo/app/theme/finders/CommentFinder.java @@ -1,10 +1,10 @@ package run.halo.app.theme.finders; +import java.util.Map; import org.springframework.lang.Nullable; import reactor.core.publisher.Mono; import run.halo.app.core.extension.content.Comment; import run.halo.app.extension.ListResult; -import run.halo.app.extension.Ref; import run.halo.app.theme.finders.vo.CommentVo; import run.halo.app.theme.finders.vo.ReplyVo; @@ -18,7 +18,7 @@ public interface CommentFinder { Mono getByName(String name); - Mono> list(@Nullable Ref ref, @Nullable Integer page, + Mono> list(@Nullable Map ref, @Nullable Integer page, @Nullable Integer size); Mono> listReply(String commentName, @Nullable Integer page, diff --git a/application/src/main/java/run/halo/app/theme/finders/impl/CommentFinderImpl.java b/application/src/main/java/run/halo/app/theme/finders/impl/CommentFinderImpl.java index 184537a81d..08c6e4c53b 100644 --- a/application/src/main/java/run/halo/app/theme/finders/impl/CommentFinderImpl.java +++ b/application/src/main/java/run/halo/app/theme/finders/impl/CommentFinderImpl.java @@ -1,5 +1,6 @@ package run.halo.app.theme.finders.impl; +import java.util.Map; import lombok.RequiredArgsConstructor; import reactor.core.publisher.Mono; import run.halo.app.extension.ListResult; @@ -28,7 +29,15 @@ public Mono getByName(String name) { } @Override - public Mono> list(Ref ref, Integer page, Integer size) { + public Mono> list(Map map, Integer page, Integer size) { + if (map == null) { + return commentPublicQueryService.list(null, page, size); + } + Ref ref = new Ref(); + ref.setGroup(map.get("group")); + ref.setVersion(map.get("version")); + ref.setKind(map.get("kind")); + ref.setName(map.get("name")); return commentPublicQueryService.list(ref, page, size); }