PsHooN7979
07-30
240730 박세훈 class_book 수정
@f84041896cdf06ce9020f5a8a30d1f56c117ead8
--- src/main/java/com/takensoft/ai_lms/lms/class_book/dao/ClassBookDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/class_book/dao/ClassBookDAO.java
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 |
public interface ClassBookDAO { |
19 | 19 |
|
20 | 20 |
// 교재 등록 |
21 |
- int registerBook(ClassBookVO classBookVO) throws Exception; |
|
21 |
+ void registerBook(List<ClassBookVO> classBookVO) throws Exception; |
|
22 | 22 |
|
23 | 23 |
// 교재 삭제 |
24 | 24 |
int deleteClassBook(ClassBookVO classBookVO) throws Exception; |
--- src/main/java/com/takensoft/ai_lms/lms/class_book/service/ClassBookService.java
+++ src/main/java/com/takensoft/ai_lms/lms/class_book/service/ClassBookService.java
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 |
public interface ClassBookService { |
17 | 17 |
|
18 | 18 |
// 교재 등록 |
19 |
- int registerBook(ClassBookVO classBookVO) throws Exception; |
|
19 |
+ void registerBook(List<ClassBookVO> classBookVO) throws Exception; |
|
20 | 20 |
|
21 | 21 |
// 교재 삭제 |
22 | 22 |
int deleteClassBook(ClassBookVO classBookVO) throws Exception; |
--- src/main/java/com/takensoft/ai_lms/lms/class_book/service/Impl/ClassBookServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/class_book/service/Impl/ClassBookServiceImpl.java
... | ... | @@ -26,8 +26,8 @@ |
26 | 26 |
|
27 | 27 |
// 교재 등록 |
28 | 28 |
@Override |
29 |
- public int registerBook(ClassBookVO classBookVO) throws Exception { |
|
30 |
- return classBookDAO.registerBook(classBookVO); |
|
29 |
+ public void registerBook(List<ClassBookVO> classBookVO) throws Exception { |
|
30 |
+ classBookDAO.registerBook(classBookVO); |
|
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
// 교재 삭제 |
--- 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
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 |
import org.springframework.web.bind.annotation.*; |
9 | 9 |
|
10 | 10 |
import java.util.HashMap; |
11 |
+import java.util.List; |
|
11 | 12 |
|
12 | 13 |
@RestController |
13 | 14 |
@RequiredArgsConstructor |
... | ... | @@ -26,18 +27,9 @@ |
26 | 27 |
* 반 교재 등록 |
27 | 28 |
*/ |
28 | 29 |
@PostMapping("/register.json") |
29 |
- public String registerBook(@RequestBody ClassBookVO classBookVO) throws Exception { |
|
30 |
- try { |
|
31 |
- int result = classBookService.registerBook(classBookVO); |
|
32 |
- if (result > 0) { |
|
33 |
- return "success"; |
|
34 |
- } else { |
|
35 |
- return "fail"; |
|
36 |
- } |
|
37 |
- } catch (Exception e) { |
|
38 |
- e.printStackTrace(); |
|
39 |
- return "Error"; |
|
40 |
- } |
|
30 |
+ public ResponseEntity<Void> registerBook(@RequestBody List<ClassBookVO> classBookVO) throws Exception { |
|
31 |
+ classBookService.registerBook(classBookVO); |
|
32 |
+ return new ResponseEntity<>(HttpStatus.OK); |
|
41 | 33 |
} |
42 | 34 |
|
43 | 35 |
|
--- src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 |
@PostMapping("/insertDetail.json") |
44 | 44 |
public ResponseEntity<Void> insertDetailSurvey(@RequestBody List<SurveyDetailVO> surveyDetailVO) throws Exception { |
45 | 45 |
surveyService.insertSurveyDetail(surveyDetailVO); |
46 |
- return new ResponseEntity<>(HttpStatus.CREATED); |
|
46 |
+ return new ResponseEntity<>(HttpStatus.OK); |
|
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
|
... | ... | @@ -76,7 +76,7 @@ |
76 | 76 |
@PostMapping("/delete.json") |
77 | 77 |
public ResponseEntity<Void> deleteSurvey (@RequestBody SurveyVO surveyVO) throws Exception { |
78 | 78 |
surveyService.deleteSurveyWithDetails(surveyVO.getSrvyId()); |
79 |
- return ResponseEntity.noContent().build(); |
|
79 |
+ return new ResponseEntity<>(HttpStatus.OK); |
|
80 | 80 |
} |
81 | 81 |
|
82 | 82 |
|
--- src/main/resources/mybatis/mapper/lms/class_book-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/class_book-SQL.xml
... | ... | @@ -14,9 +14,13 @@ |
14 | 14 |
<insert id="registerBook" parameterType="String" > |
15 | 15 |
INSERT INTO class_book( book_id, |
16 | 16 |
scls_id |
17 |
- ) VALUES ( #{bookId}, |
|
18 |
- #{sclsId} |
|
19 |
- ); |
|
17 |
+ ) |
|
18 |
+ VALUES |
|
19 |
+ <foreach collection="list" item="item" separator=","> |
|
20 |
+ (#{item.bookId}, |
|
21 |
+ #{item.sclsId} |
|
22 |
+ ) |
|
23 |
+ </foreach> |
|
20 | 24 |
</insert> |
21 | 25 |
|
22 | 26 |
|
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?