/**
   * 커뮤니티, 동호회에 사용되는 게시판 사용정보를 등록한다.
   *
   * @param bdUseVO
   * @param boardUseInf
   * @param status
   * @param model
   * @return
   * @throws Exception
   */
  @RequestMapping("/cop/com/insertBBSUseInfByTrget.do")
  public String insertBBSUseInfByTrget(
      @ModelAttribute("searchVO") BoardUseInfVO bdUseVO,
      @ModelAttribute("boardUseInf") BoardUseInf boardUseInf,
      @RequestParam Map<String, Object> commandMap,
      SessionStatus status,
      ModelMap model)
      throws Exception {

    checkAuthority(bdUseVO); // server-side 권한 확인

    String paramTrgetId = (String) commandMap.get("param_trgetId");
    String bbsId = (String) commandMap.get("bbsId");

    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();

    if (isAuthenticated) {
      boardUseInf.setUseAt("Y");
      boardUseInf.setFrstRegisterId(user.getUniqId());
      boardUseInf.setRegistSeCode("REGC07");
      boardUseInf.setBbsId(bbsId);
      boardUseInf.setTrgetId(paramTrgetId);

      bbsUseService.insertBBSUseInf(boardUseInf);
    }

    return "forward:/cop/com/selectCmyBBSUseInfsByTrget.do";
  }
  /**
   * 커뮤니티, 동호회에 사용되는 게시판 사용정보에 대한 목록을 조회한다.
   *
   * @param bdUseVO
   * @param model
   * @return
   * @throws Exception
   */
  @RequestMapping("/cop/com/selectCmyBBSUseInfsByTrget.do")
  public String selectBBSUseInfsByTrget(
      @ModelAttribute("searchVO") BoardUseInfVO bdUseVO, ModelMap model) throws Exception {
    checkAuthority(bdUseVO); // server-side 권한 확인

    bdUseVO.setPageUnit(propertyService.getInt("pageUnit"));
    bdUseVO.setPageSize(propertyService.getInt("pageSize"));

    PaginationInfo paginationInfo = new PaginationInfo();

    paginationInfo.setCurrentPageNo(bdUseVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(bdUseVO.getPageUnit());
    paginationInfo.setPageSize(bdUseVO.getPageSize());

    bdUseVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    bdUseVO.setLastIndex(paginationInfo.getLastRecordIndex());
    bdUseVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    Map<String, Object> map = bbsUseService.selectBBSUseInfsByTrget(bdUseVO);
    int totCnt = Integer.parseInt((String) map.get("resultCnt"));

    paginationInfo.setTotalRecordCount(totCnt);

    model.addAttribute("resultList", map.get("resultList"));
    model.addAttribute("resultCnt", map.get("resultCnt"));
    model.addAttribute("trgetId", bdUseVO.getTrgetId());
    model.addAttribute("trgetType", bdUseVO.getTrgetType());
    model.addAttribute("paginationInfo", paginationInfo);

    return "egovframework/com/cop/com/EgovBdUseInfListByTrget";
  }