홍아랑 홍아랑 07-26
240726 홍아랑 파일 정보 조회 관련 코드 추가
@a840226d43a0ae6956a05b10f72d7781ed6b720a
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("/file/**").permitAll() // 게시판 정보 진입 허용
                 .anyRequest().authenticated()); // 나머지 경로는 인증 필요
 
         // jwt 필터 처리 적용
src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
--- src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
@@ -3,6 +3,7 @@
 
 import com.takensoft.ai_lms.lms.board.service.BoardService;
 import com.takensoft.ai_lms.lms.board.vo.BoardVO;
+import com.takensoft.ai_lms.lms.file.service.FileService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.HttpStatus;
 
src/main/java/com/takensoft/ai_lms/lms/file/dao/FileDAO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/file/dao/FileDAO.java
@@ -0,0 +1,22 @@
+package com.takensoft.ai_lms.lms.file.dao;
+
+
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author  : 홍아랑
+ * since   : 2024.07.26
+ *
+ * 파일 관련 Mapper
+ */
+
+@Mapper("FileDAO")
+
+public interface FileDAO {
+
+    // 파일 정보 조회
+    List<HashMap<String, Object>> findByFileId(HashMap<String, Object> params) throws Exception;
+}
 
src/main/java/com/takensoft/ai_lms/lms/file/service/FileService.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/file/service/FileService.java
@@ -0,0 +1,16 @@
+package com.takensoft.ai_lms.lms.file.service;
+
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author  : 홍아랑
+ * since   : 2024.07.26
+ *
+ * 파일 관련 Service
+ */
+public interface FileService {
+    // 파일 정보 조회
+    List<HashMap<String, Object>> findByFileId(HashMap<String, Object> params) throws Exception;
+}
 
src/main/java/com/takensoft/ai_lms/lms/file/service/impl/FileServiceImpl.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/file/service/impl/FileServiceImpl.java
@@ -0,0 +1,22 @@
+package com.takensoft.ai_lms.lms.file.service.impl;
+
+import com.takensoft.ai_lms.lms.file.dao.FileDAO;
+import com.takensoft.ai_lms.lms.file.service.FileService;
+import lombok.RequiredArgsConstructor;
+import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Service("FileService")
+@RequiredArgsConstructor
+public class FileServiceImpl extends EgovAbstractServiceImpl implements FileService {
+    private final FileDAO fileDAO;
+
+    // 파일 정보 조회
+    // @Override
+    public List<HashMap<String, Object>> findByFileId(HashMap<String, Object> params) throws Exception {
+        return fileDAO.findByFileId(params);
+    }
+}
 
src/main/java/com/takensoft/ai_lms/lms/file/vo/FileVO.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/file/vo/FileVO.java
@@ -0,0 +1,46 @@
+package com.takensoft.ai_lms.lms.file.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+/**
+ * @author  : 홍아랑
+ * since   : 2024.07.26
+ *
+ * 파일 관련 VO
+ */
+
+
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class FileVO {
+
+    // 파일 아이디
+    private String fileId;
+    // 파일 관리 아이디
+    private String fileMngId;
+    // 파일명
+    private String fileNm;
+    // 마스크명
+    private String fileEncptNm;
+    // 절대 경로
+    private String fileApath;
+    // 상대 경로
+    private String fileRpath;
+    // 확장자
+    private String fileExtn;
+    // 파일 크기
+    private String fileSz;
+    // 파일 타입
+    private String fileClsf;
+    // 등록자
+    private String reg;
+    // 등록 일자
+    private String regDt;
+
+}
 
src/main/java/com/takensoft/ai_lms/lms/file/web/FileController.java (added)
+++ src/main/java/com/takensoft/ai_lms/lms/file/web/FileController.java
@@ -0,0 +1,39 @@
+package com.takensoft.ai_lms.lms.file.web;
+
+import com.takensoft.ai_lms.lms.file.service.FileService;
+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;
+
+import java.util.HashMap;
+
+/**
+ * @author  : 홍아랑
+ * since   : 2024.07.26
+ * 파일 관련 Controller
+ */
+@RestController
+//@Slf4j
+@RequiredArgsConstructor
+@RequestMapping(value = "/file")
+public class FileController {
+    private final FileService fileService;
+
+    /**
+     * @author 홍아랑
+     * @since 2024.07.26
+     *
+     * 파일 정보 조회
+     */
+    @PostMapping("/find.json")
+    public ResponseEntity<?> findByFileId(@RequestBody HashMap<String, Object> params) throws Exception {
+        HashMap<String, Object> result = new HashMap<>();
+
+        result.put("list", fileService.findByFileId(params));
+        return new ResponseEntity<>(result, HttpStatus.OK);
+    }
+}
 
src/main/resources/mybatis/mapper/lms/files-SQL.xml (added)
+++ src/main/resources/mybatis/mapper/lms/files-SQL.xml
@@ -0,0 +1,45 @@
+<?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.file.dao.FileDAO">
+    <!--
+        작 성 자 : 박민혁
+        작 성 일 : 2024.07.25
+        내   용 : 경로 생성을 위해 만들어 놓은 xml,
+        CRUD를 이용하는데 삭제하거나 수정해서 사용해주세요
+    -->
+    <resultMap id="FileMap" type="FileVO">
+        <result property="fileId" column="file_id"/>
+        <result property="fileMngId" column="file_mng_id"/>
+        <result property="fileNm" column="file_nm"/>
+        <result property="fileEncptNm" column="file_encpt_nm"/>
+        <result property="fileApath" column="file_apath"/>
+        <result property="fileRpath" column="file_rpath"/>
+        <result property="fileExtn" column="file_extn"/>
+        <result property="fileSz" column="file_sz"/>
+        <result property="fileClsf" column="file_clsf"/>
+        <result property="reg" column="reg"/>
+        <result property="regDt" column="reg_dt"/>
+    </resultMap>
+
+    <!--
+            작성자 : 홍아랑
+            작성일 : 2024.07.26
+            내 용 : 파일 정보 조회
+        -->
+    <select id="findByFileId"  parameterType="FileVO" resultMap="FileMap">
+        SELECT
+            file_id,
+            file_mng_id,
+            file_nm,
+            file_encpt_nm,
+            file_apath,
+            file_rpath,
+            file_extn,
+            file_sz,
+            file_clsf,
+            reg,
+            reg_dt
+        FROM cmmn_file
+        WHERE file_mng_id = #{file_mng_id}
+    </select>
+</mapper>(파일 끝에 줄바꿈 문자 없음)
Add a comment
List