guntaek 08-02
240802 김건택 단원 상세정보 기능 수정
@879dead70ea289de774e49b0e5b0f76c2a621820
src/main/java/com/takensoft/ai_lms/lms/text/vo/TextVO.java
--- src/main/java/com/takensoft/ai_lms/lms/text/vo/TextVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/text/vo/TextVO.java
@@ -35,5 +35,9 @@
     private String textTypeId;
     // 사용자 아이디(선생님)
     private String userId;
+    // 책 아이디
+    private String bookId;
+    // 단원 아이디
+    private String unitId;
 
 }
src/main/java/com/takensoft/ai_lms/lms/unit/dao/UnitDAO.java
--- src/main/java/com/takensoft/ai_lms/lms/unit/dao/UnitDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/unit/dao/UnitDAO.java
@@ -3,6 +3,7 @@
 import com.takensoft.ai_lms.lms.unit.vo.UnitVO;
 import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -52,5 +53,5 @@
      *
      * 단원 상세 정보
      */
-    List<UnitVO> unitDetail(UnitVO unitVO) throws Exception;
+    List<HashMap<String, Object>> unitDetail(UnitVO unitVO) throws Exception;
 }
src/main/java/com/takensoft/ai_lms/lms/unit/service/Impl/UnitServiceImpl.java
--- src/main/java/com/takensoft/ai_lms/lms/unit/service/Impl/UnitServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/unit/service/Impl/UnitServiceImpl.java
@@ -81,7 +81,7 @@
      * 단원 상세 정보
      */
     @Override
-    public List<UnitVO> unitDetail(UnitVO unitVO) throws Exception {
+    public List<HashMap<String, Object>> unitDetail(UnitVO unitVO) throws Exception {
         return unitDAO.unitDetail(unitVO);
     }
 
src/main/java/com/takensoft/ai_lms/lms/unit/service/UnitService.java
--- src/main/java/com/takensoft/ai_lms/lms/unit/service/UnitService.java
+++ src/main/java/com/takensoft/ai_lms/lms/unit/service/UnitService.java
@@ -51,6 +51,6 @@
      *
      * 단원 상세 정보
      */
-    List<UnitVO> unitDetail (UnitVO unitVO) throws Exception;
+    List<HashMap<String, Object>> unitDetail (UnitVO unitVO) throws Exception;
 
 }
src/main/java/com/takensoft/ai_lms/lms/unit/web/UnitController.java
--- src/main/java/com/takensoft/ai_lms/lms/unit/web/UnitController.java
+++ src/main/java/com/takensoft/ai_lms/lms/unit/web/UnitController.java
@@ -84,7 +84,7 @@
      */
     @PostMapping(path = "/unitDetail.json")
     public ResponseEntity<?> unitDetail(@RequestBody UnitVO unitVO) throws Exception {
-        List<UnitVO> result = unitService.unitDetail(unitVO);
+        List<HashMap<String, Object>> result = unitService.unitDetail(unitVO);
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
 }
src/main/resources/mybatis/mapper/lms/text-SQL.xml
--- src/main/resources/mybatis/mapper/lms/text-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/text-SQL.xml
@@ -11,6 +11,8 @@
         <result property="fileMngId" column="file_mng_id"/>
         <result property="textTypeId" column="text_type_id"/>
         <result property="userId" column="user_id"/>
+        <result property="bookId" column="book_id"/>
+        <result property="unitId" column="unit_id"/>
     </resultMap>
 
 
@@ -28,6 +30,8 @@
                          ,file_mng_id
                          ,text_type_id
                          ,user_id
+                         ,book_id
+                         ,unit_id
         ) VALUES (#{textId}
                  ,#{textTtl}
                  ,#{textCnt}
@@ -36,6 +40,8 @@
                  ,#{fileMngId}
                  ,#{textTypeId}
                  ,#{userId}
+                 ,#{bookId}
+                 ,#{unitId}
                  );
     </insert>
 
@@ -63,6 +69,8 @@
               ,file_mng_id
               ,text_type_id
               ,user_id
+              ,book_id
+              ,unit_id
         FROM text
         ORDER BY text_id DESC
         LIMIT #{pageSize}
@@ -83,6 +91,8 @@
              , file_mng_id
              , text_type_id
               ,user_id
+              ,book_id
+              ,unit_id
         FROM text
         WHERE text_id = #{textId}
         ORDER BY text_id DESC
src/main/resources/mybatis/mapper/lms/unit-SQL.xml
--- src/main/resources/mybatis/mapper/lms/unit-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/unit-SQL.xml
@@ -64,15 +64,26 @@
 
     <!--
     작 성 자 : 김건택
-    작 성 일 : 2024.07.25
+    작 성 일 : 2024.08.02
     내   용 : 단원 상세 정보
 -->
-    <select id="unitDetail" parameterType="UnitVO" resultType="com.takensoft.ai_lms.lms.unit.vo.UnitVO">
-        SELECT unit_id
-            , book_id
-            , unit_nm
-        FROM unit
-        WHERE unit_id = #{unitId}
+<!--    <select id="unitDetail" parameterType="UnitVO" resultType="com.takensoft.ai_lms.lms.unit.vo.UnitVO">-->
+<!--        SELECT unit_id-->
+<!--            , book_id-->
+<!--            , unit_nm-->
+<!--        FROM unit-->
+<!--        WHERE unit_id = #{unitId}-->
+<!--    </select>-->
+
+    <select id="unitDetail" parameterType="UnitVO" resultType="HashMap">
+        SELECT t.text_id
+            , u.unit_id
+            , u.book_id
+            , w.wd_book_id
+        FROM unit u
+        JOIN text t ON u.unit_id = t.unit_id
+        JOIN wordbook w ON u.book_id = w.book_id
+        WHERE u.book_id = #{bookId} AND u.unit_id = #{unitId};
     </select>
 
 </mapper>
(파일 끝에 줄바꿈 문자 없음)
Add a comment
List