권지수 08-02
240802 권지수 문제 컬럼 추가, 단원 평가 문제 delete, 문제 풀이 로그 CRUD
@a4bf0b07b0756a8bfc9e06047baed35a454e21fb
src/main/java/com/takensoft/ai_lms/common/confing/SecurityConfig.java
--- src/main/java/com/takensoft/ai_lms/common/confing/SecurityConfig.java
+++ src/main/java/com/takensoft/ai_lms/common/confing/SecurityConfig.java
@@ -75,6 +75,7 @@
                 .requestMatchers("/photoMng/**").permitAll() // 사진첩 정보 진입 허용
                 .requestMatchers("/wordbook/**").permitAll()
                 .requestMatchers("/problem/**").permitAll() // 문제 정보 진입 허용
+                .requestMatchers("/problemLog/**").permitAll() // 문제 풀이 로그 정보 진입 허용
                 .requestMatchers("/evaluation/**").permitAll() // 단원 평가 정보 진입 허용
                 .requestMatchers("/evalProblem/**").permitAll() // 단원 평가 문제 진입 허용
                 .requestMatchers("/unitLearning/**").permitAll() // 로드맵 정보 진입 허용
src/main/java/com/takensoft/ai_lms/lms/eval_problem/dao/EvalProblemDAO.java
--- src/main/java/com/takensoft/ai_lms/lms/eval_problem/dao/EvalProblemDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/eval_problem/dao/EvalProblemDAO.java
@@ -29,4 +29,12 @@
      * 특정 단원의 문제 수 조회
      */
     int unitProblemNum(EvalProblemVO evalProblemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 단원 평가에 등록된 문제 삭제
+     */
+    int deleteEvalProblem(EvalProblemVO evalProblemVO) throws Exception;
 }
src/main/java/com/takensoft/ai_lms/lms/eval_problem/service/EvalProblemService.java
--- src/main/java/com/takensoft/ai_lms/lms/eval_problem/service/EvalProblemService.java
+++ src/main/java/com/takensoft/ai_lms/lms/eval_problem/service/EvalProblemService.java
@@ -25,4 +25,12 @@
      * 특정 단원의 문제 수 조회
      */
     int unitProblemNum(EvalProblemVO evalProblemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 단원 평가에 등록된 문제 삭제
+     */
+    int deleteEvalProblem(EvalProblemVO evalProblemVO) throws Exception;
 }
src/main/java/com/takensoft/ai_lms/lms/eval_problem/service/Impl/EvalProblemImpl.java
--- src/main/java/com/takensoft/ai_lms/lms/eval_problem/service/Impl/EvalProblemImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/eval_problem/service/Impl/EvalProblemImpl.java
@@ -39,4 +39,14 @@
     public int unitProblemNum(EvalProblemVO evalProblemVO) throws Exception {
         return evalProblemDAO.unitProblemNum(evalProblemVO);
     }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 단원 평가에 등록된 문제 삭제
+     */
+    public int deleteEvalProblem(EvalProblemVO evalProblemVO) throws Exception {
+        return evalProblemDAO.deleteEvalProblem(evalProblemVO);
+    }
 }
src/main/java/com/takensoft/ai_lms/lms/eval_problem/web/EvalProblemController.java
--- src/main/java/com/takensoft/ai_lms/lms/eval_problem/web/EvalProblemController.java
+++ src/main/java/com/takensoft/ai_lms/lms/eval_problem/web/EvalProblemController.java
@@ -52,4 +52,17 @@
 
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 단원 평가에 등록된 문제 삭제
+     */
+    @PostMapping(path = "/deleteEvalProblem.json")
+    public ResponseEntity<?> deleteEvalProblem(@RequestBody EvalProblemVO evalProblemVO) throws Exception {
+        int result = evalProblemService.deleteEvalProblem(evalProblemVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
 }
src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java
--- src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java
@@ -26,4 +26,10 @@
     private String prblmTypeId;
     // 카테고리 아이디
     private String prblmCtgryId;
+    // 사용자 아이디(선생)
+    private String userId;
+    // 책 아이디
+    private String bookId;
+    // 단원 아이디
+    private String unitId;
 }
 
src/main/java/com/takensoft/ai_lms/lms/problem_log/dao/ProblemLogDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem_log/dao/ProblemLogDAO.java
@@ -0,0 +1,47 @@
+package com.takensoft.ai_lms.lms.problem_log.dao;
+
+import com.takensoft.ai_lms.lms.problem_log.vo.ProblemLogVO;
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
+
+/**
+ * @author 권지수
+ * @since 2024.08.01
+ *
+ * 문제 풀이 로그 DAO 클래스
+ */
+
+@Mapper("problemLogDAO")
+public interface ProblemLogDAO {
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 문제 풀이 로그 정보 입력
+     */
+    int insertProblemLog(ProblemLogVO problemLogVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 수정
+     */
+    int updateProblemLog(ProblemLogVO problemLogVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 삭제
+     */
+    int deleteProblemLog(ProblemLogVO problemLogVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 조회
+     */
+    ProblemLogVO problemLogInfo(ProblemLogVO problemLogVO) throws Exception;
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem_log/service/Impl/ProblemLogServiceImpl.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem_log/service/Impl/ProblemLogServiceImpl.java
@@ -0,0 +1,68 @@
+package com.takensoft.ai_lms.lms.problem_log.service.Impl;
+
+import com.takensoft.ai_lms.common.idgen.service.IdgenService;
+import com.takensoft.ai_lms.lms.problem_log.dao.ProblemLogDAO;
+import com.takensoft.ai_lms.lms.problem_log.service.ProblemLogService;
+import com.takensoft.ai_lms.lms.problem_log.vo.ProblemLogVO;
+import lombok.RequiredArgsConstructor;
+import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author 권지수
+ * @since 2024.08.01
+ *
+ * 문제 풀이 로그 ServiceImpl 클래스
+ */
+
+@Service("problemLogService")
+@RequiredArgsConstructor
+public class ProblemLogServiceImpl extends EgovAbstractServiceImpl implements ProblemLogService {
+
+    private final ProblemLogDAO problemLogDAO;
+    private final IdgenService problemLogIdgn;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 풀이 로그 정보 입력
+     */
+    @Override
+    public int insertProblemLog(ProblemLogVO problemLogVO) throws Exception {
+        String problemLogId = problemLogIdgn.getNextStringId();
+        problemLogVO.setPrblmLogId(problemLogId);
+
+        return problemLogDAO.insertProblemLog(problemLogVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 수정
+     */
+    public int updateProblemLog(ProblemLogVO problemLogVO) throws Exception {
+        return problemLogDAO.updateProblemLog(problemLogVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 삭제
+     */
+    public int deleteProblemLog(ProblemLogVO problemLogVO) throws Exception {
+        return problemLogDAO.deleteProblemLog(problemLogVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 조회
+     */
+    public ProblemLogVO problemLogInfo(ProblemLogVO problemLogVO) throws Exception {
+        return problemLogDAO.problemLogInfo(problemLogVO);
+    }
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem_log/service/ProblemLogService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem_log/service/ProblemLogService.java
@@ -0,0 +1,45 @@
+package com.takensoft.ai_lms.lms.problem_log.service;
+
+import com.takensoft.ai_lms.lms.problem_log.vo.ProblemLogVO;
+
+/**
+ * @author 권지수
+ * @since 2024.08.01
+ *
+ * 문제 풀이 로그 Service 클래스
+ */
+
+public interface ProblemLogService {
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 문제 풀이 로그 정보 입력
+     */
+    int insertProblemLog(ProblemLogVO problemLogVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 수정
+     */
+    int updateProblemLog(ProblemLogVO problemLogVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 삭제
+     */
+    int deleteProblemLog(ProblemLogVO problemLogVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 조회
+     */
+    ProblemLogVO problemLogInfo(ProblemLogVO problemLogVO) throws Exception;
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem_log/vo/ProblemLogVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem_log/vo/ProblemLogVO.java
@@ -0,0 +1,31 @@
+package com.takensoft.ai_lms.lms.problem_log.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProblemLogVO {
+    // 문제 풀이 로그 아이디
+    private String prblmLogId;
+    // 학생 답변
+    private String prblmAns;
+    // 풀이 시작 시간
+    private String prblmStrtTm;
+    // 풀이 종료 시간
+    private String prblmEndTm;
+    // 학생 정답 맞춤 여부
+    private String prblmLogAnsYn;
+    // 학생 재풀이 번호
+    private int prblmLogAnsCnt;
+    // 파일 관리 아이디
+    private String fileMngId;
+    // 학생 아이디
+    private String stdId;
+    // 문제 아이디
+    private String prblmId;
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem_log/web/ProblemLogController.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem_log/web/ProblemLogController.java
@@ -0,0 +1,81 @@
+package com.takensoft.ai_lms.lms.problem_log.web;
+
+import com.takensoft.ai_lms.lms.problem.vo.ProblemVO;
+import com.takensoft.ai_lms.lms.problem_log.service.ProblemLogService;
+import com.takensoft.ai_lms.lms.problem_log.vo.ProblemLogVO;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+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.01
+ *
+ * 문제 풀이 로그 Controller 클래스
+ */
+
+@RestController
+@RequiredArgsConstructor
+@Slf4j
+@RequestMapping(value = "/problemLog")
+public class ProblemLogController {
+
+    private final ProblemLogService problemLogService;
+
+    /**
+     * @author 권지수
+     * @since 2024.08.01
+     *
+     * 문제 풀이 로그 정보 입력
+     */
+    @PostMapping(path = "/insertProblemLog.json")
+    public ResponseEntity<?> insertProblemLog(@RequestBody ProblemLogVO problemLogVO) throws Exception {
+        int result = problemLogService.insertProblemLog(problemLogVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 수정
+     */
+    @PostMapping(path = "/updateProblemLog.json")
+    public ResponseEntity<?> updateProblemLog(@RequestBody ProblemLogVO problemLogVO) throws Exception {
+        int result = problemLogService.updateProblemLog(problemLogVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 삭제
+     */
+    @PostMapping(path = "/deleteProblemLog.json")
+    public ResponseEntity<?> deleteProblemLog(@RequestBody ProblemLogVO problemLogVO) throws Exception {
+        int result = problemLogService.deleteProblemLog(problemLogVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.08.02
+     *
+     * 문제 풀이 로그 정보 조회
+     */
+    @PostMapping(path = "/problemLogInfo.json")
+    public ResponseEntity<?> problemLogInfo(@RequestBody ProblemLogVO problemLogVO) throws Exception {
+        ProblemLogVO result = problemLogService.problemLogInfo(problemLogVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+}
src/main/resources/mybatis/mapper/lms/eval_problem-SQL.xml
--- src/main/resources/mybatis/mapper/lms/eval_problem-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/eval_problem-SQL.xml
@@ -29,4 +29,15 @@
         WHERE eval_id = #{evalId}
     </select>
 
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.08.01
+        내   용 : 단원 평가에 등록된 문제 삭제
+    -->
+    <delete id="deleteEvalProblem" parameterType="EvalProblemVO">
+        DELETE FROM eval_problem
+        WHERE prblm_id = #{prblmId}
+            AND eval_id = #{evalId}
+    </delete>
+
 </mapper>
(파일 끝에 줄바꿈 문자 없음)
src/main/resources/mybatis/mapper/lms/problem-SQL.xml
--- src/main/resources/mybatis/mapper/lms/problem-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/problem-SQL.xml
@@ -2,17 +2,6 @@
 <!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.problem.dao.ProblemDAO">
 
-    <!--resultMap id="problemMap" type="ProblemVO">
-        <result property="prblmId" column="prblm_id"/>
-        <result property="prblmExpln" column="prblm_expln"/>
-        <result property="prblmScr" column="prblm_scr"/>
-        <result property="prblmHint" column="prblm_hint"/>
-        <result property="prblmCmmt" column="prblm_cmmt"/>
-        <result property="fileMngId" column="file_mng_id"/>
-        <result property="prblmTypeId" column="prblm_type_id"/>
-        <result property="prblmCtgryId" column="prblm_ctgry_id"/>
-    </resultMap-->
-
     <!--
         작 성 자 : 권지수
         작 성 일 : 2024.07.25
@@ -27,7 +16,10 @@
             prblm_cmmt,
             file_mng_id,
             prblm_type_id,
-            prblm_ctgry_id
+            prblm_ctgry_id,
+            user_id,
+            book_id,
+            unit_id
         FROM problem
         WHERE prblm_id = #{prblmId}
     </select>
@@ -62,7 +54,10 @@
             prblm_cmmt,
             file_mng_id,
             prblm_type_id,
-            prblm_ctgry_id
+            prblm_ctgry_id,
+            user_id,
+            book_id,
+            unit_id
         ) VALUES (
             #{prblmId},
             #{prblmExpln},
@@ -71,7 +66,10 @@
             #{prblmCmmt},
             #{fileMngId},
             #{prblmTypeId},
-            #{prblmCtgryId}
+            #{prblmCtgryId},
+            #{userId},
+            #{bookId},
+            #{unitId}
         )
     </insert>
 
@@ -110,7 +108,10 @@
             prblm_cmmt = #{prblmCmmt},
             file_mng_id = #{fileMngId},
             prblm_type_id = #{prblmTypeId},
-            prblm_ctgry_id = #{prblmCtgryId}
+            prblm_ctgry_id = #{prblmCtgryId},
+            user_id = #{userId},
+            book_id = #{bookId},
+            unit_id = #{unitId}
         WHERE prblm_id = #{prblmId}
     </update>
 
@@ -152,7 +153,10 @@
             prblm_cmmt,
             file_mng_id,
             prblm_type_id,
-            prblm_ctgry_id
+            prblm_ctgry_id,
+            user_id,
+            book_id,
+            unit_id
         FROM problem
         WHERE 1 = 1
         <if test="option != null and keyword != null">
@@ -191,7 +195,10 @@
             p.prblm_cmmt AS prblmCmmt,
             p.file_mng_id AS fileMngId,
             p.prblm_type_id AS prblmTypeId,
-            p.prblm_ctgry_id AS prblmCtgryId
+            p.prblm_ctgry_id AS prblmCtgryId,
+            p.user_id AS userId,
+            p.book_id AS bookId,
+            p.unit_id AS unitId
         FROM
             eval_problem ep
         JOIN
 
src/main/resources/mybatis/mapper/lms/problem_log-SQL.xml (added)
+++ src/main/resources/mybatis/mapper/lms/problem_log-SQL.xml
@@ -0,0 +1,84 @@
+<?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.problem_log.dao.ProblemLogDAO">
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.08.01
+        내   용 : 문제 풀이 로그 정보 insert
+    -->
+    <insert id="insertProblemLog" parameterType="ProblemLogVO">
+        INSERT INTO problem_log (
+            prblm_log_id,
+            prblm_ans,
+            prblm_strt_tm,
+            prblm_end_tm,
+            prblm_log_ans_yn,
+            prblm_log_ans_cnt,
+            file_mng_id,
+            std_id,
+            prblm_id
+        ) VALUES (
+            #{prblmLogId},
+            #{prblmAns},
+            #{prblmStrtTm},
+            #{prblmEndTm},
+            #{prblmLogAnsYn} ,
+            #{prblmLogAnsCnt} ,
+            #{fileMngId},
+            #{stdId},
+            #{prblmId}
+        )
+    </insert>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.08.02
+        내   용 : 문제 풀이 로그 정보 update
+    -->
+    <update id="updateProblemLog" parameterType="ProblemLogVO">
+        UPDATE problem_log
+        SET
+            prblm_ans = #{prblmAns},
+            prblm_strt_tm = #{prblmStrtTm},
+            prblm_end_tm = #{prblmEndTm},
+            prblm_log_ans_yn = #{prblmLogAnsYn},
+            prblm_log_ans_cnt = #{prblmLogAnsCnt},
+            file_mng_id = #{fileMngId},
+            std_id = #{stdId},
+            prblm_id = #{prblmId}
+        WHERE prblm_log_id = #{prblmLogId}
+    </update>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.08.02
+        내   용 : 문제 풀이 로그 정보 delete
+    -->
+    <delete id="deleteProblemLog" parameterType="ProblemLogVO">
+        DELETE FROM problem_log
+        WHERE prblm_log_id = #{prblmLogId}
+    </delete>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.08.02
+        내   용 : 문제 풀이 로그 정보 read
+    -->
+    <select id="problemLogInfo" parameterType="ProblemLogVO" resultType="ProblemLogVO">
+        SELECT
+            prblm_log_id,
+            prblm_ans,
+            prblm_strt_tm,
+            prblm_end_tm,
+            prblm_log_ans_yn,
+            prblm_log_ans_cnt,
+            file_mng_id,
+            std_id,
+            prblm_id
+        FROM problem_log
+        WHERE prblm_log_id = #{prblmLogId}
+    </select>
+
+
+</mapper>(파일 끝에 줄바꿈 문자 없음)
Add a comment
List