guntaek
07-29
240729 김건택 단원, 사진첩 CRUD
@b6b81d99e89c5949678c384bba4eee84328a4a5b
--- 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,8 @@ |
64 | 64 |
.requestMatchers("/test/**").permitAll() |
65 | 65 |
.requestMatchers("/studentInfo/**").permitAll() // 학생 정보 진입 허용(민수) |
66 | 66 |
.requestMatchers("/board/**").permitAll() // 게시판 정보 진입 허용 |
67 |
+ .requestMatchers("/unit/**").permitAll() |
|
68 |
+ .requestMatchers("/photo/**").permitAll() |
|
67 | 69 |
.anyRequest().authenticated()); // 나머지 경로는 인증 필요 |
68 | 70 |
|
69 | 71 |
// jwt 필터 처리 적용 |
+++ src/main/java/com/takensoft/ai_lms/lms/photo/dao/PhotoDAO.java
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.takensoft.ai_lms.lms.photo.dao; | |
2 | + | |
3 | +import com.takensoft.ai_lms.lms.photo.vo.PhotoVO; | |
4 | +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +@Mapper("photoDAO") | |
9 | +public interface PhotoDAO { | |
10 | + List<PhotoVO> photoList () throws Exception; | |
11 | + | |
12 | + int insertPhoto(PhotoVO photoVO) throws Exception; | |
13 | + | |
14 | + int updatePhoto(PhotoVO photoVO) throws Exception; | |
15 | + | |
16 | + int deletePhoto(PhotoVO photoVO) throws Exception; | |
17 | + | |
18 | + List<PhotoVO> photoDetail (PhotoVO photoVO) throws Exception; | |
19 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photo/service/Impl/PhotoServiceImpl.java
... | ... | @@ -0,0 +1,51 @@ |
1 | +package com.takensoft.ai_lms.lms.photo.service.Impl; | |
2 | + | |
3 | +import com.takensoft.ai_lms.common.idgen.service.IdgenService; | |
4 | +import com.takensoft.ai_lms.lms.photo.dao.PhotoDAO; | |
5 | +import com.takensoft.ai_lms.lms.photo.service.PhotoService; | |
6 | +import com.takensoft.ai_lms.lms.photo.vo.PhotoVO; | |
7 | +import com.takensoft.ai_lms.lms.unit.service.UnitService; | |
8 | +import com.takensoft.ai_lms.lms.unit.vo.UnitVO; | |
9 | +import lombok.RequiredArgsConstructor; | |
10 | +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; | |
11 | +import org.springframework.stereotype.Service; | |
12 | + | |
13 | +import java.util.List; | |
14 | + | |
15 | +@Service("photoService") | |
16 | +@RequiredArgsConstructor | |
17 | +public class PhotoServiceImpl extends EgovAbstractServiceImpl implements PhotoService { | |
18 | + | |
19 | + private final PhotoDAO photoDAO; | |
20 | + private final IdgenService photoIdgn; | |
21 | + | |
22 | + @Override | |
23 | + public List<PhotoVO> photoList() throws Exception { | |
24 | + return photoDAO.photoList(); | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + public int insertphoto(PhotoVO photoVO) throws Exception { | |
29 | + String photoId = photoIdgn.getNextStringId(); | |
30 | + photoVO.setPhotoId(photoId); | |
31 | + int result = photoDAO.insertPhoto(photoVO); | |
32 | + return result; | |
33 | + } | |
34 | + | |
35 | + @Override | |
36 | + public int updatephoto(PhotoVO photoVO) throws Exception { | |
37 | + int result = photoDAO.updatePhoto(photoVO); | |
38 | + return result; | |
39 | + } | |
40 | + | |
41 | + @Override | |
42 | + public int deletephoto(PhotoVO photoVO) throws Exception { | |
43 | + int result = photoDAO.deletePhoto(photoVO); | |
44 | + return result; | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public List<PhotoVO> photoDetail(PhotoVO photoVO) throws Exception { | |
49 | + return photoDAO.photoDetail(photoVO); | |
50 | + } | |
51 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photo/service/PhotoService.java
... | ... | @@ -0,0 +1,18 @@ |
1 | +package com.takensoft.ai_lms.lms.photo.service; | |
2 | + | |
3 | +import com.takensoft.ai_lms.lms.photo.vo.PhotoVO; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +public interface PhotoService { | |
8 | + | |
9 | + List<PhotoVO> photoList () throws Exception; | |
10 | + | |
11 | + int insertphoto(PhotoVO photoVO) throws Exception; | |
12 | + | |
13 | + int updatephoto(PhotoVO photoVO) throws Exception; | |
14 | + | |
15 | + int deletephoto(PhotoVO photoVO) throws Exception; | |
16 | + | |
17 | + List<PhotoVO> photoDetail (PhotoVO photoVO) throws Exception; | |
18 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photo/vo/PhotoVO.java
... | ... | @@ -0,0 +1,29 @@ |
1 | +package com.takensoft.ai_lms.lms.photo.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Getter; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.Setter; | |
7 | + | |
8 | +@Getter | |
9 | +@Setter | |
10 | +@AllArgsConstructor | |
11 | +@NoArgsConstructor | |
12 | +public class PhotoVO { | |
13 | + | |
14 | + // 사진 아이디 | |
15 | + private String photoId; | |
16 | + //사진첩 아이디 | |
17 | + private String photoMngId; | |
18 | + // 등록 일자 | |
19 | + private String photoDate; | |
20 | + // 좋아요 데이터 | |
21 | + private int likeCount; | |
22 | + // 단원 아이디 | |
23 | + private String unitId; | |
24 | + //학생 아이디 | |
25 | + private String stdId; | |
26 | + // 파일 관리 아이디 | |
27 | + private String fileMngId; | |
28 | + | |
29 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photo/web/PhotoController.java
... | ... | @@ -0,0 +1,54 @@ |
1 | +package com.takensoft.ai_lms.lms.photo.web; | |
2 | + | |
3 | +import com.takensoft.ai_lms.lms.photo.service.PhotoService; | |
4 | +import com.takensoft.ai_lms.lms.photo.vo.PhotoVO; | |
5 | +import lombok.RequiredArgsConstructor; | |
6 | +import lombok.extern.slf4j.Slf4j; | |
7 | +import org.springframework.http.HttpStatus; | |
8 | +import org.springframework.http.ResponseEntity; | |
9 | +import org.springframework.web.bind.annotation.PostMapping; | |
10 | +import org.springframework.web.bind.annotation.RequestBody; | |
11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
12 | +import org.springframework.web.bind.annotation.RestController; | |
13 | + | |
14 | +import java.util.List; | |
15 | + | |
16 | +@RestController | |
17 | +@RequiredArgsConstructor | |
18 | +@Slf4j | |
19 | +@RequestMapping(value="/photo") | |
20 | +public class PhotoController { | |
21 | + | |
22 | + private final PhotoService photoService; | |
23 | + | |
24 | + | |
25 | + @PostMapping(path = "/photoList.json") | |
26 | + public ResponseEntity<?> unitList() throws Exception { | |
27 | + List<PhotoVO> result = photoService.photoList(); | |
28 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
29 | + } | |
30 | + | |
31 | + @PostMapping(path = "/insertPhoto.json") | |
32 | + public ResponseEntity<?> insertUnit(@RequestBody PhotoVO photoVO) throws Exception { | |
33 | + int result = photoService.insertphoto(photoVO); | |
34 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
35 | + } | |
36 | + | |
37 | + @PostMapping(path = "/updatePhoto.json") | |
38 | + public ResponseEntity<?> updateUnit(@RequestBody PhotoVO photoVO) throws Exception { | |
39 | + int result = photoService.updatephoto(photoVO); | |
40 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
41 | + } | |
42 | + | |
43 | + @PostMapping(path = "/deletePhoto.json") | |
44 | + public ResponseEntity<?> deleteUnit(@RequestBody PhotoVO photoVO) throws Exception { | |
45 | + int result = photoService.deletephoto(photoVO); | |
46 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
47 | + } | |
48 | + | |
49 | + @PostMapping(path = "/photoDetail.json") | |
50 | + public ResponseEntity<?> unitDetail(@RequestBody PhotoVO photoVO) throws Exception { | |
51 | + List<PhotoVO> result = photoService.photoDetail(photoVO); | |
52 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
53 | + } | |
54 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photoMng/dao/PhotoMngDAO.java
... | ... | @@ -0,0 +1,8 @@ |
1 | +package com.takensoft.ai_lms.lms.photoMng.dao; | |
2 | + | |
3 | +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; | |
4 | + | |
5 | +@Mapper("photoMngDAO") | |
6 | +public interface PhotoMngDAO { | |
7 | + | |
8 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photoMng/service/Impl/PhotoMngServiceImpl.java
... | ... | @@ -0,0 +1,4 @@ |
1 | +package com.takensoft.ai_lms.lms.photoMng.service.Impl; | |
2 | + | |
3 | +public class PhotoMngServiceImpl { | |
4 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photoMng/service/PhotoMngService.java
... | ... | @@ -0,0 +1,4 @@ |
1 | +package com.takensoft.ai_lms.lms.photoMng.service; | |
2 | + | |
3 | +public interface PhotoMngService { | |
4 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photoMng/vo/PhotoMngVO.java
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.takensoft.ai_lms.lms.photoMng.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Getter; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.Setter; | |
7 | + | |
8 | +@Getter | |
9 | +@Setter | |
10 | +@AllArgsConstructor | |
11 | +@NoArgsConstructor | |
12 | +public class PhotoMngVO { | |
13 | + | |
14 | + // 사진첩 아이디 | |
15 | + private String photoMngId; | |
16 | + | |
17 | + // 반 아이디 | |
18 | + private String sclsId; | |
19 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/photoMng/web/PhotoMngController.java
... | ... | @@ -0,0 +1,4 @@ |
1 | +package com.takensoft.ai_lms.lms.photoMng.web; | |
2 | + | |
3 | +public class PhotoMngController { | |
4 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/unit/dao/UnitDAO.java
... | ... | @@ -0,0 +1,24 @@ |
1 | +package com.takensoft.ai_lms.lms.unit.dao; | |
2 | + | |
3 | +import com.takensoft.ai_lms.lms.unit.vo.UnitVO; | |
4 | +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +@Mapper("unitDAO") | |
9 | +public interface UnitDAO { | |
10 | + // 단원 전체 조회 | |
11 | + List<UnitVO> unitList() throws Exception; | |
12 | + | |
13 | + // 단원 등록 | |
14 | + int insertUnit(UnitVO unitVO) throws Exception; | |
15 | + | |
16 | + // 단원 수정 | |
17 | + int updateUnit(UnitVO unitVO) throws Exception; | |
18 | + | |
19 | + // 단원 삭제 | |
20 | + int deleteUnit(UnitVO unitVO) throws Exception; | |
21 | + | |
22 | + // 단원 상세 | |
23 | + List<UnitVO> unitDetail(UnitVO unitVO) throws Exception; | |
24 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/unit/service/Impl/UnitServiceImpl.java
... | ... | @@ -0,0 +1,58 @@ |
1 | +package com.takensoft.ai_lms.lms.unit.service.Impl; | |
2 | + | |
3 | +import com.takensoft.ai_lms.common.idgen.service.IdgenService; | |
4 | +import com.takensoft.ai_lms.lms.unit.dao.UnitDAO; | |
5 | +import com.takensoft.ai_lms.lms.unit.service.UnitService; | |
6 | +import com.takensoft.ai_lms.lms.unit.vo.UnitVO; | |
7 | +import lombok.RequiredArgsConstructor; | |
8 | +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import java.util.HashMap; | |
12 | +import java.util.List; | |
13 | + | |
14 | +@Service("unitService") | |
15 | +@RequiredArgsConstructor | |
16 | +public class UnitServiceImpl extends EgovAbstractServiceImpl implements UnitService { | |
17 | + | |
18 | + private final UnitDAO unitDAO; | |
19 | + | |
20 | + private final IdgenService unitIdgn; | |
21 | + | |
22 | + // 단원 전체 조회 | |
23 | + @Override | |
24 | + public List<UnitVO> unitList() throws Exception { | |
25 | + return unitDAO.unitList(); | |
26 | + } | |
27 | + | |
28 | + // 단원 등록 | |
29 | + @Override | |
30 | + public int insertUnit(UnitVO unitVO) throws Exception { | |
31 | + String unitId = unitIdgn.getNextStringId(); | |
32 | + unitVO.setUnitId(unitId); | |
33 | + int result = unitDAO.insertUnit(unitVO); | |
34 | + return result; | |
35 | + } | |
36 | + | |
37 | + // 단원 수정 | |
38 | + @Override | |
39 | + public int updateUnit(UnitVO unitVO) throws Exception { | |
40 | + int result = unitDAO.updateUnit(unitVO); | |
41 | + return result; | |
42 | + } | |
43 | + | |
44 | + // 단원 삭제 | |
45 | + @Override | |
46 | + public int deleteUnit(UnitVO unitVO) throws Exception { | |
47 | + int result = unitDAO.deleteUnit(unitVO); | |
48 | + return result; | |
49 | + } | |
50 | + | |
51 | + // 단원 상세 | |
52 | + @Override | |
53 | + public List<UnitVO> unitDetail(UnitVO unitVO) throws Exception { | |
54 | + return unitDAO.unitDetail(unitVO); | |
55 | + } | |
56 | + | |
57 | + | |
58 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/unit/service/UnitService.java
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.takensoft.ai_lms.lms.unit.service; | |
2 | + | |
3 | +import com.takensoft.ai_lms.lms.unit.vo.UnitVO; | |
4 | + | |
5 | +import java.util.HashMap; | |
6 | +import java.util.List; | |
7 | + | |
8 | +public interface UnitService { | |
9 | + List<UnitVO> unitList () throws Exception; | |
10 | + | |
11 | + int insertUnit(UnitVO unitVO) throws Exception; | |
12 | + | |
13 | + int updateUnit(UnitVO unitVO) throws Exception; | |
14 | + | |
15 | + int deleteUnit(UnitVO unitVO) throws Exception; | |
16 | + | |
17 | + List<UnitVO> unitDetail (UnitVO unitVO) throws Exception; | |
18 | + | |
19 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/unit/vo/UnitVO.java
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.takensoft.ai_lms.lms.unit.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Getter; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.Setter; | |
7 | + | |
8 | +@Setter | |
9 | +@Getter | |
10 | +@NoArgsConstructor | |
11 | +@AllArgsConstructor | |
12 | +public class UnitVO { | |
13 | + // 단원 아이디 | |
14 | + private String unitId; | |
15 | + // 책 아이디 | |
16 | + private String bookId; | |
17 | + // 단원 이름 | |
18 | + private String unitName; | |
19 | +} |
+++ src/main/java/com/takensoft/ai_lms/lms/unit/web/UnitController.java
... | ... | @@ -0,0 +1,60 @@ |
1 | +package com.takensoft.ai_lms.lms.unit.web; | |
2 | + | |
3 | +import com.takensoft.ai_lms.lms.unit.service.UnitService; | |
4 | +import com.takensoft.ai_lms.lms.unit.vo.UnitVO; | |
5 | +import lombok.RequiredArgsConstructor; | |
6 | +import lombok.extern.slf4j.Slf4j; | |
7 | +import org.springframework.http.HttpStatus; | |
8 | +import org.springframework.http.ResponseEntity; | |
9 | +import org.springframework.web.bind.annotation.PostMapping; | |
10 | +import org.springframework.web.bind.annotation.RequestBody; | |
11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
12 | +import org.springframework.web.bind.annotation.RestController; | |
13 | + | |
14 | +import java.util.HashMap; | |
15 | +import java.util.List; | |
16 | + | |
17 | +@RestController | |
18 | +@RequiredArgsConstructor | |
19 | +@Slf4j | |
20 | +@RequestMapping(value="/unit") | |
21 | +public class UnitController { | |
22 | + | |
23 | + private final UnitService unitService; | |
24 | + | |
25 | + /** | |
26 | + * @author 박민혁 | |
27 | + * @since 2024.07.06 | |
28 | + * | |
29 | + * 테스트용 데이터 조회 | |
30 | + */ | |
31 | + @PostMapping(path = "/unitList.json") | |
32 | + public ResponseEntity<?> unitList() throws Exception { | |
33 | + List<UnitVO> result = unitService.unitList(); | |
34 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
35 | + } | |
36 | + | |
37 | + @PostMapping(path = "/insertUnit.json") | |
38 | + public ResponseEntity<?> insertUnit(@RequestBody UnitVO unitVO) throws Exception { | |
39 | + int result = unitService.insertUnit(unitVO); | |
40 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
41 | + } | |
42 | + | |
43 | + @PostMapping(path = "/updateUnit.json") | |
44 | + public ResponseEntity<?> updateUnit(@RequestBody UnitVO unitVO) throws Exception { | |
45 | + int result = unitService.updateUnit(unitVO); | |
46 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
47 | + } | |
48 | + | |
49 | + @PostMapping(path = "/deleteUnit.json") | |
50 | + public ResponseEntity<?> deleteUnit(@RequestBody UnitVO unitVO) throws Exception { | |
51 | + int result = unitService.deleteUnit(unitVO); | |
52 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
53 | + } | |
54 | + | |
55 | + @PostMapping(path = "/unitDetail.json") | |
56 | + public ResponseEntity<?> unitDetail(@RequestBody UnitVO unitVO) throws Exception { | |
57 | + List<UnitVO> result = unitService.unitDetail(unitVO); | |
58 | + return new ResponseEntity<>(result, HttpStatus.OK); | |
59 | + } | |
60 | +} |
--- src/main/resources/mybatis/mapper/lms/change.xml
... | ... | @@ -1,14 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | -<mapper namespace="com.takensoft.ai_lms.lms.test.dao.TestDAO"> | |
4 | - <!-- | |
5 | - 작 성 자 : 박민혁 | |
6 | - 작 성 일 : 2024.07.25 | |
7 | - 내 용 : 경로 생성을 위해 만들어 놓은 xml, | |
8 | - CRUD를 이용하는데 삭제하거나 수정해서 사용해주세요 | |
9 | - --> | |
10 | - <select id="testList" resultType="HashMap"> | |
11 | - SELECT test_data | |
12 | - FROM test_info | |
13 | - </select> | |
14 | -</mapper>(파일 끝에 줄바꿈 문자 없음) |
+++ src/main/resources/mybatis/mapper/lms/photo-SQL.xml
... | ... | @@ -0,0 +1,62 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="com.takensoft.ai_lms.lms.photo.dao.PhotoDAO"> | |
4 | + <!-- | |
5 | + 작 성 자 : 박민혁 | |
6 | + 작 성 일 : 2024.07.25 | |
7 | + 내 용 : 경로 생성을 위해 만들어 놓은 xml, | |
8 | + CRUD를 이용하는데 삭제하거나 수정해서 사용해주세요 | |
9 | + --> | |
10 | + | |
11 | + <resultMap id="photoMap" type="photoVO"> | |
12 | + <result property="photoId" column="photo_id"/> | |
13 | + <result property="photoMngId" column="photo_mng_id"/> | |
14 | + <result property="photoDate" column="photo_dt"/> | |
15 | + <result property="likeCount" column="like_data"/> | |
16 | + <result property="unitId" column="unit_id"/> | |
17 | + <result property="stdId" column="std_id"/> | |
18 | + <result property="fileMngId" column="file_mng_id"/> | |
19 | + </resultMap> | |
20 | + | |
21 | + <select id="photoList" resultType="com.takensoft.ai_lms.lms.photo.vo.PhotoVO"> | |
22 | + SELECT unit_id | |
23 | + , book_id | |
24 | + , unit_nm | |
25 | + FROM unit | |
26 | + </select> | |
27 | + | |
28 | + <insert id="insertphoto" parameterType="PhotoVO"> | |
29 | + INSERT INTO unit ( | |
30 | + unit_id | |
31 | + , book_id | |
32 | + , unit_nm | |
33 | + ) VALUES ( | |
34 | + #{unitId} | |
35 | + , #{bookId} | |
36 | + , #{unitName} | |
37 | + ) | |
38 | + </insert> | |
39 | + | |
40 | + <update id="updatephoto" parameterType="PhotoVO"> | |
41 | + UPDATE unit | |
42 | + SET unit_id = #{unitId} | |
43 | + , book_id = #{bookId} | |
44 | + , unit_nm = #{unitName} | |
45 | + WHERE unit_id = #{unitId} | |
46 | + </update> | |
47 | + | |
48 | + <delete id="deletephoto" parameterType="PhotoVO"> | |
49 | + DELETE | |
50 | + FROM unit | |
51 | + WHERE unit_id = #{unitId} | |
52 | + </delete> | |
53 | + | |
54 | + <select id="photoDetail" parameterType="PhotoVO" resultType="com.takensoft.ai_lms.lms.photo.vo.PhotoVO"> | |
55 | + SELECT unit_id | |
56 | + , book_id | |
57 | + , unit_nm | |
58 | + WHERE unit_id = #{unitId} | |
59 | + FROM unit | |
60 | + </select> | |
61 | + | |
62 | +</mapper>(파일 끝에 줄바꿈 문자 없음) |
+++ src/main/resources/mybatis/mapper/lms/unit-SQL.xml
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="com.takensoft.ai_lms.lms.unit.dao.UnitDAO"> | |
4 | + <!-- | |
5 | + 작 성 자 : 박민혁 | |
6 | + 작 성 일 : 2024.07.25 | |
7 | + 내 용 : 경로 생성을 위해 만들어 놓은 xml, | |
8 | + CRUD를 이용하는데 삭제하거나 수정해서 사용해주세요 | |
9 | + --> | |
10 | + | |
11 | + <resultMap id="unitMap" type="UnitVO"> | |
12 | + <result property="unitId" column="unit_id"/> | |
13 | + <result property="bookId" column="book_id"/> | |
14 | + <result property="unitName" column="unit_nm"/> | |
15 | + </resultMap> | |
16 | + | |
17 | + <select id="unitList" resultType="com.takensoft.ai_lms.lms.unit.vo.UnitVO"> | |
18 | + SELECT unit_id | |
19 | + , book_id | |
20 | + , unit_nm | |
21 | + FROM unit | |
22 | + </select> | |
23 | + | |
24 | + <insert id="insertUnit" parameterType="UnitVO"> | |
25 | + INSERT INTO unit ( | |
26 | + unit_id | |
27 | + , book_id | |
28 | + , unit_nm | |
29 | + ) VALUES ( | |
30 | + #{unitId} | |
31 | + , #{bookId} | |
32 | + , #{unitName} | |
33 | + ) | |
34 | + </insert> | |
35 | + | |
36 | + <update id="updateUnit" parameterType="UnitVO"> | |
37 | + UPDATE unit | |
38 | + SET unit_id = #{unitId} | |
39 | + , book_id = #{bookId} | |
40 | + , unit_nm = #{unitName} | |
41 | + WHERE unit_id = #{unitId} | |
42 | + </update> | |
43 | + | |
44 | + <delete id="deleteUnit" parameterType="UnitVO"> | |
45 | + DELETE | |
46 | + FROM unit | |
47 | + WHERE unit_id = #{unitId} | |
48 | + </delete> | |
49 | + | |
50 | + <select id="unitDetail" parameterType="UnitVO" resultType="com.takensoft.ai_lms.lms.unit.vo.UnitVO"> | |
51 | + SELECT unit_id | |
52 | + , book_id | |
53 | + , unit_nm | |
54 | + WHERE unit_id = #{unitId} | |
55 | + FROM unit | |
56 | + </select> | |
57 | + | |
58 | +</mapper>(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?