From d39c3082502f9aa42d2bdb9e65e0990a2be7c584 Mon Sep 17 00:00:00 2001 From: Zhang HaoYang <1304907854@qq.com> Date: Fri, 29 Dec 2023 01:40:51 +0800 Subject: [PATCH] 1231231231231231312312 --- .../com/lovenav/service/serviceImpl/CommentServiceImpl.java | 5 +++++ src/main/resources/mybatis/CommentDao.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lovenav/service/serviceImpl/CommentServiceImpl.java b/src/main/java/com/lovenav/service/serviceImpl/CommentServiceImpl.java index ed58299..e94ba40 100644 --- a/src/main/java/com/lovenav/service/serviceImpl/CommentServiceImpl.java +++ b/src/main/java/com/lovenav/service/serviceImpl/CommentServiceImpl.java @@ -183,6 +183,11 @@ public class CommentServiceImpl implements CommentService { { String child = commentDao.queryChildId(commentId); + if(child == null) + { + commentDao.deleteByPrimaryKey(commentId); + return "处理完成"; + } String [] childrens = child.split(","); int flag = 0; for(String id : childrens) diff --git a/src/main/resources/mybatis/CommentDao.xml b/src/main/resources/mybatis/CommentDao.xml index 427894a..fdc80df 100644 --- a/src/main/resources/mybatis/CommentDao.xml +++ b/src/main/resources/mybatis/CommentDao.xml @@ -64,7 +64,7 @@ FROM ln_comment AS t ORDER BY t.id ASC) t1, (SELECT @pids := #{commentId,jdbcType=INTEGER}) t2) t3 - WHERE ischild != '0' and id = #{commentId,jdbcType=INTEGER} + WHERE ischild != '0' order by id desc limit 1