ads367
04-26
2024-04-25 공통코드, 부서 정보 수정
@7210d9e36bbb77ecf3f4ab78b986e1b90c8ae104
--- src/main/java/com/takensoft/cms/codeManage/dao/CodeManageDAO.java
+++ src/main/java/com/takensoft/cms/codeManage/dao/CodeManageDAO.java
... | ... | @@ -37,6 +37,13 @@ |
37 | 37 |
|
38 | 38 |
/** |
39 | 39 |
* @author takensoft |
40 |
+ * @since 2024.04.26 |
|
41 |
+ * 상위코드가 수정됨에 따라 하위코드의 상위코드값 변경 |
|
42 |
+ */ |
|
43 |
+ int updateUpCd(CodeManageVO codeManageVO); |
|
44 |
+ |
|
45 |
+ /** |
|
46 |
+ * @author takensoft |
|
40 | 47 |
* @since 2024.04.09 |
41 | 48 |
* 코드 깊이 조회 |
42 | 49 |
*/ |
--- src/main/java/com/takensoft/cms/codeManage/service/Impl/CodeManageServiceImpl.java
+++ src/main/java/com/takensoft/cms/codeManage/service/Impl/CodeManageServiceImpl.java
... | ... | @@ -73,7 +73,11 @@ |
73 | 73 |
public int cdUpdate(CodeManageVO codeManageVO) throws Exception { |
74 | 74 |
// 등록된 토큰에서 사용자 정보 조회 |
75 | 75 |
codeManageVO.setMdfr(jwtUtil.getWriter()); |
76 |
- return codeManageDAO.update(codeManageVO); |
|
76 |
+ // 코드 수정 |
|
77 |
+ int result = codeManageDAO.update(codeManageVO); |
|
78 |
+ // 해당 코드가 변경됨에 따라 하위 코드의 상위코드값 변경 |
|
79 |
+ result += codeManageDAO.updateUpCd(codeManageVO); |
|
80 |
+ return result; |
|
77 | 81 |
} |
78 | 82 |
|
79 | 83 |
/** |
--- src/main/java/com/takensoft/cms/dept/dao/DeptDAO.java
+++ src/main/java/com/takensoft/cms/dept/dao/DeptDAO.java
... | ... | @@ -64,4 +64,18 @@ |
64 | 64 |
* 부서 정보 조회 |
65 | 65 |
*/ |
66 | 66 |
DeptVO findByDept(String deptId); |
67 |
+ |
|
68 |
+ /** |
|
69 |
+ * @author takensoft |
|
70 |
+ * @since 2024.04.26 |
|
71 |
+ * 부서 정보 수정 |
|
72 |
+ */ |
|
73 |
+ int update(DeptVO deptVO); |
|
74 |
+ |
|
75 |
+ /** |
|
76 |
+ * @author takensoft |
|
77 |
+ * @since 2024.04.26 |
|
78 |
+ * 부서 권한 삭제 |
|
79 |
+ */ |
|
80 |
+ int deleteAuth(String deptId); |
|
67 | 81 |
} |
--- src/main/java/com/takensoft/cms/dept/service/DeptService.java
+++ src/main/java/com/takensoft/cms/dept/service/DeptService.java
... | ... | @@ -41,4 +41,11 @@ |
41 | 41 |
* 부서 정보 조회 |
42 | 42 |
*/ |
43 | 43 |
public DeptVO findByDept(HashMap<String, Object> params) throws Exception; |
44 |
+ |
|
45 |
+ /** |
|
46 |
+ * @author takensoft |
|
47 |
+ * @since 2024.04.26 |
|
48 |
+ * 부서 정보 수정 |
|
49 |
+ */ |
|
50 |
+ public int deptUpdate(DeptVO deptVO) throws Exception; |
|
44 | 51 |
} |
--- src/main/java/com/takensoft/cms/dept/service/Impl/DeptServiceImpl.java
+++ src/main/java/com/takensoft/cms/dept/service/Impl/DeptServiceImpl.java
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 |
List<HierachyVO> childList = deptDAO.findChildNode(id); |
99 | 99 |
for(HierachyVO vo : childList) { |
100 | 100 |
List<HierachyVO> child = findChildNode(vo.getId()); |
101 |
- vo.setChildList(childList); |
|
101 |
+ vo.setChildList(child); |
|
102 | 102 |
} |
103 | 103 |
return childList; |
104 | 104 |
} |
... | ... | @@ -114,4 +114,31 @@ |
114 | 114 |
String deptId = params.get("deptId").toString(); |
115 | 115 |
return deptDAO.findByDept(deptId); |
116 | 116 |
} |
117 |
+ |
|
118 |
+ /** |
|
119 |
+ * @author takensoft |
|
120 |
+ * @since 2024.04.26 |
|
121 |
+ * 부서 정보 수정 |
|
122 |
+ */ |
|
123 |
+ @Override |
|
124 |
+ @Transactional(rollbackFor = Exception.class) |
|
125 |
+ public int deptUpdate(DeptVO deptVO) throws Exception { |
|
126 |
+ // 토큰에서 사용자 정보 추출 |
|
127 |
+ deptVO.setMdfr(jwtUtil.getWriter()); |
|
128 |
+ // 부서정보 수정 |
|
129 |
+ int result = deptDAO.update(deptVO); |
|
130 |
+ |
|
131 |
+ // 부서 권한 삭제 |
|
132 |
+ result += deptDAO.deleteAuth(deptVO.getDeptId()); |
|
133 |
+ |
|
134 |
+ // 부서 권한 등록 |
|
135 |
+ if(deptVO.getAuthrtList().size() > 0) { |
|
136 |
+ for(DeptAuthrtVO vo : deptVO.getAuthrtList()) { |
|
137 |
+ vo.setDeptId(deptVO.getDeptId()); |
|
138 |
+ vo.setRgtr(jwtUtil.getWriter()); |
|
139 |
+ result += deptDAO.authrtSave(vo); |
|
140 |
+ } |
|
141 |
+ } |
|
142 |
+ return result; |
|
143 |
+ } |
|
117 | 144 |
} |
--- src/main/java/com/takensoft/cms/dept/web/DeptController.java
+++ src/main/java/com/takensoft/cms/dept/web/DeptController.java
... | ... | @@ -45,9 +45,6 @@ |
45 | 45 |
*/ |
46 | 46 |
@PostMapping("/saveProc.json") |
47 | 47 |
public ResponseEntity<?> saveProc(@RequestBody DeptVO deptVO) throws Exception { |
48 |
- |
|
49 |
- |
|
50 |
- |
|
51 | 48 |
// 부서 등록 |
52 | 49 |
int result = deptService.deptSave(deptVO); |
53 | 50 |
|
... | ... | @@ -125,4 +122,34 @@ |
125 | 122 |
return new ResponseEntity<>(responseData, headers, HttpStatus.OK); |
126 | 123 |
} |
127 | 124 |
|
125 |
+ /** |
|
126 |
+ * @author takensoft |
|
127 |
+ * @since 2024.04.26 |
|
128 |
+ * @param deptVO |
|
129 |
+ * @return |
|
130 |
+ * @throws Exception |
|
131 |
+ * |
|
132 |
+ * 부서 수정 |
|
133 |
+ */ |
|
134 |
+ @PostMapping(value = "/updateProc.json") |
|
135 |
+ public ResponseEntity<?> updateProc(@RequestBody DeptVO deptVO) throws Exception { |
|
136 |
+ // 부서 등록 |
|
137 |
+ int result = deptService.deptUpdate(deptVO); |
|
138 |
+ |
|
139 |
+ // 응답 처리 |
|
140 |
+ HttpHeaders headers = new HttpHeaders(); |
|
141 |
+ headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8"))); |
|
142 |
+ ResponseData responseData = new ResponseData(); |
|
143 |
+ |
|
144 |
+ if(result > 0) { |
|
145 |
+ responseData.setStatus(HttpStatus.OK); |
|
146 |
+ responseData.setMessage("정상적으로 등록 처리되었습니다."); |
|
147 |
+ return new ResponseEntity<>(responseData, headers, HttpStatus.OK); |
|
148 |
+ } else { |
|
149 |
+ responseData.setStatus(HttpStatus.INTERNAL_SERVER_ERROR); |
|
150 |
+ responseData.setMessage("등록에 실패하였습니다.\n담당자에게 문의하세요."); |
|
151 |
+ return new ResponseEntity<>(responseData, headers, HttpStatus.INTERNAL_SERVER_ERROR); |
|
152 |
+ } |
|
153 |
+ } |
|
154 |
+ |
|
128 | 155 |
} |
--- src/main/resources/mybatis/mapper/codeManage/codeManage-SQL.xml
+++ src/main/resources/mybatis/mapper/codeManage/codeManage-SQL.xml
... | ... | @@ -182,6 +182,17 @@ |
182 | 182 |
|
183 | 183 |
<!-- |
184 | 184 |
작성자 : takensoft |
185 |
+ 작성일 : 2024.04.26 |
|
186 |
+ 내 용 : 상위코드가 수정됨에 따라 하위코드의 상위코드값 변경 |
|
187 |
+ --> |
|
188 |
+ <update id="updateUpCd" parameterType="CodeManageVO"> |
|
189 |
+ UPDATE cd_mng |
|
190 |
+ SET up_cd = #{cd} |
|
191 |
+ WHERE up_cd = #{originCd} |
|
192 |
+ </update> |
|
193 |
+ |
|
194 |
+ <!-- |
|
195 |
+ 작성자 : takensoft |
|
185 | 196 |
작성일 : 2024.04.23 |
186 | 197 |
내 용 : 코드 삭제 |
187 | 198 |
--> |
--- src/main/resources/mybatis/mapper/dept/dept-SQL.xml
+++ src/main/resources/mybatis/mapper/dept/dept-SQL.xml
... | ... | @@ -125,6 +125,7 @@ |
125 | 125 |
<select id="findByTopNode" resultType="HierachyVO"> |
126 | 126 |
<include refid="selecteNode" /> |
127 | 127 |
WHERE up_dept_id IS NULL |
128 |
+ AND use_yn = 'Y' |
|
128 | 129 |
ORDER BY dept_sn |
129 | 130 |
</select> |
130 | 131 |
<!-- |
... | ... | @@ -135,6 +136,7 @@ |
135 | 136 |
<select id="findChildNode" parameterType="String" resultType="HierachyVO"> |
136 | 137 |
<include refid="selecteNode" /> |
137 | 138 |
WHERE up_dept_id = #{id} |
139 |
+ AND use_yn = 'Y' |
|
138 | 140 |
ORDER BY dept_sn |
139 | 141 |
</select> |
140 | 142 |
<!-- 부서 관리(관리자 페이지 Tree 호출용) --> |
... | ... | @@ -176,4 +178,33 @@ |
176 | 178 |
FROM dept_authrt_info dai |
177 | 179 |
WHERE dai.dept_id = #{deptId} |
178 | 180 |
</select> |
181 |
+ |
|
182 |
+ <!-- |
|
183 |
+ 작성자 : takensoft |
|
184 |
+ 작성일 : 2024.04.26 |
|
185 |
+ 내 용 : 부서정보 수정 |
|
186 |
+ --> |
|
187 |
+ <update id="update" parameterType="DeptVO"> |
|
188 |
+ UPDATE dept_info |
|
189 |
+ SET up_dept_id = #{upDeptId} |
|
190 |
+ , dept_nm = #{deptNm} |
|
191 |
+ , dept_expln = #{deptExpln} |
|
192 |
+ , dept_grd = #{deptGrd} |
|
193 |
+ , dept_sn = #{deptSn} |
|
194 |
+ , use_yn = #{useYn} |
|
195 |
+ , mdfr = #{mdfr} |
|
196 |
+ , mdfcn_dt = NOW() |
|
197 |
+ WHERE dept_id = #{deptId} |
|
198 |
+ </update> |
|
199 |
+ |
|
200 |
+ <!-- |
|
201 |
+ 작성자 : takensoft |
|
202 |
+ 작성일 : 2024.04.26 |
|
203 |
+ 내 용 : 부서권한 삭제 |
|
204 |
+ --> |
|
205 |
+ <delete id="deleteAuth" parameterType="String"> |
|
206 |
+ DELETE |
|
207 |
+ FROM dept_authrt_info |
|
208 |
+ WHERE dept_id = #{deptId} |
|
209 |
+ </delete> |
|
179 | 210 |
</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?