Browse Source

优化代码

fangqing 5 months ago
parent
commit
138f4375b8

+ 7 - 2
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityCommentController.java

@@ -327,8 +327,13 @@ public class CommunityCommentController extends BaseController {
         if (Objects.isNull(articleId)) {
             return AjaxResult.error("参数异常!");
         }
-        List<CommunityArticleComment> communityArticleComments = communityArticleCommentMapper.queryComment(articleId, comment);
-
+        List<CommunityArticleComment> communityArticleComments = null;
+        try {
+            communityArticleComments = communityArticleCommentMapper.queryComment(articleId, comment);
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            throw new ProjectException();
+        }
         return AjaxResult.success(communityArticleComments);
     }