Ejemplo n.º 1
0
  /**
   * 글 상세보기
   *
   * @param boardDomain
   * @param boardReplyDomain
   * @return
   * @throws Exception
   */
  @RequestMapping(value = "/api" + Constants.URL_BOARD_DETAIL)
  public ModelAndView getBoardDetailView(BoardDomain boardDomain, BoardReplyDomain boardReplyDomain)
      throws Exception {
    ModelAndView mav = new ModelAndView("jsonView");

    List<BoardFileDomain> boardFileListDomain = null;

    boardDomain = boardService.getBoardDetailById(boardDomain.getId());

    if (boardDomain.getHas_File().equals("YES"))
      boardFileListDomain = boardService.getBoardFileListById(boardDomain.getId());

    int totSize = boardService.getTotBoardReplyCount(boardDomain.getId());
    boardReplyDomain.setPageSize(5);
    boardReplyDomain.setTotalSize(totSize);
    boardReplyDomain.setNo(boardDomain.getId());

    List<BoardReplyDomain> boardReplyListDomain =
        boardService.getAllBoardReplyListById(boardReplyDomain);

    String tmpPassword = "******";

    for (BoardReplyDomain rd : boardReplyListDomain) {
      rd.setPassword(tmpPassword);
    }

    boardReplyDomain.setPassword(tmpPassword);
    boardDomain.setPassword(tmpPassword);

    mav.addObject("boardDomain", boardDomain);
    mav.addObject("boardFileListDomain", boardFileListDomain);
    mav.addObject("boardReplyListDomain", boardReplyListDomain);
    mav.addObject("boardReplyDomain", boardReplyDomain);

    return mav;
  }