|
|
@ -31,14 +31,27 @@ public class CnsFaqController { |
|
|
|
|
|
|
|
|
|
|
|
private final CnsFaqService service; |
|
|
|
private final CnsFaqService service; |
|
|
|
|
|
|
|
|
|
|
|
/*FAQ 목록 조회*/ |
|
|
|
/** |
|
|
|
|
|
|
|
* FAQ 목록 조회하는 기능, |
|
|
|
|
|
|
|
* FaqListRQModel 값에 있는 조건값으로 조회함. |
|
|
|
|
|
|
|
* @param model |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@GetMapping |
|
|
|
@GetMapping |
|
|
|
public ResponseEntity<? extends BasicResponse> getFaqList(FaqListRQModel model) { |
|
|
|
public ResponseEntity<? extends BasicResponse> getFaqList(FaqListRQModel model) { |
|
|
|
List<FaqListModel> result = null; |
|
|
|
List<FaqListModel> result = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = service.getFaqList(model); |
|
|
|
result = service.getFaqList(model); // FaQ 항목들 조회하는 기능
|
|
|
|
} catch (CustomException e) { |
|
|
|
} catch (CustomException e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* CustomException은 개발자가 "의도적으로" 낸 예외처리, |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
resultMap.put("result", false); |
|
|
|
resultMap.put("result", false); |
|
|
@ -46,6 +59,13 @@ public class CnsFaqController { |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
@ -54,14 +74,27 @@ public class CnsFaqController { |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(result)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(result)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*FAQ 상세 조회*/ |
|
|
|
/** |
|
|
|
|
|
|
|
* FAQ 상세 조회하는 기능, |
|
|
|
|
|
|
|
* 일련번호[sno]로 조회함. |
|
|
|
|
|
|
|
* @param sno |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@GetMapping("/{sno}") |
|
|
|
@GetMapping("/{sno}") |
|
|
|
public ResponseEntity<? extends BasicResponse> getFaqDetail(@PathVariable("sno") int sno) { |
|
|
|
public ResponseEntity<? extends BasicResponse> getFaqDetail(@PathVariable("sno") int sno) { |
|
|
|
FaqListModel result = null; |
|
|
|
FaqListModel result = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = service.getFaqDetail(sno); |
|
|
|
result = service.getFaqDetail(sno); // 일련번호[sno]로 상세정보를 조회하는 기능
|
|
|
|
} catch (CustomException e) { |
|
|
|
} catch (CustomException e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* CustomException은 개발자가 "의도적으로" 낸 예외처리, |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
resultMap.put("result", false); |
|
|
|
resultMap.put("result", false); |
|
|
@ -69,6 +102,13 @@ public class CnsFaqController { |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
@ -77,14 +117,27 @@ public class CnsFaqController { |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(result)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(result)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*FAQ 작성*/ |
|
|
|
/** |
|
|
|
|
|
|
|
* FAQ 작성하는 기능, |
|
|
|
|
|
|
|
* FaqListModel모델에 있는 값으로 작성하는 기능. |
|
|
|
|
|
|
|
* @param model |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@PostMapping |
|
|
|
@PostMapping |
|
|
|
public ResponseEntity<? extends BasicResponse> insertFaq(@RequestBody FaqListModel model) { |
|
|
|
public ResponseEntity<? extends BasicResponse> insertFaq(@RequestBody FaqListModel model) { |
|
|
|
boolean result = false; |
|
|
|
boolean result = false; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = service.insertFaq(model); |
|
|
|
result = service.insertFaq(model); // FaQ 추가하는 기능
|
|
|
|
} catch (CustomException e) { |
|
|
|
} catch (CustomException e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* CustomException은 개발자가 "의도적으로" 낸 예외처리, |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
resultMap.put("result", false); |
|
|
|
resultMap.put("result", false); |
|
|
@ -92,6 +145,13 @@ public class CnsFaqController { |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
@ -102,14 +162,27 @@ public class CnsFaqController { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*FAQ 업데이트*/ |
|
|
|
/** |
|
|
|
|
|
|
|
* FAQ 업데이트 기능, |
|
|
|
|
|
|
|
* FaqListModel 모델에 있는 값으로 업데이트함. |
|
|
|
|
|
|
|
* @param model |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@PutMapping |
|
|
|
@PutMapping |
|
|
|
public ResponseEntity<? extends BasicResponse> updateFaq(@RequestBody FaqListModel model) { |
|
|
|
public ResponseEntity<? extends BasicResponse> updateFaq(@RequestBody FaqListModel model) { |
|
|
|
boolean result = false; |
|
|
|
boolean result = false; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = service.updateFaq(model); |
|
|
|
result = service.updateFaq(model); // FaQ 수정하는 기능
|
|
|
|
} catch (CustomException e) { |
|
|
|
} catch (CustomException e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* CustomException은 개발자가 "의도적으로" 낸 예외처리, |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
resultMap.put("result", false); |
|
|
|
resultMap.put("result", false); |
|
|
@ -117,6 +190,13 @@ public class CnsFaqController { |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
@ -126,14 +206,26 @@ public class CnsFaqController { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*FAQ 논리 삭제*/ |
|
|
|
/** |
|
|
|
|
|
|
|
* FAQ 삭제하는 기능, |
|
|
|
|
|
|
|
* 일련번호[sno]로 삭제하는 기능. |
|
|
|
|
|
|
|
* @param sno |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@Tag(name = "FAQ API", description = "FAQ 관련 API") |
|
|
|
@DeleteMapping("/{sno}") |
|
|
|
@DeleteMapping("/{sno}") |
|
|
|
public ResponseEntity<? extends BasicResponse> deleteFaq(@PathVariable("sno") int sno) { |
|
|
|
public ResponseEntity<? extends BasicResponse> deleteFaq(@PathVariable("sno") int sno) { |
|
|
|
// TODO 성공/실패 상태값 전송
|
|
|
|
// TODO 성공/실패 상태값 전송
|
|
|
|
try { |
|
|
|
try { |
|
|
|
service.deleteFaq(sno); |
|
|
|
service.deleteFaq(sno); // 일련번호[sno]로 삭제하는 기능
|
|
|
|
} catch (CustomException e) { |
|
|
|
} catch (CustomException e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
resultMap.put("result", false); |
|
|
|
resultMap.put("result", false); |
|
|
@ -141,6 +233,13 @@ public class CnsFaqController { |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* try{ |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
* try 영역 안 코드들중 문제가 생기면 오는 곳. |
|
|
|
|
|
|
|
* log.error 로그로 원인 파악과 함께 API를 호출한 곳에 서버에러 내려줌 |
|
|
|
|
|
|
|
*/ |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
log.error("IGNORE : ", e); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|