mirror of https://github.com/halo-dev/halo
fix: issue of abnormal sorting in the aggregation query interface (#2623)
#### What type of PR is this? /kind bug /milestone 2.0 #### What this PR does / why we need it: 修复文章、自定义页面、评论聚合查询接口排序不固定的问题。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/2622 #### Special notes for your reviewer: 测试方式:检查 Console 端的文章、自定义页面、评论、回复的排序是否正常,需要多次刷新检查。 ```release-note 修复文章、自定义页面、评论聚合查询接口排序不固定的问题。 ```pull/2626/head
parent
d2aa707071
commit
95f0809042
|
@ -52,7 +52,7 @@ public class CommentServiceImpl implements CommentService {
|
||||||
commentQuery.getPage(), commentQuery.getSize())
|
commentQuery.getPage(), commentQuery.getSize())
|
||||||
.flatMap(comments -> Flux.fromStream(comments.get()
|
.flatMap(comments -> Flux.fromStream(comments.get()
|
||||||
.map(this::toListedComment))
|
.map(this::toListedComment))
|
||||||
.flatMap(Function.identity())
|
.concatMap(Function.identity())
|
||||||
.collectList()
|
.collectList()
|
||||||
.map(list -> new ListResult<>(comments.getPage(), comments.getSize(),
|
.map(list -> new ListResult<>(comments.getPage(), comments.getSize(),
|
||||||
comments.getTotal(), list)
|
comments.getTotal(), list)
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class ReplyServiceImpl implements ReplyService {
|
||||||
query.getPage(), query.getSize())
|
query.getPage(), query.getSize())
|
||||||
.flatMap(list -> Flux.fromStream(list.get()
|
.flatMap(list -> Flux.fromStream(list.get()
|
||||||
.map(this::toListedReply))
|
.map(this::toListedReply))
|
||||||
.flatMap(Function.identity())
|
.concatMap(Function.identity())
|
||||||
.collectList()
|
.collectList()
|
||||||
.map(listedReplies -> new ListResult<>(list.getPage(), list.getSize(),
|
.map(listedReplies -> new ListResult<>(list.getPage(), list.getSize(),
|
||||||
list.getTotal(), listedReplies))
|
list.getTotal(), listedReplies))
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class PostServiceImpl implements PostService {
|
||||||
.flatMap(listResult -> Flux.fromStream(
|
.flatMap(listResult -> Flux.fromStream(
|
||||||
listResult.get().map(this::getListedPost)
|
listResult.get().map(this::getListedPost)
|
||||||
)
|
)
|
||||||
.flatMap(Function.identity())
|
.concatMap(Function.identity())
|
||||||
.collectList()
|
.collectList()
|
||||||
.map(listedPosts -> new ListResult<>(listResult.getPage(), listResult.getSize(),
|
.map(listedPosts -> new ListResult<>(listResult.getPage(), listResult.getSize(),
|
||||||
listResult.getTotal(), listedPosts)
|
listResult.getTotal(), listedPosts)
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class SinglePageServiceImpl implements SinglePageService {
|
||||||
.flatMap(listResult -> Flux.fromStream(
|
.flatMap(listResult -> Flux.fromStream(
|
||||||
listResult.get().map(this::getListedSinglePage)
|
listResult.get().map(this::getListedSinglePage)
|
||||||
)
|
)
|
||||||
.flatMap(Function.identity())
|
.concatMap(Function.identity())
|
||||||
.collectList()
|
.collectList()
|
||||||
.map(listedSinglePages -> new ListResult<>(listResult.getPage(),
|
.map(listedSinglePages -> new ListResult<>(listResult.getPage(),
|
||||||
listResult.getSize(),
|
listResult.getSize(),
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CommentFinderImpl implements CommentFinder {
|
||||||
defaultComparator(),
|
defaultComparator(),
|
||||||
pageNullSafe(page), sizeNullSafe(size))
|
pageNullSafe(page), sizeNullSafe(size))
|
||||||
.flatMap(list -> Flux.fromStream(list.get().map(this::toCommentVo))
|
.flatMap(list -> Flux.fromStream(list.get().map(this::toCommentVo))
|
||||||
.flatMap(Function.identity())
|
.concatMap(Function.identity())
|
||||||
.collectList()
|
.collectList()
|
||||||
.map(commentVos -> new ListResult<>(list.getPage(), list.getSize(), list.getTotal(),
|
.map(commentVos -> new ListResult<>(list.getPage(), list.getSize(), list.getTotal(),
|
||||||
commentVos)
|
commentVos)
|
||||||
|
@ -68,7 +68,7 @@ public class CommentFinderImpl implements CommentFinder {
|
||||||
&& Objects.equals(true, reply.getSpec().getApproved()),
|
&& Objects.equals(true, reply.getSpec().getApproved()),
|
||||||
comparator.reversed(), pageNullSafe(page), sizeNullSafe(size))
|
comparator.reversed(), pageNullSafe(page), sizeNullSafe(size))
|
||||||
.flatMap(list -> Flux.fromStream(list.get().map(this::toReplyVo))
|
.flatMap(list -> Flux.fromStream(list.get().map(this::toReplyVo))
|
||||||
.flatMap(Function.identity())
|
.concatMap(Function.identity())
|
||||||
.collectList()
|
.collectList()
|
||||||
.map(replyVos -> new ListResult<>(list.getPage(), list.getSize(), list.getTotal(),
|
.map(replyVos -> new ListResult<>(list.getPage(), list.getSize(), list.getTotal(),
|
||||||
replyVos))
|
replyVos))
|
||||||
|
|
Loading…
Reference in New Issue