박민혁 박민혁 08-05
Merge remote-tracking branch 'origin/master'
@d9fa4cfe8af7f8ab720628b3c5e9d996ca23448a
src/main/java/com/takensoft/ai_lms/lms/book/service/BookService.java
--- src/main/java/com/takensoft/ai_lms/lms/book/service/BookService.java
+++ src/main/java/com/takensoft/ai_lms/lms/book/service/BookService.java
@@ -33,7 +33,7 @@
      *
      * 교재 등록
      */
-    int insertBook(BookVO book);
+    int insertBook(BookVO bookVO);
 
     /**
      * @author  : 구자현
@@ -41,7 +41,7 @@
      *
      * 교재 제목 수정
      */
-    int updateBook(BookVO book);
+    int updateBook(BookVO bookVO);
 
     /**
      * @author  : 구자현
src/main/java/com/takensoft/ai_lms/lms/book/service/Impl/BookServiceImpl.java
--- src/main/java/com/takensoft/ai_lms/lms/book/service/Impl/BookServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/book/service/Impl/BookServiceImpl.java
@@ -52,10 +52,11 @@
      * 교재 등록
      */
     @Override
-    public int insertBook(BookVO book) {
+    public int insertBook(BookVO bookVO) {
         String book_id = bookIdgn.getNextStringId();
-        book.setBook_id(book_id);
-        return bookDAO.insertBook(book);
+        bookVO.setBook_id(book_id);
+        return bookDAO.insertBook(bookVO);
+
     }
 
     /**
@@ -65,8 +66,8 @@
      * 교재 제목 수정
      */
     @Override
-    public int updateBook(BookVO book) {
-        return bookDAO.updateBook(book);
+    public int updateBook(BookVO bookVO) {
+        return bookDAO.updateBook(bookVO);
     }
 
     /**
src/main/java/com/takensoft/ai_lms/lms/book/web/BookController.java
--- src/main/java/com/takensoft/ai_lms/lms/book/web/BookController.java
+++ src/main/java/com/takensoft/ai_lms/lms/book/web/BookController.java
@@ -49,8 +49,8 @@
      * 교재 등록
      */
     @PostMapping("/insert.json")
-    public ResponseEntity<?> insertBook(@RequestBody BookVO book) {
-        return new ResponseEntity<>(bookServiceImpl.insertBook(book), HttpStatus.OK);
+    public ResponseEntity<?> insertBook(@RequestBody BookVO bookVO) {
+        return new ResponseEntity<>(bookServiceImpl.insertBook(bookVO), HttpStatus.OK);
     }
 
     /**
@@ -60,8 +60,8 @@
      * 교재 제목 수정
      */
     @PostMapping("/update.json")
-    public ResponseEntity<?> updateBook(@RequestBody BookVO book) {
-        return new ResponseEntity<>(bookServiceImpl.updateBook(book), HttpStatus.OK);
+    public ResponseEntity<?> updateBook(@RequestBody BookVO bookVO) {
+        return new ResponseEntity<>(bookServiceImpl.updateBook(bookVO), HttpStatus.OK);
     }
 
     /**
src/main/java/com/takensoft/ai_lms/lms/unit_learning/service/Impl/UnitLearningServiceImpl.java
--- src/main/java/com/takensoft/ai_lms/lms/unit_learning/service/Impl/UnitLearningServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/unit_learning/service/Impl/UnitLearningServiceImpl.java
@@ -1,5 +1,6 @@
 package com.takensoft.ai_lms.lms.unit_learning.service.Impl;
 
+import com.takensoft.ai_lms.common.idgen.service.IdgenService;
 import com.takensoft.ai_lms.lms.unit_learning.dao.UnitLearningDAO;
 import com.takensoft.ai_lms.lms.unit_learning.service.UnitLearningService;
 import com.takensoft.ai_lms.lms.unit_learning.vo.UnitLearningVO;
@@ -19,6 +20,8 @@
 
     private final UnitLearningDAO unitLearningDAO;
 
+    private final IdgenService unitLearningIdgn;
+
     /**
      * @author  : 구자현
      * @since   : 2024.07.26
@@ -37,8 +40,12 @@
      * 로드맵 등록
      */
     @Override
-    public int insertUnitLearning(List<UnitLearningVO> unitLearningVO) {
-        return unitLearningDAO.insertUnitLearning(unitLearningVO);
+    public int insertUnitLearning(List<UnitLearningVO> unitLearningVOList) {
+        for (UnitLearningVO unitLearningVO : unitLearningVOList) {
+            String learning_id = unitLearningIdgn.getNextStringId();
+            unitLearningVO.setLearning_id(learning_id);
+        }
+        return unitLearningDAO.insertUnitLearning(unitLearningVOList);
     }
 
     /**
src/main/java/com/takensoft/ai_lms/lms/unit_learning/vo/UnitLearningVO.java
--- src/main/java/com/takensoft/ai_lms/lms/unit_learning/vo/UnitLearningVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/unit_learning/vo/UnitLearningVO.java
@@ -16,6 +16,9 @@
 @NoArgsConstructor
 @AllArgsConstructor
 public class UnitLearningVO {
+    // 학습 로드맵 아이디
+    private String learning_id;
+
     // 단원 아이디
     private String unit_id;
 
 
src/main/java/com/takensoft/ai_lms/lms/user_learning/dao/UserLearningDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_learning/dao/UserLearningDAO.java
@@ -0,0 +1,39 @@
+package com.takensoft.ai_lms.lms.user_learning.dao;
+
+import com.takensoft.ai_lms.lms.user_learning.vo.UserLearningVO;
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
+
+/**
+ * @author  : 구자현
+ * @since   : 2024.08.05
+ *
+ * 로드맵 상태 관련 Mapper
+ */
+@Mapper("userLearningDAO")
+public interface UserLearningDAO {
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵의 상태 정보
+     */
+    UserLearningVO getUserLearningStatus(String learning_id);
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 추가
+     */
+    int insertUserLearning(UserLearningVO userLearningVO);
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 변경
+     */
+    int updateUserLearning(UserLearningVO userLearningVO);
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_learning/service/Impl/UserLearningServiceImpl.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_learning/service/Impl/UserLearningServiceImpl.java
@@ -0,0 +1,54 @@
+package com.takensoft.ai_lms.lms.user_learning.service.Impl;
+
+import com.takensoft.ai_lms.lms.user_learning.dao.UserLearningDAO;
+import com.takensoft.ai_lms.lms.user_learning.service.UserLearningService;
+import com.takensoft.ai_lms.lms.user_learning.vo.UserLearningVO;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author  : 구자현
+ * @since   : 2024.08.05
+ *
+ * 로드맵 상태 관련 ServiceImpl 클래스
+ */
+@Service
+@RequiredArgsConstructor
+public class UserLearningServiceImpl implements UserLearningService {
+
+    private final UserLearningDAO userLearningDAO;
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵의 상태 정보
+     */
+    @Override
+    public UserLearningVO getUserLearningStatus(String learning_id) {
+        return userLearningDAO.getUserLearningStatus(learning_id);
+    };
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 추가
+     */
+    @Override
+    public int insertUserLearning(UserLearningVO userLearningVO) {
+        return userLearningDAO.insertUserLearning(userLearningVO);
+    };
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 변경
+     */
+    @Override
+    public int updateUserLearning(UserLearningVO userLearningVO) {
+        return userLearningDAO.updateUserLearning(userLearningVO);
+    };
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_learning/service/UserLearningService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_learning/service/UserLearningService.java
@@ -0,0 +1,37 @@
+package com.takensoft.ai_lms.lms.user_learning.service;
+
+import com.takensoft.ai_lms.lms.user_learning.vo.UserLearningVO;
+
+/**
+ * @author  : 구자현
+ * @since   : 2024.08.05
+ *
+ * 로드맵 상태 관련 Service 클래스
+ */
+public interface UserLearningService {
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵의 상태 정보
+     */
+    UserLearningVO getUserLearningStatus(String learning_id);
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 추가
+     */
+    int insertUserLearning(UserLearningVO userLearningVO);
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 변경
+     */
+    int updateUserLearning(UserLearningVO userLearningVO);
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_learning/vo/UserLearningVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_learning/vo/UserLearningVO.java
@@ -0,0 +1,26 @@
+package com.takensoft.ai_lms.lms.user_learning.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+/**
+ * @author  : 구자현
+ * @since   : 2024.08.05
+ *
+ * 로드맵 상태 관련 VO
+ */
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+public class UserLearningVO {
+
+    // 학습 로드맵 아이디
+    private String learning_id;
+    // 학생 아이디
+    private String std_id;
+    // 완료 여부
+    private String learning_yn;
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_learning/web/UserLearningController.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_learning/web/UserLearningController.java
@@ -0,0 +1,59 @@
+package com.takensoft.ai_lms.lms.user_learning.web;
+
+import com.takensoft.ai_lms.lms.user_learning.service.Impl.UserLearningServiceImpl;
+import com.takensoft.ai_lms.lms.user_learning.vo.UserLearningVO;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author  : 구자현
+ * @since   : 2024.08.05
+ *
+ * 로드맵 상태 관련 Controller 클래스
+ */
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/unitLearning/status")
+public class UserLearningController {
+
+    private final UserLearningServiceImpl userLearningServiceImpl;
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵의 상태 정보
+     */
+    @PostMapping("/find.json")
+    public ResponseEntity<?> getUserLearningStatus(@RequestBody UserLearningVO userLearningVO) {
+        return new ResponseEntity<>(userLearningServiceImpl.getUserLearningStatus(userLearningVO.getLearning_id()), HttpStatus.OK);
+    };
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 추가
+     */
+    @PostMapping("/insert.json")
+    public ResponseEntity<?> insertUserLearning(@RequestBody UserLearningVO userLearningVO) {
+        return new ResponseEntity<>(userLearningServiceImpl.insertUserLearning(userLearningVO), HttpStatus.OK);
+    };
+
+    /**
+     * @author  : 구자현
+     * @since   : 2024.08.05
+     *
+     * 로드맵 상태 변경
+     */
+    @PostMapping("/update.json")
+    public ResponseEntity<?> updateUserLearning(@RequestBody UserLearningVO userLearningVO) {
+        return new ResponseEntity<>(userLearningServiceImpl.updateUserLearning(userLearningVO), HttpStatus.OK);
+    };
+
+}
src/main/resources/mybatis/mapper/lms/book-SQL.xml
--- src/main/resources/mybatis/mapper/lms/book-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/book-SQL.xml
@@ -40,7 +40,9 @@
     -->
     <insert id="insertBook" parameterType="bookVO">
         INSERT
-          INTO book (book_id, book_nm)
+          INTO
+            book
+            (book_id, book_nm)
         VALUES (#{book_id}, #{book_nm})
     </insert>
 
src/main/resources/mybatis/mapper/lms/unit_learning-SQL.xml
--- src/main/resources/mybatis/mapper/lms/unit_learning-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/unit_learning-SQL.xml
@@ -3,6 +3,7 @@
 <mapper namespace="com.takensoft.ai_lms.lms.unit_learning.dao.UnitLearningDAO">
 
     <resultMap id="unitLearningMap" type="UnitLearningVO">
+        <result property="learning_id" column="learning_id"/>
         <result property="unit_id" column="unit_id"/>
         <result property="prblm_id" column="prblm_id"/>
         <result property="wd_book_id" column="wd_book_id"/>
@@ -18,6 +19,7 @@
     -->
     <select id="getUnitLearning" parameterType="String" resultMap="unitLearningMap">
         SELECT
+            ul.learning_id,
             ul.unit_id,
             ul.prblm_id,
             ul.wd_book_id,
@@ -41,10 +43,10 @@
         INSERT
           INTO
             unit_learning
-            (unit_id, prblm_id, wd_book_id, text_id, eval_id, seq)
+            (learning_id, unit_id, prblm_id, wd_book_id, text_id, eval_id, seq)
         VALUES
         <foreach collection="list" item="item" separator=",">
-            (#{item.unit_id}, #{item.prblm_id}, #{item.wd_book_id}, #{item.text_id}, #{item.eval_id}, #{item.seq})
+            (#{item.learning_id}, #{item.unit_id}, #{item.prblm_id}, #{item.wd_book_id}, #{item.text_id}, #{item.eval_id}, #{item.seq})
         </foreach>
     </insert>
 
@@ -53,7 +55,7 @@
         작 성 일 : 2024.07.26
         내   용 : 로드맵 수정
     -->
-    <update id="updateUnitLearning"  parameterType="unitLearningVO">
+    <update id="updateUnitLearning" parameterType="unitLearningVO">
         UPDATE unit_learning
            SET seq = #{seq}
          WHERE unit_id = #{unit_id}
 
src/main/resources/mybatis/mapper/lms/user_learning-SQL.xml (added)
+++ src/main/resources/mybatis/mapper/lms/user_learning-SQL.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.takensoft.ai_lms.lms.user_learning.dao.UserLearningDAO">
+
+    <resultMap id="userLearningMap" type="UserLearningVO">
+        <result property="learning_id" column="learning_id"/>
+        <result property="std_id" column="std_id"/>
+        <result property="learning_yn" column="learning_yn"/>
+    </resultMap>
+
+    <!--
+        작 성 자 : 구자현
+        작 성 일 : 2024.08.05
+        내   용 : 로드맵의 상태 정보
+    -->
+    <select id="getUserLearningStatus" parameterType="String" resultMap="userLearningMap">
+        SELECT
+            learning_id,
+            std_id,
+            learning_yn
+         FROM user_learning
+        WHERE learning_id = #{learning_id}
+    </select>
+
+    <!--
+        작 성 자 : 구자현
+        작 성 일 : 2024.08.05
+        내   용 : 로드맵 상태 추가
+    -->
+    <insert id="insertUserLearning" parameterType="userLearningVO">
+        INSERT
+          INTO
+            user_learning
+            (learning_id, std_id, learning_yn)
+        VALUES (#{learning_id}, #{std_id}, 'N')
+    </insert>
+
+    <!--
+        작 성 자 : 구자현
+        작 성 일 : 2024.07.25
+        내   용 : 로드맵 상태 변경
+    -->
+    <update id="updateUserLearning" parameterType="userLearningVO">
+        UPDATE user_learning
+           SET learning_yn = #{learning_yn}
+         WHERE learning_id = #{learning_id}
+    </update>
+
+</mapper>(파일 끝에 줄바꿈 문자 없음)
Add a comment
List