@RequestMapping( value = "/mypage/managecmt.do", method = RequestMethod.POST, params = "cmd=modify") public String modifyComment( @RequestParam("bid") int boardCodeId, @RequestParam("commentId") int commentId, @ModelAttribute ContentView content) throws Exception { String message = ""; CommentView comment = commentService.getComment(commentId); // System.out.println(content); comment.setContent((content.getContent())); boolean isComment = commentService.modifyComment(comment); message = (isComment) ? "success" : "fail"; return "redirect:/mypage/managecmt.do?bid=" + boardCodeId; }
@RequestMapping(value = "/mypage/managecmt.do", method = RequestMethod.GET) public ModelAndView viewManagecmt( @RequestParam(value = "bid", defaultValue = "0") int boardCodeId) { ModelAndView modelAndView = new ModelAndView("/mypage/managecmt"); List<CommentView> commentList; // 보드가 0일 경우는 대회 자료 공유임. if (boardCodeId != 0) commentList = commentService.findBoardComments(boardCodeId, Article.IS_NOT_SHARE); else commentList = commentService.findBoardComments(boardCodeId, Article.IS_SHARE); List<BoardCodeView> boardCodeList = articleService.findBoards(null, 0); modelAndView.addObject("boardCodeList", boardCodeList); modelAndView.addObject("commentList", commentList); modelAndView.addObject("subTitle", "덧글 관리"); modelAndView.addObject("mypageType", "managecmt"); return modelAndView; }
@RequestMapping(value = "/mypage/managecmt.do", method = RequestMethod.GET, params = "cmd=remove") public String removeComment( @RequestParam("bid") int boardCodeId, @RequestParam("cid") int commentId, @RequestParam("aid") int articleId) throws Exception { String message = ""; boolean isComment = commentService.removeComment(commentId); boolean isCommentCount = articleService.updownCommentCount(articleId, Comment.COMMENT_COUNT_DOWN); message = (isComment) ? "success" : "fail"; // bid=%d&sz=%d pg return "redirect:/mypage/managecmt.do?bid=" + boardCodeId; }