PsHooN7979 07-31
240731 박세훈 설문 조사 간단 수정
@acfee5597a9d06650454ba6087ef5b231d9429ed
src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
--- src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
@@ -59,15 +59,9 @@
     public ResponseEntity<?> findAllBoard(@RequestBody HashMap<String, Object> params) throws Exception {
         HashMap<String, Object> result = new HashMap<>();
 
-        // 페이지 번호와 페이지 크기를 파라미터로 전달
-        int page = Integer.parseInt(params.get("page").toString());
-        int pageSize = Integer.parseInt(params.get("pageSize").toString());
-
-
         // 전체 게시물 수 조회 및 추가
-        int totalBoard = boardService.boardCount(params);
-        result.put("totalBoard", totalBoard);
-        result.put("list", boardService.findAllBoard(params));
+        result.put("totalBoard", boardService.boardCount(params));
+        result.put("result", boardService.findAllBoard(params));
 
 
         return new ResponseEntity<>(result, HttpStatus.OK);
@@ -84,7 +78,7 @@
     public ResponseEntity<?> findByBoardId(@RequestBody HashMap<String, Object> params) throws Exception {
         HashMap<String, Object> result = new HashMap<>();
 
-        result.put("list", boardService.findByBoardId(params));
+        result.put("result", boardService.findByBoardId(params));
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
     /**
@@ -141,7 +135,7 @@
         HashMap<String, Object> result = new HashMap<>();
 
         List<HashMap<String, Object>> boardList = boardService.searchBoard(params);
-        result.put("list", boardList);
+        result.put("result", boardList);
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
 
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
+++ src/main/java/com/takensoft/ai_lms/lms/class_book/web/ClassBookController.java
@@ -46,7 +46,7 @@
     public ResponseEntity<?> findByBookId(@RequestBody HashMap<String, Object> params) throws Exception {
         HashMap<String, Object> result = new HashMap<>();
 
-        result.put("list", classBookService.findByBookId(params));
+        result.put("result", classBookService.findByBookId(params));
 
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
@@ -65,7 +65,6 @@
     public String deleteClassBook(@RequestBody ClassBookVO classBookVO) throws Exception {
         try {
             int result = classBookService.deleteClassBook(classBookVO);
-            System.out.println("result = " + result);
             if (result > 0) {
                 return "success";
             } else {
src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
--- src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
@@ -26,6 +26,8 @@
 
     private final SurveyService surveyService;
 
+
+    // 설문 조사 등록
     @PostMapping("/insert.json")
     public String insertSurvey(@RequestBody SurveyVO surveyVO) throws Exception {
         try {
@@ -40,6 +42,7 @@
         }
     }
 
+    // 설문 조사 상세 등록
     @PostMapping("/insertDetail.json")
     public ResponseEntity<Void> insertDetailSurvey(@RequestBody List<SurveyDetailVO> surveyDetailVO) throws Exception {
         surveyService.insertSurveyDetail(surveyDetailVO);
@@ -47,17 +50,20 @@
     }
 
 
+    // 설문 조사 조회
     @PostMapping("/list.json")
     public List<SurveyVO> surveyList(SurveyVO surveyVO) throws Exception {
         return surveyService.surveyList(surveyVO);
     }
 
+    // 설문 조사 상세 조회
     @PostMapping("detailList.json")
-    public List<SurveyDetailVO> surveyDetailVOList(SurveyDetailVO surveyDetailVO) throws Exception {
+    public List<SurveyDetailVO> surveyDetailVOList(@RequestBody SurveyDetailVO surveyDetailVO) throws Exception {
         return surveyService.surveyDetailList(surveyDetailVO);
     }
 
 
+    // 설문 조사 수정
     @PostMapping("/update.json")
     public String updateSurvey (@RequestBody SurveyVO surveyVO) throws Exception {
         try {
@@ -73,6 +79,7 @@
     }
 
 
+    // 설문 조사 삭제(연관된 설문 조사 상세도 삭제됨)
     @PostMapping("/delete.json")
     public ResponseEntity<Void> deleteSurvey (@RequestBody SurveyVO surveyVO) throws Exception {
         surveyService.deleteSurveyWithDetails(surveyVO.getSrvyId());
src/main/resources/mybatis/mapper/lms/board-SQL.xml
--- src/main/resources/mybatis/mapper/lms/board-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/board-SQL.xml
@@ -3,7 +3,7 @@
 <mapper namespace="com.takensoft.ai_lms.lms.board.dao.BoardDAO">
 
     <resultMap id="boardMap" type="BoardVO">
-        <result property="bbsId" column="bbs_id"/>
+        <id property="bbsId" column="bbs_id"/>
         <result property="bbsTtl" column="bbs_ttl"/>
         <result property="bbsCls" column="bbs_cls"/>
         <result property="bbsCnt" column="bbs_cnt"/>
@@ -13,7 +13,7 @@
     </resultMap>
 
     <resultMap id="boardResultMap" type="BoardUserVO">
-        <result property="userId" column="user_id" />
+        <id property="userId" column="user_id" />
         <result property="userNm" column="user_nm" />
         <collection property="boardClass" ofType="BoardClassVO">
             <id property="sclsId" column="scls_id" />
src/main/resources/mybatis/mapper/lms/survey-SQL.xml
--- src/main/resources/mybatis/mapper/lms/survey-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/survey-SQL.xml
@@ -4,25 +4,14 @@
 
 
     <resultMap id="surveyMap" type="SurveyVO">
-        <result property="srvyId" column="srvy_id"/>
+        <id property="srvyId" column="srvy_id"/>
         <result property="srvyType" column="srvy_type"/>
         <result property="srvyCnt" column="srvy_cnt"/>
         <collection property="surveyDetail" ofType="SurveyDetailVO">
-            <result property="srvyDtlId" column="srvy_dtl_id" />
+            <id property="srvyDtlId" column="srvy_dtl_id" />
             <result property="srvyDtlCnt" column="srvy_dtl_cnt" />
         </collection>
     </resultMap>
-
-<!--    <resultMap id="surveyDetailMap" type="SurveyDetailVO">-->
-<!--        <result property="srvyDtlId" column="srvy_dtl_id" />-->
-<!--        <result property="srvyDtlCnt" column="srvy_dtl_cnt" />-->
-<!--        <result property="srvyId" column="srvy_id" />-->
-<!--        <collection property="survey" ofType="SurveyVO">-->
-<!--            <result property="srvyId" column="srvy_id"/>-->
-<!--            <result property="srvyType" column="srvy_type"/>-->
-<!--            <result property="srvyCnt" column="srvy_cnt"/>-->
-<!--        </collection>-->
-<!--    </resultMap>-->
 
     <!--
         작성자 : 박세훈
@@ -83,6 +72,7 @@
                 d.srvy_dtl_id
         FROM survey s
         LEFT JOIN survey_detail d ON s.srvy_id = d.srvy_id
+        WHERE s.srvy_id = #{srvyId}
         ORDER BY s.srvy_id DESC
     </select>
 
Add a comment
List