게시판 삭제 수정

This commit is contained in:
dyhj625 2025-03-27 10:55:57 +09:00
parent 01f936a407
commit 92119be6fa
3 changed files with 22 additions and 13 deletions

View File

@ -128,6 +128,8 @@ public interface localbordMapper {
int deleteTrashFileData(FileVo vo); int deleteTrashFileData(FileVo vo);
void deleteGoodOrBadByCommentId(MapDto map);
} }

View File

@ -266,21 +266,22 @@ public class localbordService {
// 대댓글이 없는 경우, 완전 삭제 // 대댓글이 없는 경우, 완전 삭제
boardMapper.deleteComment(commentId); boardMapper.deleteComment(commentId);
} }
// checkAndDeleteParentComment(map); checkAndDeleteParentComment(map);
boardMapper.deleteGoodOrBadByCommentId(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);

View File

@ -201,6 +201,12 @@
WHERE LOCBRDSEQ = #{LOCBRDSEQ} WHERE LOCBRDSEQ = #{LOCBRDSEQ}
</delete> </delete>
<!-- 댓글 및 대댓글 삭제 시 좋아요/싫어요 삭제 -->
<delete id="deleteGoodOrBadByCommentId">
DELETE FROM localgorb
WHERE LOCCMTSEQ = #{LOCCMTSEQ}
</delete>
<!-- 게시물 수정 --> <!-- 게시물 수정 -->
<update id="updateBoard"> <update id="updateBoard">
UPDATE localbord UPDATE localbord