删除comment

This commit is contained in:
cyk 2023-12-28 22:33:34 +08:00
parent 6eb6491c87
commit c0dbd67912
5 changed files with 7 additions and 5 deletions

View File

@ -71,7 +71,7 @@ public class CommentController {
} }
@RequestMapping("/comment/deleteByCommentId") @RequestMapping("/comment/deleteByCommentId")
public String deleteByCommentId(String commentId) public String deleteByCommentId(Integer commentId)
{ {
HashMap<String, Object> result = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
result.put("code", 200); result.put("code", 200);

View File

@ -44,5 +44,5 @@ public interface CommentDao {
List<CommentNode> querySecondCommentList(Integer UrlId); List<CommentNode> querySecondCommentList(Integer UrlId);
public String queryChildId(String commentId); public String queryChildId(Integer commentId);
} }

View File

@ -27,5 +27,5 @@ public interface CommentService {
CommentUser queryCommentUserById(Integer id); CommentUser queryCommentUserById(Integer id);
public String SelectChildAndDelete(String commentId); public String SelectChildAndDelete(Integer commentId);
} }

View File

@ -179,7 +179,7 @@ public class CommentServiceImpl implements CommentService {
} }
return firstList; return firstList;
} }
public String SelectChildAndDelete(String commentId) public String SelectChildAndDelete(Integer commentId)
{ {
String child = commentDao.queryChildId(commentId); String child = commentDao.queryChildId(commentId);

View File

@ -56,7 +56,7 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<select id="queryChildId" parameterType="java.lang.String" resultType="java.lang.String"> <select id="queryChildId" parameterType="java.lang.Integer" resultType="java.lang.String">
SELECT t3.ischild SELECT t3.ischild
FROM(SELECT t1.*, FROM(SELECT t1.*,
IF (FIND_IN_SET(root_comment_id, @pids) > 0,@pids := CONCAT(@pids, ',', id),'0') AS ischild IF (FIND_IN_SET(root_comment_id, @pids) > 0,@pids := CONCAT(@pids, ',', id),'0') AS ischild
@ -65,6 +65,8 @@
ORDER BY t.id ASC) t1, ORDER BY t.id ASC) t1,
(SELECT @pids := #{commentId,jdbcType=INTEGER}) t2) t3 (SELECT @pids := #{commentId,jdbcType=INTEGER}) t2) t3
WHERE ischild != '0' WHERE ischild != '0'
order by id desc
limit 1
</select> </select>