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
83e7d388
Commit
83e7d388
authored
Jul 29, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复评论查询
parent
07dbf80d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+1
-1
CommentService.java
...main/java/com/tanpu/community/service/CommentService.java
+8
-5
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
83e7d388
...
...
@@ -121,7 +121,7 @@ public class CommentManager {
//更改举报状态
commentService
.
updateReportStatus
(
req
.
getCommentId
());
//写入举报记录表
CommentEntity
commentEntity
=
commentService
.
queryBy
CommentId
(
req
.
getCommentId
());
CommentEntity
commentEntity
=
commentService
.
queryBy
IdIncludeDelete
(
req
.
getCommentId
());
reportLogService
.
insert
(
ReportTypeEnum
.
COMMENT
,
userId
,
req
.
getCommentId
(),
commentEntity
.
getAuthorId
(),
req
.
getReason
());
}
...
...
community-service/src/main/java/com/tanpu/community/service/CommentService.java
View file @
83e7d388
...
...
@@ -47,7 +47,7 @@ public class CommentService {
}
public
CommentEntity
queryBy
CommentId
(
String
commmentId
)
{
public
CommentEntity
queryBy
IdIncludeDelete
(
String
commmentId
)
{
return
commentMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CommentEntity
>()
.
eq
(
CommentEntity:
:
getCommentId
,
commmentId
));
}
...
...
@@ -58,14 +58,16 @@ public class CommentService {
return
0
;
}
return
commentMapper
.
selectList
((
new
LambdaQueryWrapper
<
CommentEntity
>()
.
in
(
CommentEntity:
:
getThemeId
,
themeIds
)))
.
in
(
CommentEntity:
:
getThemeId
,
themeIds
))
.
eq
(
CommentEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
))
.
size
();
}
//统计主题集合的评论量
public
Integer
getCommentCountByThemeId
(
String
themeId
)
{
return
commentMapper
.
selectList
((
new
LambdaQueryWrapper
<
CommentEntity
>()
.
eq
(
CommentEntity:
:
getThemeId
,
themeId
)))
.
eq
(
CommentEntity:
:
getThemeId
,
themeId
))
.
eq
(
CommentEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
))
.
size
();
}
...
...
@@ -115,8 +117,9 @@ public class CommentService {
return
commentMapper
.
selectList
(
queryWrapper
);
}
//修改举报状态,可修改已删除
public
void
updateReportStatus
(
String
commentId
)
{
CommentEntity
commentEntity
=
queryBy
CommentId
(
commentId
);
CommentEntity
commentEntity
=
queryBy
IdIncludeDelete
(
commentId
);
if
(
commentEntity
==
null
)
{
throw
new
BizException
(
"评论未找到,id:"
+
commentId
);
}
...
...
@@ -128,7 +131,7 @@ public class CommentService {
//删除评论
@Transactional
public
void
delete
(
String
commentId
,
String
userId
)
{
CommentEntity
commentEntity
=
this
.
queryBy
CommentId
(
commentId
);
CommentEntity
commentEntity
=
this
.
queryBy
IdIncludeDelete
(
commentId
);
if
(
commentEntity
==
null
||
!
commentEntity
.
getAuthorId
().
equals
(
userId
)){
throw
new
BizException
(
"删除评论与用户不匹配,commentId:"
+
commentId
+
",userId:"
+
userId
);
}
...
...
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