Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
e0d53782
Commit
e0d53782
authored
Feb 25, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
递归删除评论的回复 fix
parent
647df1e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+3
-2
CommentService.java
...main/java/com/tanpu/community/service/CommentService.java
+16
-0
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
e0d53782
...
...
@@ -241,8 +241,9 @@ public class CommentManager {
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
commentEntity
.
getThemeId
());
notificationService
.
deleteCommentNotify
(
themeEntity
.
getAuthorId
(),
userId
,
commentId
,
commentEntity
.
getCreateTime
());
// 递归
commentId
=
commentEntity
.
getReplyId
();
userId
=
commentEntity
.
getReplyUserId
();
CommentEntity
replyForComment
=
commentService
.
queryReplyForComment
(
commentId
);
commentId
=
replyForComment
.
getCommentId
();
userId
=
replyForComment
.
getAuthorId
();
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/CommentService.java
View file @
e0d53782
...
...
@@ -224,4 +224,20 @@ public class CommentService {
}
}
/**
* 获取对该评论的回复,如果没有则返回空对象
* @param commentId
* @return
*/
public
CommentEntity
queryReplyForComment
(
String
commentId
)
{
List
<
CommentEntity
>
replies
=
commentMapper
.
selectList
(
new
LambdaQueryWrapper
<
CommentEntity
>()
.
eq
(
CommentEntity:
:
getReplyId
,
commentId
)
.
eq
(
CommentEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
));
if
(
CollectionUtils
.
isEmpty
(
replies
)){
return
replies
.
get
(
0
);
}
else
{
return
new
CommentEntity
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment