use of com.varsql.web.dto.board.BoardResponseDTO in project varsql by varsqlinfo.
the class BoardService method viewBoardInfo.
/**
* @Method Name : viewBoardInfo
* @Method 설명 : 글 상세보기.
* @작성자 : ytkim
* @작성일 : 2021. 7. 8.
* @변경이력 :
* @param boardCode
* @param articleId
* @return
*/
public BoardResponseDTO viewBoardInfo(String boardCode, long articleId) {
BoardEntity boardEntity = boardEntityRepository.findByArticleId(articleId);
if (boardEntity == null) {
throw new BoardNotFoundException("article id not found : " + articleId);
}
BoardResponseDTO dto = BoardResponseDTO.toDto(boardEntity, true);
dto.setModifyAuth(isModify(boardEntity));
return dto;
}
use of com.varsql.web.dto.board.BoardResponseDTO in project varsql by varsqlinfo.
the class BoardController method modify.
@RequestMapping(value = "/{" + VarsqlParamConstants.BOARD_CODE + "}/modify", method = RequestMethod.GET)
public ModelAndView modify(@PathVariable(required = true, name = VarsqlParamConstants.BOARD_CODE) String boardCode, @RequestParam(value = "articleId", required = true) long articleId, HttpServletRequest req, ModelAndView mav) throws Exception {
boardCode = VarsqlUtils.getVonnid(req);
BoardResponseDTO dto = boardService.viewBoardInfo(boardCode, articleId);
if (!dto.isModifyAuth()) {
throw new PermissionDeniedException("no permission");
}
ModelMap model = mav.getModelMap();
model.addAttribute("param", HttpUtils.getServletRequestParam(req));
model.addAttribute("articleInfo", VartechUtils.objectToJsonString(dto));
return getModelAndView("/boardWrite", VIEW_PAGE.BOARD, model);
}
Aggregations