| 9 | import java.util.*; |
| 10 | |
| 11 | @Service |
| 12 | public class CommentServiceImpl implements CommentService { |
| 13 | @Autowired |
| 14 | BoardDao boardDao; |
| 15 | @Autowired |
| 16 | CommentDao commentDao; |
| 17 | |
| 18 | // @Autowired |
| 19 | // public CommentServiceImpl(CommentDao commentDao, BoardDao boardDao) { |
| 20 | // this.commentDao = commentDao; |
| 21 | // this.boardDao = boardDao; |
| 22 | // } |
| 23 | |
| 24 | @Override |
| 25 | public int getCount(Integer bno) throws Exception { |
| 26 | return commentDao.count(bno); |
| 27 | } |
| 28 | |
| 29 | @Override |
| 30 | |
| 31 | @Transactional(rollbackFor = Exception.class) |
| 32 | public int remove(Integer cno, Integer bno, String commenter) throws Exception { |
| 33 | int rowCnt = boardDao.updateCommentCnt(bno, -1); |
| 34 | System.out.println("updateCommentCnt - rowCnt = " + rowCnt); |
| 35 | // throw new Exception("test"); |
| 36 | rowCnt = commentDao.delete(cno, commenter); |
| 37 | System.out.println("rowCnt = " + rowCnt); |
| 38 | return rowCnt; |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | @Transactional(rollbackFor = Exception.class) |
| 43 | public int write(CommentDto commentDto) throws Exception { |
| 44 | boardDao.updateCommentCnt(commentDto.getBno(), 1); |
| 45 | // throw new Exception("test"); |
| 46 | return commentDao.insert(commentDto); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public List<CommentDto> getList(Integer bno) throws Exception { |
| 51 | // throw new Exception("test"); |
| 52 | return commentDao.selectAll(bno); |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public CommentDto read(Integer cno) throws Exception { |
| 57 | return commentDao.select(cno); |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public int modify(CommentDto commentDto) throws Exception { |
| 62 | return commentDao.update(commentDto); |
| 63 | } |
| 64 | } |
nothing calls this directly
no outgoing calls
no test coverage detected