woals 07-31
240731 권민수 UserClass crud 추가(미완성)
@8515607ecea8f3eb19a326ff74d10ffcf359f12d
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
@@ -84,6 +84,7 @@
                 .requestMatchers("/word/**").permitAll() // 단어 정보 진입 허용
                 .requestMatchers("/survey/**").permitAll() // 설문 조사 진입 허용
                 .requestMatchers("/api/**").permitAll() // Google Cloud api 진입 허용
+                .requestMatchers("/userclass/**").permitAll() // 반별 학생 맵핑 진입 허용
                 .anyRequest().authenticated()); // 나머지 경로는 인증 필요
 
         // jwt 필터 처리 적용
 
src/main/java/com/takensoft/ai_lms/lms/user_class/dao/UserClassDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_class/dao/UserClassDAO.java
@@ -0,0 +1,33 @@
+package com.takensoft.ai_lms.lms.user_class.dao;
+
+import com.takensoft.ai_lms.lms.user_class.vo.UserClassVO;
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
+
+import java.util.List;
+
+/**
+ * @author
+ * @since 2024.07.31
+ *
+ * 반별 학생 맵핑 DAO 인터페이스
+ */
+
+@Mapper("userClassDAO")
+public interface UserClassDAO {
+
+    // 유저 클래스 리스트 조회
+    List<UserClassVO> getUserClasses();
+
+    // 특정 유저 클래스 조회
+    UserClassVO getUserClassById(UserClassVO userClass);
+
+    // 유저 클래스 생성
+    int insertUserClass(UserClassVO userClass);
+
+    // 유저 클래스 수정
+    int updateUserClass(UserClassVO userClass);
+
+    // 유저 클래스 삭제
+    int deleteUserClass(UserClassVO userClass);
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_class/service/Impl/UserClassServiceImpl.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_class/service/Impl/UserClassServiceImpl.java
@@ -0,0 +1,53 @@
+package com.takensoft.ai_lms.lms.user_class.service.Impl;
+
+import com.takensoft.ai_lms.common.idgen.service.IdgenService;
+import com.takensoft.ai_lms.lms.user_class.dao.UserClassDAO;
+import com.takensoft.ai_lms.lms.user_class.service.UserClassService;
+import com.takensoft.ai_lms.lms.user_class.vo.UserClassVO;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author
+ * @since 2024.07.31
+ *
+ * 반별 학생 맵핑 Service 구현 클래스
+ */
+@Service
+@RequiredArgsConstructor
+public class UserClassServiceImpl implements UserClassService {
+
+    private final UserClassDAO userClassDAO;
+
+    private final IdgenService userClassIdgn;
+
+    @Override
+    public List<UserClassVO> getUserClasses() {
+        return userClassDAO.getUserClasses();
+    }
+
+    @Override
+    public UserClassVO getUserClassById(UserClassVO userClass) {
+        return userClassDAO.getUserClassById(userClass);
+    }
+
+    @Override
+    public void insertUserClass(UserClassVO userClass) {
+        String stdId = userClassIdgn.getNextStringId();
+        userClass.setStdId(stdId);
+        userClassDAO.insertUserClass(userClass);
+    }
+
+    @Override
+    public void updateUserClass(UserClassVO userClass) {
+        userClassDAO.updateUserClass(userClass);
+    }
+
+    @Override
+    public void deleteUserClass(UserClassVO userClass) {
+        userClassDAO.deleteUserClass(userClass);
+    }
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_class/service/UserClassService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_class/service/UserClassService.java
@@ -0,0 +1,31 @@
+package com.takensoft.ai_lms.lms.user_class.service;
+
+import com.takensoft.ai_lms.lms.user_class.vo.UserClassVO;
+
+import java.util.List;
+
+/**
+ * @author
+ * @since 2024.07.31
+ *
+ * 반별 학생 맵핑 Service 인터페이스
+ */
+
+public interface UserClassService {
+
+    // 유저 클래스 리스트 조회
+    List<UserClassVO> getUserClasses();
+
+    // 특정 유저 클래스 조회
+    UserClassVO getUserClassById(UserClassVO userClass);
+
+    // 유저 클래스 생성
+    void insertUserClass(UserClassVO userClass);
+
+    // 유저 클래스 수정
+    void updateUserClass(UserClassVO userClass);
+
+    // 유저 클래스 삭제
+    void deleteUserClass(UserClassVO userClass);
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_class/vo/UserClassVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_class/vo/UserClassVO.java
@@ -0,0 +1,23 @@
+package com.takensoft.ai_lms.lms.user_class.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author 권민수
+ * @since 2024.07.31
+ *
+ * 반별 학생 맵핑 VO 클래스
+ */
+
+@Getter
+@Setter
+public class UserClassVO {
+
+    private String stdId;
+    private String userId;
+    private String sclsId;
+    private String stnQna;
+    private String fileMngId;
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/user_class/web/UserClassController.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/user_class/web/UserClassController.java
@@ -0,0 +1,62 @@
+package com.takensoft.ai_lms.lms.user_class.web;
+
+import com.takensoft.ai_lms.lms.user_class.service.UserClassService;
+import com.takensoft.ai_lms.lms.user_class.vo.UserClassVO;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author
+ * @since 2024.07.31
+ *
+ * 반별 학생 맵핑 컨트롤러
+ */
+
+@RestController
+@RequiredArgsConstructor
+@Slf4j
+@RequestMapping("/userclass")
+public class UserClassController {
+
+    private final UserClassService userClassService;
+
+    // 유저 클래스 리스트 조회
+    @PostMapping("/findAll.json")
+    public List<UserClassVO> getUserClasses() {
+        return userClassService.getUserClasses();
+    }
+
+    // 특정 유저 클래스 조회
+    @PostMapping("/find.json")
+    public UserClassVO getUserClassById(@RequestBody UserClassVO userClass) {
+        return userClassService.getUserClassById(userClass);
+    }
+
+    // 유저 클래스 생성
+    @PostMapping("/insert.json")
+    public void insertUserClass(@RequestBody Map<String, String> req) {
+        UserClassVO userClass = new UserClassVO();
+        userClass.setUserId(req.get("userId"));
+        userClass.setSclsId(req.get("sclsId"));
+        userClass.setStnQna(req.get("stnQna"));
+        userClass.setFileMngId(req.get("fileMngId"));
+        userClassService.insertUserClass(userClass);
+    }
+
+    // 유저 클래스 수정
+    @PostMapping("/update.json")
+    public void updateUserClass(@RequestBody UserClassVO userClass) {
+        userClassService.updateUserClass(userClass);
+    }
+
+    // 유저 클래스 삭제
+    @PostMapping("/delete.json")
+    public void deleteUserClass(@RequestBody UserClassVO userClass) {
+        userClassService.deleteUserClass(userClass);
+    }
+
+}
src/main/java/com/takensoft/ai_lms/lms/word_book/web/WordBookController.java
--- src/main/java/com/takensoft/ai_lms/lms/word_book/web/WordBookController.java
+++ src/main/java/com/takensoft/ai_lms/lms/word_book/web/WordBookController.java
@@ -80,5 +80,3 @@
     }
 
 }
-
-// 추가 사항: 책에 소속된 단어장 리스트 가져오기(보류)
 
src/main/resources/mybatis/mapper/lms/user_class-SQL.xml (added)
+++ src/main/resources/mybatis/mapper/lms/user_class-SQL.xml
@@ -0,0 +1,58 @@
+<?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_class.dao.UserClassDAO">
+
+    <!--
+        작 성 자 : 권민수
+        작 성 일 : 2024.07.31
+        내   용 : 반별 학생 매핑 테이블 sql 매핑 xml 문서
+    -->
+
+    <resultMap id="UserClassResultMap" type="UserClassVO">
+        <id property="stdId" column="std_id"/>
+        <id property="userId" column="user_id"/>
+        <id property="sclsId" column="scls_id"/>
+        <result property="stnQna" column="stn_qna"/>
+        <result property="fileMngId" column="file_mng_id"/>
+    </resultMap>
+
+    <select id="getUserClasses" resultMap="UserClassResultMap">
+        SELECT * FROM ai_lms.user_class
+    </select>
+
+    <select id="getUserClassById" parameterType="UserClassVO" resultMap="UserClassResultMap">
+        SELECT * FROM ai_lms.user_class
+        WHERE std_id = #{stdId}
+    </select>
+
+    <insert id="insertUserClass" parameterType="UserClassVO">
+        INSERT INTO
+            ai_lms.user_class (std_id,
+                               user_id,
+                               scls_id,
+                               stn_qna,
+                               file_mng_id)
+        VALUES (#{stdId},
+                #{userId},
+                #{sclsId},
+                #{stnQna},
+                #{fileMngId})
+    </insert>
+
+    <update id="updateUserClass" parameterType="UserClassVO">
+        UPDATE ai_lms.user_class
+        SET stn_qna = #{stnQna},
+            file_mng_id = #{fileMngId}
+        WHERE std_id = #{stdId}
+          AND user_id = #{userId}
+          AND scls_id = #{sclsId}
+    </update>
+
+    <delete id="deleteUserClass" parameterType="UserClassVO">
+        DELETE FROM ai_lms.user_class
+        WHERE std_id = #{stdId}
+          AND user_id = #{userId}
+          AND scls_id = #{sclsId}
+    </delete>
+
+</mapper>(파일 끝에 줄바꿈 문자 없음)
src/main/resources/mybatis/mapper/lms/word_book-SQL.xml
--- src/main/resources/mybatis/mapper/lms/word_book-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/word_book-SQL.xml
@@ -28,11 +28,11 @@
 
     <select id="getWordBooksByBookId" resultMap="WordBookResultMap">  <!-- 수정됨 -->
         SELECT
-        wd_book_id,
-        wd_book_type_id,
-        text_id,
-        user_id,
-        book_id
+            wd_book_id,
+            wd_book_type_id,
+            text_id,
+            user_id,
+            book_id
         FROM wordbook
         WHERE book_id = #{bookId}
     </select>
Add a comment
List