PsHooN7979
07-30
240730 박세훈 설문 조사 상세 정보 등록 및 조회 추가
@3d1415b8f8d8ab5d805f5f89a53e77fb35dd459b
--- src/main/java/com/takensoft/ai_lms/common/idgen/context/ContextIdgen.java
+++ src/main/java/com/takensoft/ai_lms/common/idgen/context/ContextIdgen.java
... | ... | @@ -228,5 +228,16 @@ |
228 | 228 |
return idgenServiceImpl; |
229 | 229 |
} |
230 | 230 |
|
231 |
+ // 설문 조사 상세 정보 |
|
232 |
+ @Bean(name = "surveyDetailIdgn") |
|
233 |
+ public IdgenService surveyDetail() { |
|
234 |
+ IdgenService idgenServiceImpl = new IdgenService(); |
|
235 |
+ idgenServiceImpl.setCipers(15); |
|
236 |
+ idgenServiceImpl.setFillChar('0'); |
|
237 |
+ idgenServiceImpl.setPrefix("SURVEY_DETAIL_"); |
|
238 |
+ idgenServiceImpl.setTblNm("SURVEY_DETAIL_ID"); |
|
239 |
+ return idgenServiceImpl; |
|
240 |
+ } |
|
241 |
+ |
|
231 | 242 |
|
232 | 243 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/dao/SurveyDAO.java
... | ... | @@ -1,6 +1,7 @@ |
1 | 1 |
package com.takensoft.ai_lms.lms.survey.dao; |
2 | 2 |
|
3 | 3 |
|
4 |
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO; |
|
4 | 5 |
import com.takensoft.ai_lms.lms.survey.vo.SurveyVO; |
5 | 6 |
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; |
6 | 7 |
|
... | ... | @@ -27,4 +28,10 @@ |
27 | 28 |
|
28 | 29 |
// 설문 조사 삭제 |
29 | 30 |
int deleteSurvey(String srvyId) throws Exception; |
31 |
+ |
|
32 |
+ // 설문 조사 상세 정보 |
|
33 |
+ int insertSurveyDetail(SurveyDetailVO surveyDetailVO) throws Exception; |
|
34 |
+ |
|
35 |
+ // 설문 조사 상세 정보 조회 |
|
36 |
+ List<SurveyDetailVO> surveyDetailList(SurveyDetailVO surveyDetailVO) throws Exception; |
|
30 | 37 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/survey/service/Impl/SurveyServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/service/Impl/SurveyServiceImpl.java
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 |
import com.takensoft.ai_lms.common.idgen.service.IdgenService; |
5 | 5 |
import com.takensoft.ai_lms.lms.survey.dao.SurveyDAO; |
6 | 6 |
import com.takensoft.ai_lms.lms.survey.service.SurveyService; |
7 |
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO; |
|
7 | 8 |
import com.takensoft.ai_lms.lms.survey.vo.SurveyVO; |
8 | 9 |
import lombok.RequiredArgsConstructor; |
9 | 10 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
... | ... | @@ -25,6 +26,8 @@ |
25 | 26 |
private final SurveyDAO surveyDAO; |
26 | 27 |
|
27 | 28 |
private final IdgenService surveyIdgn; |
29 |
+ |
|
30 |
+ private final IdgenService surveyDetailIdgn; |
|
28 | 31 |
|
29 | 32 |
// 설문 조사 등록 |
30 | 33 |
@Override |
... | ... | @@ -51,4 +54,18 @@ |
51 | 54 |
public int deleteSurvey(String srvyId) throws Exception { |
52 | 55 |
return surveyDAO.deleteSurvey(srvyId); |
53 | 56 |
} |
57 |
+ |
|
58 |
+ // 설문 조사 상세 정보 |
|
59 |
+ @Override |
|
60 |
+ public int insertSurveyDetail(SurveyDetailVO surveyDetailVO) throws Exception { |
|
61 |
+ String srvyDtlId = surveyDetailIdgn.getNextStringId(); |
|
62 |
+ surveyDetailVO.setSrvyDtlId(srvyDtlId); |
|
63 |
+ return surveyDAO.insertSurveyDetail(surveyDetailVO); |
|
64 |
+ } |
|
65 |
+ |
|
66 |
+ // 설문 조사 상세 정보 조회 |
|
67 |
+ @Override |
|
68 |
+ public List<SurveyDetailVO> surveyDetailList(SurveyDetailVO surveyDetailVO) throws Exception { |
|
69 |
+ return surveyDAO.surveyDetailList(surveyDetailVO); |
|
70 |
+ } |
|
54 | 71 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/service/SurveyService.java
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
package com.takensoft.ai_lms.lms.survey.service; |
2 | 2 |
|
3 |
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO; |
|
3 | 4 |
import com.takensoft.ai_lms.lms.survey.vo.SurveyVO; |
4 | 5 |
|
5 | 6 |
import java.util.List; |
... | ... | @@ -25,4 +26,10 @@ |
25 | 26 |
|
26 | 27 |
// 설문 조사 삭제 |
27 | 28 |
int deleteSurvey(String srvyId) throws Exception; |
29 |
+ |
|
30 |
+ // 설문 조사 상세 정보 |
|
31 |
+ int insertSurveyDetail(SurveyDetailVO surveyDetailVO) throws Exception; |
|
32 |
+ |
|
33 |
+ // 설문 조사 상세 정보 조회 |
|
34 |
+ List<SurveyDetailVO> surveyDetailList(SurveyDetailVO surveyDetailVO) throws Exception; |
|
28 | 35 |
} |
+++ src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyDetailVO.java
... | ... | @@ -0,0 +1,29 @@ |
1 | +package com.takensoft.ai_lms.lms.survey.vo; | |
2 | + | |
3 | + | |
4 | +import lombok.AllArgsConstructor; | |
5 | +import lombok.Getter; | |
6 | +import lombok.NoArgsConstructor; | |
7 | +import lombok.Setter; | |
8 | + | |
9 | +/** | |
10 | + * @author : 박세훈 | |
11 | + * since : 2024.07.30 | |
12 | + * | |
13 | + * 설문 조사 상세 정보 관련 VO | |
14 | + */ | |
15 | +@Getter | |
16 | +@Setter | |
17 | +@AllArgsConstructor | |
18 | +@NoArgsConstructor | |
19 | +public class SurveyDetailVO { | |
20 | + | |
21 | + // 설문 조사 상세 아이디 | |
22 | + private String srvyDtlId; | |
23 | + | |
24 | + // 설문 상세 항목 | |
25 | + private String srvyDtlCnt; | |
26 | + | |
27 | + // 설문 조사 아이디 | |
28 | + private String srvyId; | |
29 | +} |
--- src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/vo/SurveyVO.java
... | ... | @@ -6,6 +6,8 @@ |
6 | 6 |
import lombok.NoArgsConstructor; |
7 | 7 |
import lombok.Setter; |
8 | 8 |
|
9 |
+import java.util.List; |
|
10 |
+ |
|
9 | 11 |
|
10 | 12 |
/** |
11 | 13 |
* @author : 박세훈 |
... | ... | @@ -27,4 +29,7 @@ |
27 | 29 |
|
28 | 30 |
// 설문 내용 |
29 | 31 |
private String srvyCnt; |
32 |
+ |
|
33 |
+ // 설문 조사 상세 정보 테이블과 연결 |
|
34 |
+ private List<SurveyDetailVO> surveyDetail; |
|
30 | 35 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
+++ src/main/java/com/takensoft/ai_lms/lms/survey/web/SurveyController.java
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 |
|
3 | 3 |
|
4 | 4 |
import com.takensoft.ai_lms.lms.survey.service.SurveyService; |
5 |
+import com.takensoft.ai_lms.lms.survey.vo.SurveyDetailVO; |
|
5 | 6 |
import com.takensoft.ai_lms.lms.survey.vo.SurveyVO; |
6 | 7 |
import lombok.RequiredArgsConstructor; |
7 | 8 |
import org.springframework.web.bind.annotation.*; |
... | ... | @@ -37,11 +38,31 @@ |
37 | 38 |
} |
38 | 39 |
} |
39 | 40 |
|
41 |
+ @PostMapping("/insertDetail.json") |
|
42 |
+ public String insertDetailSurvey(@RequestBody SurveyDetailVO surveyDetailVO) throws Exception { |
|
43 |
+ try { |
|
44 |
+ int result = surveyService.insertSurveyDetail(surveyDetailVO); |
|
45 |
+ if ( result > 0) { |
|
46 |
+ return "success"; |
|
47 |
+ } else { |
|
48 |
+ return "fail"; |
|
49 |
+ } |
|
50 |
+ } catch (Exception e) { |
|
51 |
+ return "Error"; |
|
52 |
+ } |
|
53 |
+ } |
|
54 |
+ |
|
55 |
+ |
|
40 | 56 |
@GetMapping("/list.json") |
41 | 57 |
public List<SurveyVO> surveyList(SurveyVO surveyVO) throws Exception { |
42 | 58 |
return surveyService.surveyList(surveyVO); |
43 | 59 |
} |
44 | 60 |
|
61 |
+ @GetMapping("detailList.json") |
|
62 |
+ public List<SurveyDetailVO> surveyDetailVOList(SurveyDetailVO surveyDetailVO) throws Exception { |
|
63 |
+ return surveyService.surveyDetailList(surveyDetailVO); |
|
64 |
+ } |
|
65 |
+ |
|
45 | 66 |
|
46 | 67 |
@PutMapping("/update.json") |
47 | 68 |
public String updateSurvey (@RequestBody SurveyVO surveyVO) throws Exception { |
--- src/main/resources/mybatis/mapper/lms/board-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/board-SQL.xml
... | ... | @@ -70,15 +70,15 @@ |
70 | 70 |
--> |
71 | 71 |
<select id="findAllBoard" resultMap="boardResultMap"> |
72 | 72 |
SELECT b.bbs_id, |
73 |
- b.bbs_ttl, |
|
74 |
- b.bbs_cls, |
|
75 |
- b.bbs_cnt, |
|
76 |
- b.bbs_tm, |
|
77 |
- b.file_mng_id, |
|
78 |
- c.scls_id, |
|
79 |
- c.scls_nm, |
|
80 |
- u.user_id, |
|
81 |
- u.user_nm |
|
73 |
+ b.bbs_ttl, |
|
74 |
+ b.bbs_cls, |
|
75 |
+ b.bbs_cnt, |
|
76 |
+ b.bbs_tm, |
|
77 |
+ b.file_mng_id, |
|
78 |
+ c.scls_id, |
|
79 |
+ c.scls_nm, |
|
80 |
+ u.user_id, |
|
81 |
+ u.user_nm |
|
82 | 82 |
FROM board b |
83 | 83 |
LEFT JOIN class c ON b.scls_id = c.scls_id |
84 | 84 |
LEFT JOIN users u ON c.user_id = u.user_id |
... | ... | @@ -94,15 +94,15 @@ |
94 | 94 |
--> |
95 | 95 |
<select id="findByBoardId" resultMap="boardResultMap"> |
96 | 96 |
SELECT b.bbs_id, |
97 |
- b.bbs_ttl, |
|
98 |
- b.bbs_cls, |
|
99 |
- b.bbs_cnt, |
|
100 |
- b.bbs_tm, |
|
101 |
- b.file_mng_id, |
|
102 |
- c.scls_id, |
|
103 |
- c.scls_nm, |
|
104 |
- u.user_id, |
|
105 |
- u.user_nm |
|
97 |
+ b.bbs_ttl, |
|
98 |
+ b.bbs_cls, |
|
99 |
+ b.bbs_cnt, |
|
100 |
+ b.bbs_tm, |
|
101 |
+ b.file_mng_id, |
|
102 |
+ c.scls_id, |
|
103 |
+ c.scls_nm, |
|
104 |
+ u.user_id, |
|
105 |
+ u.user_nm |
|
106 | 106 |
FROM board b |
107 | 107 |
LEFT JOIN class c ON b.scls_id = c.scls_id |
108 | 108 |
LEFT JOIN users u ON c.user_id = u.user_id |
... | ... | @@ -117,15 +117,15 @@ |
117 | 117 |
--> |
118 | 118 |
<select id="searchBoard" resultMap="boardResultMap"> |
119 | 119 |
SELECT b.bbs_id, |
120 |
- b.bbs_ttl, |
|
121 |
- b.bbs_cls, |
|
122 |
- b.bbs_cnt, |
|
123 |
- b.bbs_tm, |
|
124 |
- b.file_mng_id, |
|
125 |
- c.scls_id, |
|
126 |
- c.scls_nm, |
|
127 |
- u.user_id, |
|
128 |
- u.user_nm |
|
120 |
+ b.bbs_ttl, |
|
121 |
+ b.bbs_cls, |
|
122 |
+ b.bbs_cnt, |
|
123 |
+ b.bbs_tm, |
|
124 |
+ b.file_mng_id, |
|
125 |
+ c.scls_id, |
|
126 |
+ c.scls_nm, |
|
127 |
+ u.user_id, |
|
128 |
+ u.user_nm |
|
129 | 129 |
FROM board b |
130 | 130 |
LEFT JOIN class c ON b.scls_id = c.scls_id |
131 | 131 |
LEFT JOIN users u ON c.user_id = u.user_id |
--- src/main/resources/mybatis/mapper/lms/survey-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/survey-SQL.xml
... | ... | @@ -7,9 +7,28 @@ |
7 | 7 |
<result property="srvyId" column="srvy_id"/> |
8 | 8 |
<result property="srvyType" column="srvy_type"/> |
9 | 9 |
<result property="srvyCnt" column="srvy_cnt"/> |
10 |
+ <collection property="surveyDetail" ofType="SurveyDetailVO"> |
|
11 |
+ <result property="srvyDtlId" column="srvy_dtl_id" /> |
|
12 |
+ <result property="srvyDtlCnt" column="srvy_dtl_cnt" /> |
|
13 |
+ </collection> |
|
10 | 14 |
</resultMap> |
11 | 15 |
|
16 |
+<!-- <resultMap id="surveyDetailMap" type="SurveyDetailVO">--> |
|
17 |
+<!-- <result property="srvyDtlId" column="srvy_dtl_id" />--> |
|
18 |
+<!-- <result property="srvyDtlCnt" column="srvy_dtl_cnt" />--> |
|
19 |
+<!-- <result property="srvyId" column="srvy_id" />--> |
|
20 |
+<!-- <collection property="survey" ofType="SurveyVO">--> |
|
21 |
+<!-- <result property="srvyId" column="srvy_id"/>--> |
|
22 |
+<!-- <result property="srvyType" column="srvy_type"/>--> |
|
23 |
+<!-- <result property="srvyCnt" column="srvy_cnt"/>--> |
|
24 |
+<!-- </collection>--> |
|
25 |
+<!-- </resultMap>--> |
|
12 | 26 |
|
27 |
+ <!-- |
|
28 |
+ 작성자 : 박세훈 |
|
29 |
+ 작성일 : 2024.07.29 |
|
30 |
+ 내 용 : 설문 조사 정보 등록 |
|
31 |
+ --> |
|
13 | 32 |
<insert id="insertSurvey" parameterType="SurveyVO"> |
14 | 33 |
INSERT INTO survey( srvy_id, |
15 | 34 |
srvy_type, |
... | ... | @@ -19,11 +38,57 @@ |
19 | 38 |
#{srvyCnt}); |
20 | 39 |
</insert> |
21 | 40 |
|
41 |
+ |
|
42 |
+ <!-- |
|
43 |
+ 작성자 : 박세훈 |
|
44 |
+ 작성일 : 2024.07.30 |
|
45 |
+ 내 용 : 설문 조사 상세 정보 등록 |
|
46 |
+ --> |
|
47 |
+ |
|
48 |
+ <insert id="insertSurveyDetail"> |
|
49 |
+ INSERT INTO survey_detail( srvy_dtl_id, |
|
50 |
+ srvy_dtl_cnt, |
|
51 |
+ srvy_id) |
|
52 |
+ VALUES (#{srvyDtlId}, |
|
53 |
+ #{srvyDtlCnt}, |
|
54 |
+ #{srvyId}); |
|
55 |
+ </insert> |
|
56 |
+ |
|
57 |
+ |
|
58 |
+ <!-- |
|
59 |
+ 작성자 : 박세훈 |
|
60 |
+ 작성일 : 2024.07.29 |
|
61 |
+ 내 용 : 설문 조사 정보 조회 |
|
62 |
+ --> |
|
22 | 63 |
<select id="surveyList" parameterType="SurveyVO"> |
23 | 64 |
SELECT * |
24 | 65 |
FROM survey |
25 | 66 |
</select> |
26 | 67 |
|
68 |
+ <!-- |
|
69 |
+ 작성자 : 박세훈 |
|
70 |
+ 작성일 : 2024.07.30 |
|
71 |
+ 내 용 : 설문 조사 상세 정보 조회 |
|
72 |
+ --> |
|
73 |
+ |
|
74 |
+ <select id="surveyDetailList" resultMap="surveyMap"> |
|
75 |
+ SELECT s.srvy_id, |
|
76 |
+ s.srvy_cnt, |
|
77 |
+ s.srvy_type, |
|
78 |
+ d.srvy_dtl_cnt, |
|
79 |
+ d.srvy_dtl_id |
|
80 |
+ FROM survey s |
|
81 |
+ LEFT JOIN survey_detail d ON s.srvy_id = d.srvy_id |
|
82 |
+ ORDER BY s.srvy_id DESC |
|
83 |
+ </select> |
|
84 |
+ |
|
85 |
+ |
|
86 |
+ |
|
87 |
+ <!-- |
|
88 |
+ 작성자 : 박세훈 |
|
89 |
+ 작성일 : 2024.07.29 |
|
90 |
+ 내 용 : 설문 조사 정보 수정 |
|
91 |
+ --> |
|
27 | 92 |
<update id="updateSurvey" parameterType="SurveyVO"> |
28 | 93 |
UPDATE survey |
29 | 94 |
SET srvy_type = #{srvyType}, |
... | ... | @@ -35,6 +100,11 @@ |
35 | 100 |
|
36 | 101 |
|
37 | 102 |
|
103 |
+ <!-- |
|
104 |
+ 작성자 : 박세훈 |
|
105 |
+ 작성일 : 2024.07.29 |
|
106 |
+ 내 용 : 설문 조사 정보 삭제 |
|
107 |
+ --> |
|
38 | 108 |
<delete id="deleteSurvey" parameterType="String"> |
39 | 109 |
DELETE FROM survey |
40 | 110 |
WHERE srvy_id = #{srvyId} |
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?