--- src/main/java/com/takensoft/cms/menu/dao/MenuDgstfnDAO.java
+++ src/main/java/com/takensoft/cms/menu/dao/MenuDgstfnDAO.java
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 |
* @modification |
15 | 15 |
* since | author | description |
16 | 16 |
* 2025.04.23 | 하석형 | 최초 등록 |
17 |
+ * 2025.04.23 | 하석형 | findMenuDgstfnByMenuId 추가 |
|
17 | 18 |
* |
18 | 19 |
* 메뉴별 만족도 관련 DAO |
19 | 20 |
*/ |
... | ... | @@ -37,6 +38,14 @@ |
37 | 38 |
|
38 | 39 |
/** |
39 | 40 |
* @param menuDgstfnVO - 메뉴 만족도 정보 |
41 |
+ * @return MenuDgstfnVO - 메뉴별 만족도 정보 |
|
42 |
+ * |
|
43 |
+ * 메뉴별 만족도 상세 조회 |
|
44 |
+ */ |
|
45 |
+ MenuDgstfnVO findMenuDgstfnByMenuId(MenuDgstfnVO menuDgstfnVO); |
|
46 |
+ |
|
47 |
+ /** |
|
48 |
+ * @param menuDgstfnVO - 메뉴 만족도 정보 |
|
40 | 49 |
* @return int - 등록 결과 |
41 | 50 |
* |
42 | 51 |
* 메뉴별 만족도 등록 |
--- src/main/java/com/takensoft/cms/menu/service/Impl/MenuDgstfnServiceImpl.java
+++ src/main/java/com/takensoft/cms/menu/service/Impl/MenuDgstfnServiceImpl.java
... | ... | @@ -15,7 +15,9 @@ |
15 | 15 |
import com.takensoft.common.exception.CustomNotFoundException; |
16 | 16 |
import com.takensoft.common.exception.CustomUpdateFailException; |
17 | 17 |
import com.takensoft.common.idgen.service.IdgenService; |
18 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
18 | 19 |
import com.takensoft.common.util.JWTUtil; |
20 |
+import jakarta.servlet.http.HttpServletRequest; |
|
19 | 21 |
import lombok.RequiredArgsConstructor; |
20 | 22 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
21 | 23 |
import org.springframework.cache.annotation.CacheEvict; |
... | ... | @@ -31,6 +33,7 @@ |
31 | 33 |
* @modification |
32 | 34 |
* since | author | description |
33 | 35 |
* 2025.04.23 | 하석형 | 최초 등록 |
36 |
+ * 2025.04.23 | 하석형 | findMenuDgstfnByMenuId 추가 |
|
34 | 37 |
* |
35 | 38 |
* EgovAbstractServiceImpl - 전자정부 프레임워크에서 제공하는 추상 서비스 구현 클래스 |
36 | 39 |
* MenuDgstfnService - 메뉴별 만족도 서비스 인터페이스 |
... | ... | @@ -44,6 +47,7 @@ |
44 | 47 |
private final IdgenService menuDgstfnIdgn; |
45 | 48 |
private final MenuDgstfnDAO menuDgstfnDAO; |
46 | 49 |
private final JWTUtil jwtUtil; |
50 |
+ private final HttpRequestUtil httpRequestUtil; |
|
47 | 51 |
|
48 | 52 |
/** |
49 | 53 |
* @param |
... | ... | @@ -88,6 +92,32 @@ |
88 | 92 |
|
89 | 93 |
/** |
90 | 94 |
* @param menuDgstfnVO - 메뉴 만족도 정보 |
95 |
+ * @param req - HTTP 요청 객체 |
|
96 |
+ * @return MenuDgstfnVO - 메뉴별 만족도 정보 |
|
97 |
+ * @throws DataAccessException - 데이터베이스 접근 예외 발생 시 |
|
98 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
99 |
+ * |
|
100 |
+ * 메뉴별 만족도 상세 조회 |
|
101 |
+ */ |
|
102 |
+ @Override |
|
103 |
+ public MenuDgstfnVO findMenuDgstfnByMenuId(MenuDgstfnVO menuDgstfnVO, HttpServletRequest req) { |
|
104 |
+ try { |
|
105 |
+ // 아이피 정보 |
|
106 |
+ String ipAdrs = httpRequestUtil.getIp(req); |
|
107 |
+ menuDgstfnVO.setRegIp(ipAdrs); |
|
108 |
+ |
|
109 |
+ MenuDgstfnVO result = menuDgstfnDAO.findMenuDgstfnByMenuId(menuDgstfnVO); |
|
110 |
+ return result; |
|
111 |
+ } catch (DataAccessException dae) { |
|
112 |
+ throw dae; |
|
113 |
+ } catch (Exception e) { |
|
114 |
+ throw e; |
|
115 |
+ } |
|
116 |
+ } |
|
117 |
+ |
|
118 |
+ /** |
|
119 |
+ * @param menuDgstfnVO - 메뉴 만족도 정보 |
|
120 |
+ * @param req - HTTP 요청 객체 |
|
91 | 121 |
* @return int - 등록 결과 |
92 | 122 |
* @throws CustomInsertFailException - 등록 실패 예외 발생 시 |
93 | 123 |
* @throws DataAccessException - 데이터베이스 접근 예외 발생 시 |
... | ... | @@ -97,9 +127,13 @@ |
97 | 127 |
*/ |
98 | 128 |
@Override |
99 | 129 |
@Transactional(rollbackFor = Exception.class) |
100 |
- public int saveMenuDgstfn(MenuDgstfnVO menuDgstfnVO) { |
|
130 |
+ public int saveMenuDgstfn(MenuDgstfnVO menuDgstfnVO, HttpServletRequest req) { |
|
101 | 131 |
int result = 0; |
102 | 132 |
try { |
133 |
+ // 아이피 정보 |
|
134 |
+ String ipAdrs = httpRequestUtil.getIp(req); |
|
135 |
+ menuDgstfnVO.setRegIp(ipAdrs); |
|
136 |
+ |
|
103 | 137 |
// 메뉴별 만족도 아이디 생성 |
104 | 138 |
String menuDgstfnId = menuDgstfnIdgn.getNextStringId(); |
105 | 139 |
menuDgstfnVO.setMenuDgstfnId(menuDgstfnId); |
--- src/main/java/com/takensoft/cms/menu/service/MenuDgstfnService.java
+++ src/main/java/com/takensoft/cms/menu/service/MenuDgstfnService.java
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.author.vo.AuthorVO; |
4 | 4 |
import com.takensoft.cms.menu.vo.MenuDgstfnVO; |
5 |
+import jakarta.servlet.http.HttpServletRequest; |
|
5 | 6 |
|
6 | 7 |
import java.util.HashMap; |
7 | 8 |
import java.util.List; |
... | ... | @@ -12,6 +13,7 @@ |
12 | 13 |
* @modification |
13 | 14 |
* since | author | description |
14 | 15 |
* 2025.04.23 | 하석형 | 최초 등록 |
16 |
+ * 2025.04.23 | 하석형 | findMenuDgstfnByMenuId 추가 |
|
15 | 17 |
* |
16 | 18 |
* 메뉴별 만족도 관련 인터페이스 |
17 | 19 |
*/ |
... | ... | @@ -34,9 +36,19 @@ |
34 | 36 |
|
35 | 37 |
/** |
36 | 38 |
* @param menuDgstfnVO - 메뉴 만족도 정보 |
39 |
+ * @param req - HTTP 요청 객체 |
|
40 |
+ * @return MenuDgstfnVO - 메뉴별 만족도 정보 |
|
41 |
+ * |
|
42 |
+ * 메뉴별 만족도 상세 조회 |
|
43 |
+ */ |
|
44 |
+ MenuDgstfnVO findMenuDgstfnByMenuId(MenuDgstfnVO menuDgstfnVO, HttpServletRequest req); |
|
45 |
+ |
|
46 |
+ /** |
|
47 |
+ * @param menuDgstfnVO - 메뉴 만족도 정보 |
|
48 |
+ * @param req - HTTP 요청 객체 |
|
37 | 49 |
* @return int - 등록 결과 |
38 | 50 |
* |
39 | 51 |
* 메뉴별 만족도 등록 |
40 | 52 |
*/ |
41 |
- int saveMenuDgstfn(MenuDgstfnVO menuDgstfnVO); |
|
53 |
+ int saveMenuDgstfn(MenuDgstfnVO menuDgstfnVO, HttpServletRequest req); |
|
42 | 54 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/menu/web/MenuDgstfnController.java
+++ src/main/java/com/takensoft/cms/menu/web/MenuDgstfnController.java
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 |
import com.takensoft.cms.menu.vo.MenuDgstfnVO; |
6 | 6 |
import com.takensoft.common.message.MessageCode; |
7 | 7 |
import com.takensoft.common.util.ResponseUtil; |
8 |
+import jakarta.servlet.http.HttpServletRequest; |
|
8 | 9 |
import lombok.RequiredArgsConstructor; |
9 | 10 |
import org.springframework.http.ResponseEntity; |
10 | 11 |
import org.springframework.web.bind.annotation.*; |
... | ... | @@ -18,6 +19,7 @@ |
18 | 19 |
* @modification |
19 | 20 |
* since | author | description |
20 | 21 |
* 2025.04.23 | 하석형 | 최초 등록 |
22 |
+ * 2025.04.23 | 하석형 | findByMenuId 추가 |
|
21 | 23 |
* |
22 | 24 |
* 메뉴별 만족도 관련 Controller |
23 | 25 |
*/ |
... | ... | @@ -44,7 +46,7 @@ |
44 | 46 |
} |
45 | 47 |
|
46 | 48 |
/** |
47 |
- * @param |
|
49 |
+ * @param menuDgstfnVO - 메뉴별 만족도 정보 |
|
48 | 50 |
* @return ResponseEntity - 메뉴별 만족도 목록 조회 결과를 포함하는 ResponseEntity |
49 | 51 |
* |
50 | 52 |
* 메뉴별 만족도 목록 조회 |
... | ... | @@ -59,14 +61,29 @@ |
59 | 61 |
|
60 | 62 |
/** |
61 | 63 |
* @param menuDgstfnVO - 메뉴별 만족도 정보 |
64 |
+ * @param req - HTTP 요청 객체 |
|
65 |
+ * @return ResponseEntity - 메뉴별 만족도 목록 조회 결과를 포함하는 ResponseEntity |
|
66 |
+ * |
|
67 |
+ * 메뉴별 만족도 상세 조회 |
|
68 |
+ */ |
|
69 |
+ @PostMapping(value = "/findByMenuId.json") |
|
70 |
+ public ResponseEntity<?> findByMenuId(@RequestBody MenuDgstfnVO menuDgstfnVO, HttpServletRequest req) { |
|
71 |
+ MenuDgstfnVO result = menuDgstfnService.findMenuDgstfnByMenuId(menuDgstfnVO, req); |
|
72 |
+ |
|
73 |
+ // 응답 처리 |
|
74 |
+ return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
75 |
+ } |
|
76 |
+ |
|
77 |
+ /** |
|
78 |
+ * @param menuDgstfnVO - 메뉴별 만족도 정보 |
|
62 | 79 |
* @return ResponseEntity - 메뉴별 만족도 등록 결과를 포함하는 ResponseEntity |
63 | 80 |
* |
64 | 81 |
* 메뉴별 만족도 등록 |
65 | 82 |
*/ |
66 | 83 |
@PostMapping(value = "/saveProc.json") |
67 |
- public ResponseEntity<?> saveProc(@RequestBody MenuDgstfnVO menuDgstfnVO) { |
|
84 |
+ public ResponseEntity<?> saveProc(@RequestBody MenuDgstfnVO menuDgstfnVO, HttpServletRequest req) { |
|
68 | 85 |
// 메뉴별 만족도 등록 |
69 |
- int result = menuDgstfnService.saveMenuDgstfn(menuDgstfnVO); |
|
86 |
+ int result = menuDgstfnService.saveMenuDgstfn(menuDgstfnVO, req); |
|
70 | 87 |
|
71 | 88 |
// 응답 처리 |
72 | 89 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
--- src/main/resources/mybatis/mapper/menu/menuDgstfn-SQL.xml
+++ src/main/resources/mybatis/mapper/menu/menuDgstfn-SQL.xml
... | ... | @@ -10,6 +10,23 @@ |
10 | 10 |
======================================================================================================== |
11 | 11 |
--> |
12 | 12 |
<mapper namespace="com.takensoft.cms.menu.dao.MenuDgstfnDAO"> |
13 |
+ <sql id="selectMenuDgstfn"> |
|
14 |
+ SELECT |
|
15 |
+ md.menu_dgstfn_id |
|
16 |
+ , md.menu_id |
|
17 |
+ , md.rspns_five |
|
18 |
+ , md.rspns_four |
|
19 |
+ , md.rspns_three |
|
20 |
+ , md.rspns_two |
|
21 |
+ , md.rspns_one |
|
22 |
+ , md.opnn |
|
23 |
+ , md.reg_ip |
|
24 |
+ , md.rgtr |
|
25 |
+ , TO_CHAR(md.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt |
|
26 |
+ FROM |
|
27 |
+ menu_dgstfn md |
|
28 |
+ </sql> |
|
29 |
+ |
|
13 | 30 |
<!-- |
14 | 31 |
작 성 자 : 하석형 |
15 | 32 |
작 성 일 : 2025.04.23 |
... | ... | @@ -46,25 +63,31 @@ |
46 | 63 |
내 용 : 메뉴별 만족도 목록 조회 |
47 | 64 |
--> |
48 | 65 |
<select id="findAllMenuDgstfnByMenuId" parameterType="MenuDgstfnVO" resultType="MenuDgstfnVO"> |
49 |
- SELECT |
|
50 |
- md.menu_dgstfn_id |
|
51 |
- , md.menu_id |
|
52 |
- , md.rspns_five |
|
53 |
- , md.rspns_four |
|
54 |
- , md.rspns_three |
|
55 |
- , md.rspns_two |
|
56 |
- , md.rspns_one |
|
57 |
- , md.opnn |
|
58 |
- , md.reg_ip |
|
59 |
- , md.rgtr |
|
60 |
- , TO_CHAR(md.reg_dt, 'YYYY-MM-DD HH24:MI') AS reg_dt |
|
61 |
- FROM |
|
62 |
- menu_dgstfn md |
|
66 |
+ <include refid="selectMenuDgstfn" /> |
|
63 | 67 |
WHERE |
64 | 68 |
1 = 1 |
65 | 69 |
<if test ="menuId != null and menuId != ''"> |
66 | 70 |
AND md.menu_id = #{menuId} |
67 | 71 |
</if> |
72 |
+ ORDER BY |
|
73 |
+ md.reg_dt DESC |
|
74 |
+ </select> |
|
75 |
+ |
|
76 |
+ <!-- |
|
77 |
+ 작 성 자 : 하석형 |
|
78 |
+ 작 성 일 : 2025.04.24 |
|
79 |
+ 내 용 : 메뉴별 만족도 상세 조회 |
|
80 |
+ --> |
|
81 |
+ <select id="findMenuDgstfnByMenuId" parameterType="MenuDgstfnVO" resultType="MenuDgstfnVO"> |
|
82 |
+ <include refid="selectMenuDgstfn" /> |
|
83 |
+ WHERE |
|
84 |
+ 1 = 1 |
|
85 |
+ <if test ="menuId != null and menuId != ''"> |
|
86 |
+ AND md.menu_id = #{menuId} |
|
87 |
+ </if> |
|
88 |
+ <if test ="regIp != null and regIp != ''"> |
|
89 |
+ AND md.reg_ip = #{regIp} |
|
90 |
+ </if> |
|
68 | 91 |
</select> |
69 | 92 |
|
70 | 93 |
<!-- |
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?