PsHooN7979
07-30
240730 박세훈 api POST로 수정
@ccedf4cbad4f10aa2c0fea616ef601ecb9cde399
--- src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 |
* |
94 | 94 |
* 게시글 수정 |
95 | 95 |
*/ |
96 |
- @PutMapping("/update.json") |
|
96 |
+ @PostMapping("/update.json") |
|
97 | 97 |
public String updateBoard(@RequestBody BoardVO boardVO) throws Exception { |
98 | 98 |
try { |
99 | 99 |
int result = boardService.updateBoard(boardVO); |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 |
* |
114 | 114 |
* 게시글 삭제 |
115 | 115 |
*/ |
116 |
- @DeleteMapping("/delete.json") |
|
116 |
+ @PostMapping("/delete.json") |
|
117 | 117 |
public String deleteBoard(@RequestBody Map<String, String> request) throws Exception { |
118 | 118 |
try{ |
119 | 119 |
String bbsId = request.get("bbsId"); |
--- src/main/java/com/takensoft/ai_lms/lms/class_book/web/ClassBookController.java
+++ src/main/java/com/takensoft/ai_lms/lms/class_book/web/ClassBookController.java
... | ... | @@ -66,10 +66,10 @@ |
66 | 66 |
* param ClassBookDAO |
67 | 67 |
* @return |
68 | 68 |
* @throws Exception |
69 |
- * |
|
69 |
+ |
|
70 | 70 |
* 반 교재 삭제 |
71 | 71 |
*/ |
72 |
- @DeleteMapping("/delete.json") |
|
72 |
+ @PostMapping("/delete.json") |
|
73 | 73 |
public String deleteClassBook(@RequestBody ClassBookVO classBookVO) throws Exception { |
74 | 74 |
try { |
75 | 75 |
int result = classBookService.deleteClassBook(classBookVO); |
--- src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
... | ... | @@ -27,7 +27,10 @@ |
27 | 27 |
int updateSurvey(SurveyVO surveyVO) throws Exception; |
28 | 28 |
|
29 | 29 |
// 설문 조사 삭제 |
30 |
- int deleteSurvey(String srvyId) throws Exception; |
|
30 |
+ void deleteSurvey(String srvyId) throws Exception; |
|
31 |
+ |
|
32 |
+ // 설문 조사 상제 삭세 |
|
33 |
+ void deleteSurveyDetail(String srvyId) throws Exception; |
|
31 | 34 |
|
32 | 35 |
// 설문 조사 상세 정보 등록 |
33 | 36 |
void insertSurveyDetail(List<SurveyDetailVO> surveyDetailVO) throws Exception; |
--- src/main/java/com/takensoft/ai_lms/lms/survey/service/Impl/SurveyServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/service/Impl/SurveyServiceImpl.java
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 |
import lombok.RequiredArgsConstructor; |
10 | 10 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
11 | 11 |
import org.springframework.stereotype.Service; |
12 |
+import org.springframework.transaction.annotation.Transactional; |
|
12 | 13 |
|
13 | 14 |
import java.util.List; |
14 | 15 |
|
... | ... | @@ -50,11 +51,15 @@ |
50 | 51 |
} |
51 | 52 |
|
52 | 53 |
// 설문 조사 삭제 |
54 |
+ @Transactional |
|
53 | 55 |
@Override |
54 |
- public int deleteSurvey(String srvyId) throws Exception { |
|
55 |
- return surveyDAO.deleteSurvey(srvyId); |
|
56 |
+ public void deleteSurveyWithDetails(String srvyId) throws Exception { |
|
57 |
+ surveyDAO.deleteSurveyDetail(srvyId); |
|
58 |
+ surveyDAO.deleteSurvey(srvyId); |
|
56 | 59 |
} |
57 | 60 |
|
61 |
+ |
|
62 |
+ |
|
58 | 63 |
// 설문 조사 상세 정보 |
59 | 64 |
@Override |
60 | 65 |
public void insertSurveyDetail(List<SurveyDetailVO> surveyDetailVO) throws Exception { |
--- src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 |
int updateSurvey(SurveyVO surveyVO) throws Exception; |
26 | 26 |
|
27 | 27 |
// 설문 조사 삭제 |
28 |
- int deleteSurvey(String srvyId) throws Exception; |
|
28 |
+ void deleteSurveyWithDetails(String srvyId) throws Exception; |
|
29 | 29 |
|
30 | 30 |
// 설문 조사 상세 정보 |
31 | 31 |
void insertSurveyDetail(List<SurveyDetailVO> surveyDetailVO) throws Exception; |
--- src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
... | ... | @@ -47,18 +47,18 @@ |
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
|
50 |
- @GetMapping("/list.json") |
|
50 |
+ @PostMapping("/list.json") |
|
51 | 51 |
public List<SurveyVO> surveyList(SurveyVO surveyVO) throws Exception { |
52 | 52 |
return surveyService.surveyList(surveyVO); |
53 | 53 |
} |
54 | 54 |
|
55 |
- @GetMapping("detailList.json") |
|
55 |
+ @PostMapping("detailList.json") |
|
56 | 56 |
public List<SurveyDetailVO> surveyDetailVOList(SurveyDetailVO surveyDetailVO) throws Exception { |
57 | 57 |
return surveyService.surveyDetailList(surveyDetailVO); |
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
|
61 |
- @PutMapping("/update.json") |
|
61 |
+ @PostMapping("/update.json") |
|
62 | 62 |
public String updateSurvey (@RequestBody SurveyVO surveyVO) throws Exception { |
63 | 63 |
try { |
64 | 64 |
int result = surveyService.updateSurvey(surveyVO); |
... | ... | @@ -73,19 +73,10 @@ |
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
|
76 |
- @DeleteMapping("/delete.json") |
|
77 |
- public String deleteSurvey (@RequestBody Map<String, String> request) throws Exception { |
|
78 |
- try { |
|
79 |
- String srvyId = request.get("srvyId"); |
|
80 |
- int result = surveyService.deleteSurvey(srvyId); |
|
81 |
- if ( result > 0) { |
|
82 |
- return "success"; |
|
83 |
- } else { |
|
84 |
- return "fail"; |
|
85 |
- } |
|
86 |
- } catch (Exception e) { |
|
87 |
- return "Error"; |
|
88 |
- } |
|
76 |
+ @PostMapping("/delete.json") |
|
77 |
+ public ResponseEntity<Void> deleteSurvey (@RequestBody SurveyVO surveyVO) throws Exception { |
|
78 |
+ surveyService.deleteSurveyWithDetails(surveyVO.getSrvyId()); |
|
79 |
+ return ResponseEntity.noContent().build(); |
|
89 | 80 |
} |
90 | 81 |
|
91 | 82 |
|
--- src/main/resources/mybatis/mapper/lms/survey-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/survey-SQL.xml
... | ... | @@ -114,6 +114,11 @@ |
114 | 114 |
WHERE srvy_id = #{srvyId} |
115 | 115 |
</delete> |
116 | 116 |
|
117 |
+ <delete id="deleteSurveyDetail" parameterType="String"> |
|
118 |
+ DELETE FROM survey_detail |
|
119 |
+ WHERE srvy_id = #{srvyId} |
|
120 |
+ </delete> |
|
121 |
+ |
|
117 | 122 |
|
118 | 123 |
|
119 | 124 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?