From fcf9ca674437d124a852356aa93bf136fb4644a9 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 23 May 2025 14:14:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E8=AF=84=E8=AE=BA1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseClinicalArticleController.java | 16 +++++++++------- .../controller/CaseClinicalVideoController.java | 17 ++++++++++------- .../getClinicalArticleCommentPage.java | 4 ++++ .../getClinicalVideoCommentPage.java | 4 ++++ 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/example/caseData/controller/CaseClinicalArticleController.java b/src/main/java/com/example/caseData/controller/CaseClinicalArticleController.java index 316acca..c321d67 100644 --- a/src/main/java/com/example/caseData/controller/CaseClinicalArticleController.java +++ b/src/main/java/com/example/caseData/controller/CaseClinicalArticleController.java @@ -315,14 +315,16 @@ public class CaseClinicalArticleController { dto.setUserIden(null); // 获取次级评论 - if (dto.getRootId() == null){ - List subComments = userCommentClinicalArticleDao.getClinicalArticleCommentList( - dto.getArticleId(), - dto.getCommentId(), - 5 - ); + if (request.getIsHaveSubComment() == 1){ + if (dto.getRootId() == null){ + List subComments = userCommentClinicalArticleDao.getClinicalArticleCommentList( + dto.getArticleId(), + dto.getCommentId(), + 5 + ); - dto.setSubComment(subComments); + dto.setSubComment(subComments); + } } } diff --git a/src/main/java/com/example/caseData/controller/CaseClinicalVideoController.java b/src/main/java/com/example/caseData/controller/CaseClinicalVideoController.java index e3ce9f5..688e049 100644 --- a/src/main/java/com/example/caseData/controller/CaseClinicalVideoController.java +++ b/src/main/java/com/example/caseData/controller/CaseClinicalVideoController.java @@ -7,6 +7,7 @@ import com.example.caseData.common.Response; import com.example.caseData.dao.*; import com.example.caseData.dto.T; import com.example.caseData.dto.caseClinicalVideo.CaseClinicalVideoDto; +import com.example.caseData.dto.userCommentClinicalArticle.UserCommentClinicalArticleDto; import com.example.caseData.dto.userCommentClinicalVideo.UserCommentClinicalVideoDto; import com.example.caseData.exception.BusinessException; import com.example.caseData.model.*; @@ -313,14 +314,16 @@ public class CaseClinicalVideoController { dto.setUserIden(null); // 获取次级评论 - if (dto.getRootId() == null){ - List subComments = userCommentClinicalVideoDao.getClinicalVideoCommentList( - dto.getVideoId(), - dto.getCommentId(), - 5 - ); + if (request.getIsHaveSubComment() == 1){ + if (dto.getRootId() == null){ + List subComments = userCommentClinicalVideoDao.getClinicalVideoCommentList( + dto.getVideoId(), + dto.getCommentId(), + 5 + ); - dto.setSubComment(subComments); + dto.setSubComment(subComments); + } } } diff --git a/src/main/java/com/example/caseData/request/CaseClinicalArticleRequest/getClinicalArticleCommentPage.java b/src/main/java/com/example/caseData/request/CaseClinicalArticleRequest/getClinicalArticleCommentPage.java index 9afdf8f..116a0e0 100644 --- a/src/main/java/com/example/caseData/request/CaseClinicalArticleRequest/getClinicalArticleCommentPage.java +++ b/src/main/java/com/example/caseData/request/CaseClinicalArticleRequest/getClinicalArticleCommentPage.java @@ -29,6 +29,10 @@ public class getClinicalArticleCommentPage { @JsonProperty("root_id") private String rootId; + // 是否需要子评论(0:否 1:是) + @JsonProperty("is_have_sub_comment") + private Integer isHaveSubComment; + // ✅ 校验分页参数 public void validateForPage() { // 如果 page 为空,设为默认值 1 diff --git a/src/main/java/com/example/caseData/request/CaseClinicalVideoRequest/getClinicalVideoCommentPage.java b/src/main/java/com/example/caseData/request/CaseClinicalVideoRequest/getClinicalVideoCommentPage.java index d313edd..8b1ec75 100644 --- a/src/main/java/com/example/caseData/request/CaseClinicalVideoRequest/getClinicalVideoCommentPage.java +++ b/src/main/java/com/example/caseData/request/CaseClinicalVideoRequest/getClinicalVideoCommentPage.java @@ -25,6 +25,10 @@ public class getClinicalVideoCommentPage { @JsonProperty("root_id") private String rootId; + // 是否需要子评论(0:否 1:是) + @JsonProperty("is_have_sub_comment") + private Integer isHaveSubComment; + // ✅ 校验分页参数 public void validateForPage() { // 如果 page 为空,设为默认值 1