댓글삭제 로직 수정

This commit is contained in:
dyhj625 2025-03-25 14:59:27 +09:00
parent e099a65006
commit 4241859180

View File

@ -247,21 +247,21 @@ public class localbordService {
// 대댓글이 없는 경우, 완전 삭제 // 대댓글이 없는 경우, 완전 삭제
boardMapper.deleteComment(commentId); boardMapper.deleteComment(commentId);
} }
checkAndDeleteParentComment(map); // checkAndDeleteParentComment(map);
} }
private void checkAndDeleteParentComment(MapDto map) { // private void checkAndDeleteParentComment(MapDto map) {
Long parentId = (Long) map.get("LOCCMTPNT"); // Long parentId = (Long) map.get("LOCCMTPNT");
if (parentId == null) return; // 부모가 없으면 종료 // if (parentId == null) return; // 부모가 없으면 종료
//
// 부모 댓글의 남아있는 대댓글 개수 확인 // // 부모 댓글의 남아있는 대댓글 개수 확인
int remainingReplies = boardMapper.selectReplyCount(parentId); // int remainingReplies = boardMapper.selectReplyCount(parentId);
//
if (remainingReplies == 0) { // if (remainingReplies == 0) {
// 남은 대댓글이 없으면 부모 댓글도 삭제 // // 남은 대댓글이 없으면 부모 댓글도 삭제
boardMapper.deleteComment(parentId); // boardMapper.deleteComment(parentId);
} // }
} // }
public String selectCommentPassword(int commentId) { public String selectCommentPassword(int commentId) {
return boardMapper.selectCommentPassword(commentId); return boardMapper.selectCommentPassword(commentId);