권지수 07-29
240729 권지수 문제 CRUD
@12d024b398a8ea284fd71d4fc330705409d25b76
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
@@ -64,6 +64,7 @@
                 .requestMatchers("/test/**").permitAll()
                 .requestMatchers("/studentInfo/**").permitAll() // 학생 정보 진입 허용(민수)
                 .requestMatchers("/board/**").permitAll() // 게시판 정보 진입 허용
+                .requestMatchers("/problem/**").permitAll() // 문제 정보 진입 허용
                 .anyRequest().authenticated()); // 나머지 경로는 인증 필요
 
         // jwt 필터 처리 적용
 
src/main/java/com/takensoft/ai_lms/lms/evaluation/dao/EvaluationDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/evaluation/dao/EvaluationDAO.java
@@ -0,0 +1,4 @@
+package com.takensoft.ai_lms.lms.evaluation.dao;
+
+public interface EvaluationDAO {
+}
 
src/main/java/com/takensoft/ai_lms/lms/evaluation/service/EvaluationService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/evaluation/service/EvaluationService.java
@@ -0,0 +1,4 @@
+package com.takensoft.ai_lms.lms.evaluation.service;
+
+public interface EvaluationService {
+}
 
src/main/java/com/takensoft/ai_lms/lms/evaluation/service/Impl/EvaluationService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/evaluation/service/Impl/EvaluationService.java
@@ -0,0 +1,4 @@
+package com.takensoft.ai_lms.lms.evaluation.service.Impl;
+
+public class EvaluationService {
+}
 
src/main/java/com/takensoft/ai_lms/lms/evaluation/vo/EvaluationVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/evaluation/vo/EvaluationVO.java
@@ -0,0 +1,4 @@
+package com.takensoft.ai_lms.lms.evaluation.vo;
+
+public class EvaluationVO {
+}
 
src/main/java/com/takensoft/ai_lms/lms/evaluation/web/EvaluationController.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/evaluation/web/EvaluationController.java
@@ -0,0 +1,4 @@
+package com.takensoft.ai_lms.lms.evaluation.web;
+
+public class EvaluationController {
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/dao/ProblemDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/dao/ProblemDAO.java
@@ -0,0 +1,75 @@
+package com.takensoft.ai_lms.lms.problem.dao;
+
+import com.takensoft.ai_lms.lms.problem.vo.ProblemDetailVO;
+import com.takensoft.ai_lms.lms.problem.vo.ProblemVO;
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
+
+import java.util.List;
+
+/**
+ * @author 권지수
+ * @since 2024.07.25
+ *
+ * 문제 DAO 클래스
+ */
+
+@Mapper("problemDAO")
+public interface ProblemDAO {
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 데이터 조회
+     */
+    ProblemVO problemInfo(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 선지 리스트 조회
+     */
+    List<ProblemDetailVO> problemDetailList(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 입력
+     */
+    int insertProblem(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 입력
+     */
+    int insertProblemDetail(ProblemDetailVO problemDetailVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 수정
+     */
+    int updateProblem(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 수정
+     */
+    int updateProblemDetail(ProblemDetailVO problemDetailVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 삭제
+     */
+    int deleteProblem(ProblemVO problemVO) throws Exception;
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/dao/ProblemDetailDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/dao/ProblemDetailDAO.java
@@ -0,0 +1,14 @@
+package com.takensoft.ai_lms.lms.problem.dao;
+
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
+
+/**
+ * @author 권지수
+ * @since 2024.07.26
+ *
+ * 문제 상세정보 DAO 클래스
+ */
+
+@Mapper("problemDetailDAO")
+public interface ProblemDetailDAO {
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/service/Impl/ProblemServiceImpl.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/service/Impl/ProblemServiceImpl.java
@@ -0,0 +1,109 @@
+package com.takensoft.ai_lms.lms.problem.service.Impl;
+
+import com.takensoft.ai_lms.common.idgen.service.IdgenService;
+import com.takensoft.ai_lms.lms.problem.dao.ProblemDAO;
+import com.takensoft.ai_lms.lms.problem.service.ProblemService;
+import com.takensoft.ai_lms.lms.problem.vo.ProblemDetailVO;
+import com.takensoft.ai_lms.lms.problem.vo.ProblemVO;
+import lombok.RequiredArgsConstructor;
+import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author 권지수
+ * @since 2024.07.25
+ *
+ * 문제 ServiceImpl 클래스
+ */
+
+@Service("problemService")
+@RequiredArgsConstructor
+public class ProblemServiceImpl extends EgovAbstractServiceImpl implements ProblemService {
+
+    private final ProblemDAO problemDAO;
+    private final IdgenService problemIdgn;
+    private final IdgenService problemDtlIdgn;
+
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 데이터 조회
+     */
+    @Override
+    public ProblemVO problemInfo(ProblemVO problemVO) throws Exception {
+        return problemDAO.problemInfo(problemVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 선지 리스트 조회
+     */
+    @Override
+    public List<ProblemDetailVO> problemDetailList(ProblemVO problemVO) throws Exception {
+        return problemDAO.problemDetailList(problemVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 입력
+     */
+    @Override
+    public int insertProblem(ProblemVO problemVO) throws Exception {
+        String problemId = problemIdgn.getNextStringId();
+        problemVO.setPrblmId(problemId);
+
+        return problemDAO.insertProblem(problemVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 입력
+     */
+    @Override
+    public int insertProblemDetail(ProblemDetailVO problemDetailVO) throws Exception {
+        String problemDtlId = problemDtlIdgn.getNextStringId();
+        problemDetailVO.setPrblmDtlId(problemDtlId);
+
+        return problemDAO.insertProblemDetail(problemDetailVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 수정
+     */
+    public int updateProblem(ProblemVO problemVO) throws Exception {
+        return problemDAO.updateProblem(problemVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 수정
+     */
+    public int updateProblemDetail(ProblemDetailVO problemDetailVO) throws Exception {
+        return problemDAO.updateProblemDetail(problemDetailVO);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 삭제
+     */
+    public int deleteProblem(ProblemVO problemVO) throws Exception {
+        return problemDAO.deleteProblem(problemVO);
+    }
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/service/ProblemService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/service/ProblemService.java
@@ -0,0 +1,73 @@
+package com.takensoft.ai_lms.lms.problem.service;
+
+import com.takensoft.ai_lms.lms.problem.vo.ProblemDetailVO;
+import com.takensoft.ai_lms.lms.problem.vo.ProblemVO;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author 권지수
+ * @since 2024.07.25
+ *
+ * 문제 Service 클래스
+ */
+
+public interface ProblemService {
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 데이터 조회
+     */
+    ProblemVO problemInfo(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 선지 리스트 조회
+     */
+     List<ProblemDetailVO> problemDetailList(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 입력
+     */
+    int insertProblem(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 입력
+     */
+    int insertProblemDetail(ProblemDetailVO problemDetailVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 수정
+     */
+    int updateProblem(ProblemVO problemVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 수정
+     */
+    int updateProblemDetail(ProblemDetailVO problemDetailVO) throws Exception;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 삭제
+     */
+    int deleteProblem(ProblemVO problemVO) throws Exception;
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemDetailVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemDetailVO.java
@@ -0,0 +1,23 @@
+package com.takensoft.ai_lms.lms.problem.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProblemDetailVO {
+    // 문제 상세 아이디
+    private String prblmDtlId;
+    // 문제 아이디
+    private String prblmId;
+    // 문제 상세 텍스트
+    private String prblmDtlExpln;
+    // 정답 여부
+    private String prblmYn;
+    // 파일 관리 아이디
+    private String fileMngId;
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java
@@ -0,0 +1,29 @@
+package com.takensoft.ai_lms.lms.problem.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProblemVO {
+    // 문제 아이디
+    private String prblmId;
+    // 문제 내용
+    private String prblmExpln;
+    // 문제 점수
+    private int prblmScr;
+    // 문제 힌트
+    private String prblmHint;
+    // 문제 해설
+    private String prblmCmmt;
+    // 파일 관리 아이디
+    private String fileMngId;
+    // 유형 아이디
+    private String prblmTypeId;
+    // 카테고리 아이디
+    private String prblmCtgryId;
+}
 
src/main/java/com/takensoft/ai_lms/lms/problem/web/ProblemController.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/problem/web/ProblemController.java
@@ -0,0 +1,139 @@
+package com.takensoft.ai_lms.lms.problem.web;
+
+import com.takensoft.ai_lms.lms.auth.vo.UserVO;
+import com.takensoft.ai_lms.lms.problem.service.ProblemService;
+import com.takensoft.ai_lms.lms.problem.vo.ProblemDetailVO;
+import com.takensoft.ai_lms.lms.problem.vo.ProblemVO;
+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;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author 권지수
+ * @since 2024.07.25
+ *
+ * 문제 Controller 클래스
+ */
+
+@RestController
+@RequiredArgsConstructor
+@Slf4j
+@RequestMapping(value = "/problem")
+public class ProblemController {
+
+    private final ProblemService problemService;
+
+    /**
+     * @author 권지수
+     * @since 2024.07.25
+     *
+     * 문제 정보 조회
+     */
+    @PostMapping(path = "/problemInfo.json")
+    public ResponseEntity<?> problemInfo(@RequestBody ProblemVO problemVO) throws Exception {
+        HashMap<String, Object> result = new HashMap<>();
+
+        result.put("problem", problemService.problemInfo(problemVO));
+        result.put("problemDetail", problemService.problemDetailList(problemVO));
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 입력
+     */
+    @PostMapping(path = "/insertProblem.json")
+    public ResponseEntity<?> insertProblem(@RequestBody ProblemVO problemVO) throws Exception {
+        int result = problemService.insertProblem(problemVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 입력
+     */
+//    @PostMapping(path = "/insertProblemDetail.json")
+//    public ResponseEntity<?> insertProblemDetail(@RequestBody ProblemDetailVO problemDetailVO) throws Exception {
+//        int result = problemService.insertProblemDetail(problemDetailVO);
+//
+//        return new ResponseEntity<>(result, HttpStatus.OK);
+//    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 입력 (리스트)
+     */
+    @PostMapping(path = "/insertProblemDetail.json")
+    public ResponseEntity<?> insertProblemDetail(@RequestBody List<ProblemDetailVO> problemDetailVOList) throws Exception {
+        int result = 0;
+
+        for(ProblemDetailVO problemDetailVO: problemDetailVOList) {
+            problemService.insertProblemDetail(problemDetailVO);
+            result++;
+        }
+
+        //String result =
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 수정
+     */
+    @PostMapping(path = "/updateProblem.json")
+    public ResponseEntity<?> updateProblem(@RequestBody ProblemVO problemVO) throws Exception {
+        int result = problemService.updateProblem(problemVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 상세 정보 수정 (리스트)
+     */
+    @PostMapping(path = "/updateProblemDetail.json")
+    public ResponseEntity<?> updateProblemDetail(@RequestBody List<ProblemDetailVO> problemDetailVOList) throws Exception {
+        int result = 0;
+
+        for(ProblemDetailVO problemDetailVO: problemDetailVOList) {
+            problemService.updateProblemDetail(problemDetailVO);
+            result++;
+        }
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+
+    /**
+     * @author 권지수
+     * @since 2024.07.26
+     *
+     * 문제 정보 삭제
+     */
+    @PostMapping(path = "/deleteProblem.json")
+    public ResponseEntity<?> deleteProblem(@RequestBody ProblemVO problemVO) throws Exception {
+        int result = problemService.deleteProblem(problemVO);
+
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+}
 
src/main/resources/mybatis/mapper/lms/evaluation-SQL.xml (added)
+++ src/main/resources/mybatis/mapper/lms/evaluation-SQL.xml
@@ -0,0 +1,7 @@
+<?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.evaluation.dao.EvaluationDAO">
+
+
+
+</mapper>(파일 끝에 줄바꿈 문자 없음)
 
src/main/resources/mybatis/mapper/lms/problem-SQL.xml (added)
+++ src/main/resources/mybatis/mapper/lms/problem-SQL.xml
@@ -0,0 +1,131 @@
+<?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.dao.ProblemDAO">
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.25
+        내   용 : 문제 정보 read
+    -->
+    <select id="problemInfo" parameterType="ProblemVO" resultType="ProblemVO">
+        SELECT
+            prblm_id,
+            prblm_expln,
+            prblm_scr,
+            prblm_hint,
+            prblm_cmmt,
+            file_mng_id,
+            prblm_type_id,
+            prblm_ctgry_id
+        FROM problem
+        WHERE prblm_id = #{prblmId}
+    </select>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.25
+        내   용 : 문제 선지 리스트
+    -->
+    <select id="problemDetailList" parameterType="ProblemDetailVO" resultType="ProblemDetailVO">
+        SELECT
+            prblm_dtl_id,
+            prblm_id,
+            prblm_dtl_expln,
+            prblm_yn,
+            file_mng_id
+        FROM problem_detail
+        WHERE prblm_id = #{prblmId}
+    </select>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.26
+        내   용 : 문제 정보 insert
+    -->
+    <insert id="insertProblem" parameterType="ProblemVO">
+        INSERT INTO problem (
+            prblm_id,
+            prblm_expln,
+            prblm_scr,
+            prblm_hint,
+            prblm_cmmt,
+            file_mng_id,
+            prblm_type_id,
+            prblm_ctgry_id
+        ) VALUES (
+            #{prblmId},
+            #{prblmExpln},
+            #{prblmScr},
+            #{prblmHint},
+            #{prblmCmmt},
+            #{fileMngId},
+            #{prblmTypeId},
+            #{prblmCtgryId}
+        )
+    </insert>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.26
+        내   용 : 문제 상세 정보 insert
+    -->
+    <insert id="insertProblemDetail" parameterType="ProblemDetailVO">
+        INSERT INTO problem_detail (
+            prblm_dtl_id,
+            prblm_id,
+            prblm_dtl_expln,
+            prblm_yn,
+            file_mng_id
+        ) VALUES (
+            #{prblmDtlId},
+            #{prblmId},
+            #{prblmDtlExpln},
+            #{prblmYn},
+            #{fileMngId}
+        )
+    </insert>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.26
+        내   용 : 문제 정보 update
+    -->
+    <update id="updateProblem" parameterType="ProblemVO">
+        UPDATE problem
+        SET
+            prblm_expln = #{prblmExpln},
+            prblm_scr = #{prblmScr},
+            prblm_hint = #{prblmHint},
+            prblm_cmmt = #{prblmCmmt},
+            file_mng_id = #{fileMngId},
+            prblm_type_id = #{prblmTypeId},
+            prblm_ctgry_id = #{prblmCtgryId}
+        WHERE prblm_id = #{prblmId}
+    </update>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.26
+        내   용 : 문제 상세 정보 update
+    -->
+    <update id="updateProblemDetail" parameterType="ProblemDetailVO">
+        UPDATE problem_detail
+        SET
+            prblm_dtl_expln = #{prblmDtlExpln},
+            prblm_yn = #{prblmYn},
+            file_mng_id = #{fileMngId}
+        WHERE prblm_dtl_id = #{prblmDtlId}
+    </update>
+
+    <!--
+        작 성 자 : 권지수
+        작 성 일 : 2024.07.26
+        내   용 : 문제 정보 delete
+    -->
+    <delete id="deleteProblem" parameterType="problemVO">
+        DELETE FROM problem
+        WHERE prblm_id = #{prblmId}
+    </delete>
+
+
+</mapper>(파일 끝에 줄바꿈 문자 없음)
Add a comment
List