1. (Mission 수행) 글을 읽었을 때 isDel="Y"이면 삭제된 글이라는 메세지 나오도록
BoardDTO.java
- 삭제여부를 확인하는 isDel 값을 가져오는 코드 추가
private String isDel; // 삭제 여부 확인
BoardService.java
- 글을 읽었을 때 isDel="Y"이면 삭제된 글이라는 메세지를 출력하는 비즈니스 로직 추가
public ApiResponse<BoardDTO> getBoardById(int id) {
BoardDTO data = boardDAO.getBoardById(id);
List<CommentDTO> commentsById = commentDAO.getCommentsById(id);
data.setComments(commentsById);
String deletedData = data.getIsDel();
log.debug("deletedData = " + deletedData);
if (deletedData.equals("Y")){
return new ApiResponse(false, "board id " + id + " is already deleted.");
}
return new ApiResponse(true, data);
}
'Springboot' 카테고리의 다른 글
2021-10-20 (Springboot - /authenticate (Sequence Diagram)) (0) | 2021.10.21 |
---|---|
2021-10-12 (Springboot - token 로그인 ) (0) | 2021.10.13 |
2021-10-07 (Springboot - board테이블 - 글읽기 수정 ) (0) | 2021.10.07 |
2021-10-06 (Springboot - comment테이블 - 댓글 쓰기 수정) (0) | 2021.10.06 |
2021-10-05 (Springboot - Board테이블 - 글 전체보기 수정 ) (0) | 2021.10.05 |