Skip to content

Commit

Permalink
减少转换器中不必要的参数
Browse files Browse the repository at this point in the history
  • Loading branch information
Lixuhuilll committed Jan 3, 2024
1 parent 74170cd commit 0504e3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public interface CommentConverter {
@Mapping(target = "like", source = "commentsArea.likeCount")
@Mapping(target = "dislike", source = "commentsArea.dislikeCount")
@Mapping(target = "uploader", source = "maaUser.userName")
@Mapping(target = "commentId", source = "id")
@Mapping(target = "commentId", source = "commentsArea.id")
@Mapping(target = "subCommentsInfos", ignore = true)
CommentsInfo toCommentsInfo(CommentsArea commentsArea, String id, MaaUser maaUser);
CommentsInfo toCommentsInfo(CommentsArea commentsArea, MaaUser maaUser);


@Mapping(target = "like", source = "commentsArea.likeCount")
@Mapping(target = "dislike", source = "commentsArea.dislikeCount")
@Mapping(target = "uploader", source = "maaUser.userName")
@Mapping(target = "commentId", source = "id")
@Mapping(target = "deleted", source = "delete")
SubCommentsInfo toSubCommentsInfo(CommentsArea commentsArea, String id, MaaUser maaUser, boolean delete);
@Mapping(target = "commentId", source = "commentsArea.id")
@Mapping(target = "deleted", source = "commentsArea.delete")
SubCommentsInfo toSubCommentsInfo(CommentsArea commentsArea, MaaUser maaUser);
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ public CommentsAreaInfo queriesCommentsArea(CommentsQueriesDTO request) {
commentConverter
.toCommentsInfo(
mainComment
, mainComment.getId()
, maaUserMap.getOrDefault(
mainComment.getUploaderId()
, UNKNOWN_USER
Expand All @@ -354,13 +353,11 @@ public CommentsAreaInfo queriesCommentsArea(CommentsQueriesDTO request) {
commentConverter
.toSubCommentsInfo(
subComment
, subComment.getId()
//填充评论用户名
, maaUserMap.getOrDefault(
subComment.getUploaderId(),
UNKNOWN_USER
)
, subComment.isDelete()
)
).toList();

Expand Down

0 comments on commit 0504e3e

Please sign in to comment.