댓글삭제 로직 수정
This commit is contained in:
parent
e099a65006
commit
4241859180
@ -247,21 +247,21 @@ public class localbordService {
|
||||
// 대댓글이 없는 경우, 완전 삭제
|
||||
boardMapper.deleteComment(commentId);
|
||||
}
|
||||
checkAndDeleteParentComment(map);
|
||||
// checkAndDeleteParentComment(map);
|
||||
}
|
||||
|
||||
private void checkAndDeleteParentComment(MapDto map) {
|
||||
Long parentId = (Long) map.get("LOCCMTPNT");
|
||||
if (parentId == null) return; // 부모가 없으면 종료
|
||||
|
||||
// 부모 댓글의 남아있는 대댓글 개수 확인
|
||||
int remainingReplies = boardMapper.selectReplyCount(parentId);
|
||||
|
||||
if (remainingReplies == 0) {
|
||||
// 남은 대댓글이 없으면 부모 댓글도 삭제
|
||||
boardMapper.deleteComment(parentId);
|
||||
}
|
||||
}
|
||||
// private void checkAndDeleteParentComment(MapDto map) {
|
||||
// Long parentId = (Long) map.get("LOCCMTPNT");
|
||||
// if (parentId == null) return; // 부모가 없으면 종료
|
||||
//
|
||||
// // 부모 댓글의 남아있는 대댓글 개수 확인
|
||||
// int remainingReplies = boardMapper.selectReplyCount(parentId);
|
||||
//
|
||||
// if (remainingReplies == 0) {
|
||||
// // 남은 대댓글이 없으면 부모 댓글도 삭제
|
||||
// boardMapper.deleteComment(parentId);
|
||||
// }
|
||||
// }
|
||||
|
||||
public String selectCommentPassword(int commentId) {
|
||||
return boardMapper.selectCommentPassword(commentId);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user