PsHooN7979 07-30
240730 박세훈 설문 조사 상세 정보 등록 및 조회 추가
@3d1415b8f8d8ab5d805f5f89a53e77fb35dd459b
src/main/java/com/takensoft/ai_lms/common/idgen/context/ContextIdgen.java
--- src/main/java/com/takensoft/ai_lms/common/idgen/context/ContextIdgen.java
+++ src/main/java/com/takensoft/ai_lms/common/idgen/context/ContextIdgen.java
@@ -228,5 +228,16 @@
         return idgenServiceImpl;
     }
 
+    // 설문 조사 상세 정보
+    @Bean(name = "surveyDetailIdgn")
+    public IdgenService surveyDetail() {
+        IdgenService idgenServiceImpl = new IdgenService();
+        idgenServiceImpl.setCipers(15);
+        idgenServiceImpl.setFillChar('0');
+        idgenServiceImpl.setPrefix("SURVEY_DETAIL_");
+        idgenServiceImpl.setTblNm("SURVEY_DETAIL_ID");
+        return idgenServiceImpl;
+    }
+
 
 }
(파일 끝에 줄바꿈 문자 없음)
src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
--- src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
@@ -1,6 +1,7 @@
 package com.takensoft.ai_lms.lms.survey.dao;
 
 
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO;
 import com.takensoft.ai_lms.lms.survey.vo.SurveyVO;
 import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
 
@@ -27,4 +28,10 @@
 
     // 설문 조사 삭제
     int deleteSurvey(String srvyId) throws Exception;
+
+    // 설문 조사 상세 정보
+    int insertSurveyDetail(SurveyDetailVO surveyDetailVO) throws Exception;
+
+    // 설문 조사 상세 정보 조회
+    List<SurveyDetailVO> surveyDetailList(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
+++ src/main/java/com/takensoft/ai_lms/lms/survey/service/Impl/SurveyServiceImpl.java
@@ -4,6 +4,7 @@
 import com.takensoft.ai_lms.common.idgen.service.IdgenService;
 import com.takensoft.ai_lms.lms.survey.dao.SurveyDAO;
 import com.takensoft.ai_lms.lms.survey.service.SurveyService;
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO;
 import com.takensoft.ai_lms.lms.survey.vo.SurveyVO;
 import lombok.RequiredArgsConstructor;
 import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
@@ -25,6 +26,8 @@
     private final SurveyDAO surveyDAO;
 
     private final IdgenService surveyIdgn;
+
+    private final IdgenService surveyDetailIdgn;
 
     // 설문 조사 등록
     @Override
@@ -51,4 +54,18 @@
     public int deleteSurvey(String srvyId) throws Exception {
         return surveyDAO.deleteSurvey(srvyId);
     }
+
+    // 설문 조사 상세 정보
+    @Override
+    public int insertSurveyDetail(SurveyDetailVO surveyDetailVO) throws Exception {
+        String srvyDtlId = surveyDetailIdgn.getNextStringId();
+        surveyDetailVO.setSrvyDtlId(srvyDtlId);
+        return surveyDAO.insertSurveyDetail(surveyDetailVO);
+    }
+
+    // 설문 조사 상세 정보 조회
+    @Override
+    public List<SurveyDetailVO> surveyDetailList(SurveyDetailVO surveyDetailVO) throws Exception {
+        return surveyDAO.surveyDetailList(surveyDetailVO);
+    }
 }
src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
--- src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
@@ -1,5 +1,6 @@
 package com.takensoft.ai_lms.lms.survey.service;
 
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO;
 import com.takensoft.ai_lms.lms.survey.vo.SurveyVO;
 
 import java.util.List;
@@ -25,4 +26,10 @@
 
     // 설문 조사 삭제
     int deleteSurvey(String srvyId) throws Exception;
+
+    // 설문 조사 상세 정보
+    int insertSurveyDetail(SurveyDetailVO surveyDetailVO) throws Exception;
+
+    // 설문 조사 상세 정보 조회
+    List<SurveyDetailVO> surveyDetailList(SurveyDetailVO surveyDetailVO) throws Exception;
 }
 
src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyDetailVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyDetailVO.java
@@ -0,0 +1,29 @@
+package com.takensoft.ai_lms.lms.survey.vo;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+/**
+ * @author  : 박세훈
+ * since   : 2024.07.30
+ *
+ * 설문 조사 상세 정보 관련 VO
+ */
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class SurveyDetailVO {
+
+    // 설문 조사 상세 아이디
+    private String srvyDtlId;
+
+    // 설문 상세 항목
+    private String srvyDtlCnt;
+
+    // 설문 조사 아이디
+    private String srvyId;
+}
src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyVO.java
--- src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyVO.java
@@ -6,6 +6,8 @@
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 
+import java.util.List;
+
 
 /**
  * @author  : 박세훈
@@ -27,4 +29,7 @@
 
     // 설문 내용
     private String srvyCnt;
+
+    // 설문 조사 상세 정보 테이블과 연결
+    private List<SurveyDetailVO> surveyDetail;
 }
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
@@ -2,6 +2,7 @@
 
 
 import com.takensoft.ai_lms.lms.survey.service.SurveyService;
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO;
 import com.takensoft.ai_lms.lms.survey.vo.SurveyVO;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
@@ -37,11 +38,31 @@
         }
     }
 
+    @PostMapping("/insertDetail.json")
+    public String insertDetailSurvey(@RequestBody SurveyDetailVO surveyDetailVO) throws Exception {
+        try {
+            int result = surveyService.insertSurveyDetail(surveyDetailVO);
+            if ( result > 0) {
+                return "success";
+            } else {
+                return "fail";
+            }
+        } catch (Exception e) {
+            return "Error";
+        }
+    }
+
+
     @GetMapping("/list.json")
     public List<SurveyVO> surveyList(SurveyVO surveyVO) throws Exception {
         return surveyService.surveyList(surveyVO);
     }
 
+    @GetMapping("detailList.json")
+    public List<SurveyDetailVO> surveyDetailVOList(SurveyDetailVO surveyDetailVO) throws Exception {
+        return surveyService.surveyDetailList(surveyDetailVO);
+    }
+
 
     @PutMapping("/update.json")
     public String updateSurvey (@RequestBody SurveyVO surveyVO) throws Exception {
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
@@ -70,15 +70,15 @@
     -->
     <select id="findAllBoard"  resultMap="boardResultMap">
         SELECT  b.bbs_id,
-        b.bbs_ttl,
-        b.bbs_cls,
-        b.bbs_cnt,
-        b.bbs_tm,
-        b.file_mng_id,
-        c.scls_id,
-        c.scls_nm,
-        u.user_id,
-        u.user_nm
+                b.bbs_ttl,
+                b.bbs_cls,
+                b.bbs_cnt,
+                b.bbs_tm,
+                b.file_mng_id,
+                c.scls_id,
+                c.scls_nm,
+                u.user_id,
+                u.user_nm
         FROM board b
         LEFT JOIN class c ON b.scls_id = c.scls_id
         LEFT JOIN users u ON c.user_id = u.user_id
@@ -94,15 +94,15 @@
     -->
     <select id="findByBoardId" resultMap="boardResultMap">
         SELECT  b.bbs_id,
-        b.bbs_ttl,
-        b.bbs_cls,
-        b.bbs_cnt,
-        b.bbs_tm,
-        b.file_mng_id,
-        c.scls_id,
-        c.scls_nm,
-        u.user_id,
-        u.user_nm
+                b.bbs_ttl,
+                b.bbs_cls,
+                b.bbs_cnt,
+                b.bbs_tm,
+                b.file_mng_id,
+                c.scls_id,
+                c.scls_nm,
+                u.user_id,
+                u.user_nm
         FROM board b
         LEFT JOIN class c ON b.scls_id = c.scls_id
         LEFT JOIN users u ON c.user_id = u.user_id
@@ -117,15 +117,15 @@
     -->
     <select id="searchBoard" resultMap="boardResultMap">
         SELECT  b.bbs_id,
-        b.bbs_ttl,
-        b.bbs_cls,
-        b.bbs_cnt,
-        b.bbs_tm,
-        b.file_mng_id,
-        c.scls_id,
-        c.scls_nm,
-        u.user_id,
-        u.user_nm
+                b.bbs_ttl,
+                b.bbs_cls,
+                b.bbs_cnt,
+                b.bbs_tm,
+                b.file_mng_id,
+                c.scls_id,
+                c.scls_nm,
+                u.user_id,
+                u.user_nm
         FROM board b
         LEFT JOIN class c ON b.scls_id = c.scls_id
         LEFT JOIN users u ON c.user_id = u.user_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
@@ -7,9 +7,28 @@
         <result 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" />
+            <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>-->
 
+    <!--
+        작성자 : 박세훈
+        작성일 : 2024.07.29
+        내 용 : 설문 조사 정보 등록
+    -->
     <insert id="insertSurvey" parameterType="SurveyVO">
         INSERT INTO survey( srvy_id,
                             srvy_type,
@@ -19,11 +38,57 @@
                 #{srvyCnt});
     </insert>
 
+
+    <!--
+        작성자 : 박세훈
+        작성일 : 2024.07.30
+        내 용 : 설문 조사 상세 정보 등록
+    -->
+
+    <insert id="insertSurveyDetail">
+        INSERT INTO survey_detail(  srvy_dtl_id,
+                                    srvy_dtl_cnt,
+                                    srvy_id)
+        VALUES (#{srvyDtlId},
+                #{srvyDtlCnt},
+                #{srvyId});
+    </insert>
+
+
+    <!--
+        작성자 : 박세훈
+        작성일 : 2024.07.29
+        내 용 : 설문 조사 정보 조회
+    -->
     <select id="surveyList" parameterType="SurveyVO">
         SELECT *
         FROM survey
     </select>
 
+    <!--
+        작성자 : 박세훈
+        작성일 : 2024.07.30
+        내 용 : 설문 조사 상세 정보 조회
+    -->
+
+    <select id="surveyDetailList" resultMap="surveyMap">
+        SELECT  s.srvy_id,
+                s.srvy_cnt,
+                s.srvy_type,
+                d.srvy_dtl_cnt,
+                d.srvy_dtl_id
+        FROM survey s
+        LEFT JOIN survey_detail d ON s.srvy_id = d.srvy_id
+        ORDER BY s.srvy_id DESC
+    </select>
+
+
+
+    <!--
+        작성자 : 박세훈
+        작성일 : 2024.07.29
+        내 용 : 설문 조사 정보 수정
+    -->
     <update id="updateSurvey" parameterType="SurveyVO">
         UPDATE survey
         SET srvy_type = #{srvyType},
@@ -35,6 +100,11 @@
 
 
 
+    <!--
+        작성자 : 박세훈
+        작성일 : 2024.07.29
+        내 용 : 설문 조사 정보 삭제
+    -->
     <delete id="deleteSurvey" parameterType="String">
         DELETE FROM survey
         WHERE srvy_id = #{srvyId}
Add a comment
List