|
@@ -113,7 +113,8 @@ public class CommunityCommentController extends BaseController {
|
|
|
public AjaxResult comment(String articleId,
|
|
|
int currentPage,
|
|
|
int limit,
|
|
|
- @RequestParam(required = false) Long userId) {
|
|
|
+ @RequestParam(required = false) Long userId,
|
|
|
+ String commentId) {
|
|
|
if (Objects.isNull(articleId)) {
|
|
|
return AjaxResult.error("参数异常!");
|
|
|
}
|
|
@@ -125,11 +126,18 @@ public class CommunityCommentController extends BaseController {
|
|
|
|
|
|
try {
|
|
|
Page<CommunityArticleComment> page = new Page<>(currentPage, limit);
|
|
|
- List<CommunityArticleComment> records = communityArticleCommentService.page(page, new QueryWrapper<CommunityArticleComment>()
|
|
|
+ QueryWrapper<CommunityArticleComment> queryWrapper = new QueryWrapper<CommunityArticleComment>()
|
|
|
.eq("article_id", articleId)
|
|
|
.and((wrapper) -> {
|
|
|
wrapper.ne("is_delete", true).or().isNull("is_delete");
|
|
|
- }).orderByDesc("create_time")).getRecords();
|
|
|
+ }).orderByDesc("create_time");
|
|
|
+
|
|
|
+ // 只有在 commentId 不为空时才添加 id 的条件
|
|
|
+ if (commentId != null && !commentId.isEmpty()) {
|
|
|
+ queryWrapper.eq("id", commentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CommunityArticleComment> records = communityArticleCommentService.page(page, queryWrapper).getRecords();
|
|
|
|
|
|
CommunityArticleCommentVo commentVo = null;
|
|
|
|