
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package com.takensoft.cms.bbs.web;
import com.takensoft.cms.bbs.service.BbsCnService;
import com.takensoft.cms.bbs.service.BbsMngService;
import com.takensoft.cms.bbs.service.BbsTypeMngService;
import com.takensoft.cms.bbs.vo.BbsMngVO;
import com.takensoft.cms.bbs.vo.BbsTypeMngVO;
import com.takensoft.cms.codeManage.service.CodeManageService;
import com.takensoft.cms.codeManage.vo.CodeManageVO;
import com.takensoft.common.HierachyVO;
import com.takensoft.common.message.MessageCode;
import com.takensoft.common.util.ResponseData;
import com.takensoft.common.util.ResponseUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.nio.charset.Charset;
import java.util.*;
/**
* @author 박정하
* @since 2024.05.08
* @modification
* since | author | description
* 2024.05.08 | 박정하 | 최초 등록
*
* 게시판 관리 관련 컨트롤러
*/
@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping(value="/admin/bbsMng")
public class BbsMngController {
private final ResponseUtil resUtil;
private final BbsMngService bbsMngService;
private final BbsTypeMngService bbsTypeMngService;
private final CodeManageService codeManageService;
/**
* @author 하석형
* @since 2024.05.10
* @param bbsMngVO
* @return
* @throws Exception
*
* 게시판 관리 등록
*/
@PostMapping("/saveProc.json")
public ResponseEntity<?> saveProc(@RequestBody BbsMngVO bbsMngVO) throws Exception {
// 게시판 관리 아이디 중복 검사 (아이디 입력 삭제로 미사용)
/*boolean isExistence = bbsMngService.bbsMngIdCheck(bbsMngVO);
if(isExistence) {
responseData.setStatus(HttpStatus.INTERNAL_SERVER_ERROR);
responseData.setMessage("이미 존재하는 게시판 아이디입니다.");
return new ResponseEntity<>(responseData, headers, HttpStatus.INTERNAL_SERVER_ERROR);
}*/
// 게시판 관리 등록
HashMap<String, Object> result = bbsMngService.saveBbsMng(bbsMngVO);
int insertResult = (int) result.get("result");
// 응답 처리
if(insertResult > 0) {
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
} else {
return resUtil.errorRes(MessageCode.COMMON_INSERT_FAIL);
}
}
/**
* @author 하석형
* @since 2024.05.10
* @param params
* @return
* @throws Exception
*
* 게시판 관리 목록 조회
*/
@PostMapping("/findAll.json")
public ResponseEntity<?> findAll(@RequestBody HashMap<String, String> params) throws Exception {
// 게시판 관리 목록 조회
Map<String, Object> result = bbsMngService.findAllBbsMng(params);
// 응답처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @author 박정하
* @since 2024.05.16
* @param
* @return
* @throws Exception
*
* 게시판 관리 목록 조회 (메뉴 관리용)
*/
@PostMapping("/findAllByMenuMng.json")
public ResponseEntity<?> findAllByMenuMng() throws Exception {
// 게시판 관리 목록 조회
List<BbsMngVO> result = bbsMngService.findAllByMenuMng();
// 응답처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @author 하석형
* @since 2024.05.08
* @param bbsMngVO
* @return
* @throws Exception
*
* 게시판 관리 상세 조회
*/
@PostMapping("/findByBbsMng.json")
public ResponseEntity<?> findByBbsMng(@RequestBody BbsMngVO bbsMngVO) throws Exception {
// 게시판 관리 상세 조회
BbsMngVO bbsMng = bbsMngService.findByBbsMngId(bbsMngVO.getBbsMngId());
// 게시판 유형 목록 조회
BbsTypeMngVO bbsTypeMap = new BbsTypeMngVO();
bbsTypeMap.setExpsrYn("Y");
List<BbsTypeMngVO> bbsType = (List<BbsTypeMngVO>) bbsTypeMngService.findAllBbsTypeMng(bbsTypeMap).get("list");
// 페이지 유형 목록 조회
List<CodeManageVO> pageType = codeManageService.findByChildCdCache("pageType");
Map<String, Object> result = new HashMap<String, Object>();
result.put("bbsMng", bbsMng);
result.put("bbsTypeList", bbsType);
result.put("pageTypeList", pageType);
// 응답 처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @author 하석형
* @since 2024.05.09
* @param bbsMngVO
* @return
* @throws Exception
*
* 게시판 관리 수정
*/
@PostMapping("/updateProc.json")
public ResponseEntity<?> updateProc(@RequestBody BbsMngVO bbsMngVO) throws Exception {
// 게시판 관리 수정
int result = bbsMngService.updateBbsMng(bbsMngVO);
// 응답 처리
if(result > 0) {
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
} else {
return resUtil.errorRes(MessageCode.COMMON_UPDATE_FAIL);
}
}
/**
* @author 하석형
* @since 2024.05.09
* @param bbsMngVO
* @return
* @throws Exception
*
* 게시판 관리 삭제
*/
@PostMapping("/deleteProc.json")
public ResponseEntity<?> deleteProc(@RequestBody BbsMngVO bbsMngVO) throws Exception {
// 게시판 관리 수정
int result = bbsMngService.deleteBbsMng(bbsMngVO);
// 응답 처리
if(result > 0) {
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
} else {
return resUtil.errorRes(MessageCode.COMMON_DELETE_FAIL);
}
}
}