
250322 하석형 게시판유형/게시판댓글/금지어 관련 throws Exception -> try catch 변경
@79b2e865771b16dfc9d21d02bb49ce6399c05947
--- src/main/java/com/takensoft/cms/bbs/dao/BbsMngDAO.java
+++ src/main/java/com/takensoft/cms/bbs/dao/BbsMngDAO.java
... | ... | @@ -8,13 +8,6 @@ |
8 | 8 |
import java.util.*; |
9 | 9 |
|
10 | 10 |
/** |
11 |
- * @author : 박정하 |
|
12 |
- * @since : 2024.05.08 |
|
13 |
- * |
|
14 |
- * 게시판 관리 관련 Mapper |
|
15 |
- */ |
|
16 |
- |
|
17 |
-/** |
|
18 | 11 |
* @author 박정하 |
19 | 12 |
* @since 2024.05.08 |
20 | 13 |
* @modification |
--- src/main/java/com/takensoft/cms/bbs/dao/BbsRouterDAO.java
+++ src/main/java/com/takensoft/cms/bbs/dao/BbsRouterDAO.java
... | ... | @@ -8,16 +8,20 @@ |
8 | 8 |
import java.util.List; |
9 | 9 |
|
10 | 10 |
/** |
11 |
- * @author : 하석형 |
|
12 |
- * @since : 2024.05.09 |
|
11 |
+ * @author takensoft |
|
12 |
+ * @since 2024.05.16 |
|
13 |
+ * @modification |
|
14 |
+ * since | author | description |
|
15 |
+ * 2024.05.16 | takensoft | 최초 등록 |
|
16 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
13 | 17 |
* |
14 |
- * 게시판 내용 관련 Mapper |
|
18 |
+ * 게시판 라우터 관련 DAO |
|
15 | 19 |
*/ |
16 | 20 |
@Mapper("bbsRouterDAO") |
17 | 21 |
public interface BbsRouterDAO { |
18 | 22 |
/** |
19 |
- * @author takensoft |
|
20 |
- * @since 2024.05.16 |
|
23 |
+ * @return List<ContsAuthrtVO> - 콘텐츠 유형과 권한 정보 목록 |
|
24 |
+ * |
|
21 | 25 |
* 게시판 라우터 정보 호출 |
22 | 26 |
*/ |
23 | 27 |
List<ContsAuthrtVO> findByBbsRouterAuthrt(); |
--- src/main/java/com/takensoft/cms/bbs/dao/BbsTypeMngDAO.java
+++ src/main/java/com/takensoft/cms/bbs/dao/BbsTypeMngDAO.java
... | ... | @@ -7,31 +7,39 @@ |
7 | 7 |
import java.util.List; |
8 | 8 |
|
9 | 9 |
/** |
10 |
- * @author : 박정하 |
|
11 |
- * @since : 2024.05.08 |
|
10 |
+ * @author 박정하 |
|
11 |
+ * @since 2024.05.08 |
|
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2024.05.08 | 박정하 | 최초 등록 |
|
15 |
+ * 2024.05.13 | 하석형 | findAll, findByBbsTypeId 추가 |
|
16 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
12 | 17 |
* |
13 |
- * 게시판 유형 관리 관련 Mapper |
|
18 |
+ * 게시판 유형 관리 관련 DAO |
|
14 | 19 |
*/ |
15 | 20 |
@Mapper("bbsTypeMngDAO") |
16 | 21 |
public interface BbsTypeMngDAO { |
17 | 22 |
/** |
18 |
- * @author 박정하 |
|
19 |
- * @since 2024.05.08 |
|
23 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
24 |
+ * @return int - 게시판 유형 관리 등록 결과 |
|
25 |
+ * |
|
20 | 26 |
* 게시판 유형 관리 등록 |
21 | 27 |
*/ |
22 |
- public int insertBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) throws Exception; |
|
28 |
+ public int insertBbsTypeMng(BbsTypeMngVO bbsTypeMngVO); |
|
23 | 29 |
|
24 | 30 |
/** |
25 |
- * @author 하석형 |
|
26 |
- * @since 2024.05.13 |
|
31 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
32 |
+ * @return List<BbsTypeMngVO> - 게시판 유형 관리 정보를 담고 있는 객체 목록 |
|
33 |
+ * |
|
27 | 34 |
* 게시판 유형 관리 목록 조회 |
28 | 35 |
*/ |
29 |
- public List<BbsTypeMngVO> findAll(BbsTypeMngVO bbsTypeMngVO) throws Exception; |
|
36 |
+ public List<BbsTypeMngVO> findAll(BbsTypeMngVO bbsTypeMngVO); |
|
30 | 37 |
|
31 | 38 |
/** |
32 |
- * @author 하석형 |
|
33 |
- * @since 2024.05.13 |
|
39 |
+ * @param bbsTypeId - 게시판 유형 아이디 |
|
40 |
+ * @return BbsTypeMngVO - 게시판 유형 관리 정보를 담고 있는 객체 |
|
41 |
+ * |
|
34 | 42 |
* 게시판 유형 관리 상세 조회 |
35 | 43 |
*/ |
36 |
- public BbsTypeMngVO findByBbsTypeId(String bbsTypeId) throws Exception; |
|
44 |
+ public BbsTypeMngVO findByBbsTypeId(String bbsTypeId); |
|
37 | 45 |
} |
--- src/main/java/com/takensoft/cms/bbs/dao/CmntDAO.java
+++ src/main/java/com/takensoft/cms/bbs/dao/CmntDAO.java
... | ... | @@ -6,12 +6,15 @@ |
6 | 6 |
import java.util.List; |
7 | 7 |
|
8 | 8 |
/** |
9 |
- * @author : 방선주 |
|
10 |
- * @since : 2024.05.27 |
|
9 |
+ * @author 방선주 |
|
10 |
+ * @since 2024.05.27 |
|
11 |
+ * @modification |
|
12 |
+ * since | author | description |
|
13 |
+ * 2024.05.27 | 방선주 | 최초 등록 |
|
14 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
11 | 15 |
* |
12 | 16 |
* 게시판 댓글 관련 DAO |
13 | 17 |
*/ |
14 |
- |
|
15 | 18 |
@Mapper("cmntDAO") |
16 | 19 |
public interface CmntDAO { |
17 | 20 |
/** |
... | ... | @@ -19,35 +22,35 @@ |
19 | 22 |
* @since 2024.05.27 |
20 | 23 |
* 게시판 댓글 등록 |
21 | 24 |
*/ |
22 |
- public int saveCmnt(CmntVO cmntVO) throws Exception; |
|
25 |
+ public int saveCmnt(CmntVO cmntVO); |
|
23 | 26 |
/** |
24 | 27 |
* @author 방선주 |
25 | 28 |
* @since 2024.05.27 |
26 | 29 |
* 게시판 댓글 카운트 조회 |
27 | 30 |
*/ |
28 |
- public int getCmntCount(CmntVO cmntVO) throws Exception; |
|
31 |
+ public int getCmntCount(CmntVO cmntVO); |
|
29 | 32 |
/** |
30 | 33 |
* @author 방선주 |
31 | 34 |
* @since 2024.05.27 |
32 | 35 |
* 부모 댓글 조회 |
33 | 36 |
*/ |
34 |
- public CmntVO findParentCmnt(int upCmntId) throws Exception; |
|
37 |
+ public CmntVO findParentCmnt(int upCmntId); |
|
35 | 38 |
/** |
36 | 39 |
* @author 방선주 |
37 | 40 |
* @since 2024.05.27 |
38 | 41 |
* 게시판 댓글 목록 조회 |
39 | 42 |
*/ |
40 |
- public List<CmntVO> findCmntList(String bbsId) throws Exception; |
|
43 |
+ public List<CmntVO> findCmntList(String bbsId); |
|
41 | 44 |
/** |
42 | 45 |
* @author 방선주 |
43 | 46 |
* @since 2024.05.27 |
44 | 47 |
* 게시판 댓글 업데이트 |
45 | 48 |
*/ |
46 |
- public int updateCmnt(CmntVO cmntVO) throws Exception; |
|
49 |
+ public int updateCmnt(CmntVO cmntVO); |
|
47 | 50 |
/** |
48 | 51 |
* @author 방선주 |
49 | 52 |
* @since 2024.05.27 |
50 | 53 |
* 게시판 삭제 |
51 | 54 |
*/ |
52 |
- public int deleteCmnt(CmntVO cmntVO) throws Exception; |
|
55 |
+ public int deleteCmnt(CmntVO cmntVO); |
|
53 | 56 |
} |
--- src/main/java/com/takensoft/cms/bbs/dao/WordMngDAO.java
+++ src/main/java/com/takensoft/cms/bbs/dao/WordMngDAO.java
... | ... | @@ -7,20 +7,54 @@ |
7 | 7 |
import java.util.List; |
8 | 8 |
|
9 | 9 |
/** |
10 |
- * @author : 하석형 |
|
11 |
- * @since : 2024.05.31 |
|
10 |
+ * @author 방선주 |
|
11 |
+ * @since 2024.05.31 |
|
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2024.05.31 | 방선주 | 최초 등록 |
|
15 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
12 | 16 |
* |
13 |
- * 금지어 관련 Mapper |
|
17 |
+ * 금지어 관련 DAO |
|
14 | 18 |
*/ |
15 | 19 |
@Mapper("wordMngDAO") |
16 | 20 |
public interface WordMngDAO { |
17 |
- public int saveWords(WordMngVO wordMngVO) throws Exception; |
|
18 | 21 |
|
19 |
- public List<WordMngVO> findAllWord(Pagination search) throws Exception; |
|
22 |
+ /** |
|
23 |
+ * @param wordMngVO - 금지어 정보 |
|
24 |
+ * @return int - 금지어 등록 결과 |
|
25 |
+ * |
|
26 |
+ * 금지어 등록 |
|
27 |
+ */ |
|
28 |
+ public int saveWords(WordMngVO wordMngVO); |
|
20 | 29 |
|
21 |
- public int findAllCnt(Pagination search) throws Exception; |
|
30 |
+ /** |
|
31 |
+ * @param pagination - 페이징 정보 |
|
32 |
+ * @return List<WordMngVO> - 금지어 정보를 담고 있는 객체 목록 |
|
33 |
+ * |
|
34 |
+ * 금지어 목록 조회 |
|
35 |
+ */ |
|
36 |
+ public List<WordMngVO> findAllWord(Pagination pagination); |
|
22 | 37 |
|
23 |
- public int deleteWords(int word) throws Exception; |
|
38 |
+ /** |
|
39 |
+ * @param pagination - 페이징 정보 |
|
40 |
+ * @return int - 금지어 목록 조회 개수 |
|
41 |
+ * |
|
42 |
+ * 금지어 목록 조회 개수 |
|
43 |
+ */ |
|
44 |
+ public int findAllCnt(Pagination pagination); |
|
24 | 45 |
|
46 |
+ /** |
|
47 |
+ * @param cntrlNmId - 금지어 아이디 |
|
48 |
+ * @return int - 금지어 삭제 결과 |
|
49 |
+ * |
|
50 |
+ * 금지어 삭제 |
|
51 |
+ */ |
|
52 |
+ public int deleteWords(int cntrlNmId); |
|
53 |
+ |
|
54 |
+ /** |
|
55 |
+ * @return List<String> - 금지어 목록 |
|
56 |
+ * |
|
57 |
+ * 전체 금지어 목록 조회 |
|
58 |
+ */ |
|
25 | 59 |
public List<String> findWordList(); |
26 | 60 |
} |
--- src/main/java/com/takensoft/cms/bbs/service/BbsTypeMngService.java
+++ src/main/java/com/takensoft/cms/bbs/service/BbsTypeMngService.java
... | ... | @@ -1,36 +1,49 @@ |
1 | 1 |
package com.takensoft.cms.bbs.service; |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.bbs.vo.BbsTypeMngVO; |
4 |
+import com.takensoft.common.exception.CustomInsertFailException; |
|
5 |
+import org.springframework.dao.DataAccessException; |
|
4 | 6 |
|
5 | 7 |
import java.util.HashMap; |
6 | 8 |
import java.util.List; |
7 | 9 |
import java.util.Map; |
8 | 10 |
|
9 | 11 |
/** |
10 |
- * @author : 박정하 |
|
11 |
- * @since : 2024.05.08 |
|
12 |
+ * @author 박정하 |
|
13 |
+ * @since 2024.05.08 |
|
14 |
+ * @modification |
|
15 |
+ * since | author | description |
|
16 |
+ * 2024.05.08 | 박정하 | 최초 등록 |
|
17 |
+ * 2024.05.13 | 하석형 | findAllBbsTypeMng, findByBbsTypeId 추가 |
|
18 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
12 | 19 |
* |
13 | 20 |
* 게시판 유형 관리 관련 인터페이스 |
14 | 21 |
*/ |
15 | 22 |
public interface BbsTypeMngService { |
16 | 23 |
/** |
17 |
- * @author 박정하 |
|
18 |
- * @since 2024.05.08 |
|
24 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
25 |
+ * @return HashMap<String, Object> |
|
26 |
+ * - bbsTypeMngId : 게시판 유형 관리 아이디 |
|
27 |
+ * - result : 게시판 유형 관리 등록 결과 |
|
28 |
+ * |
|
19 | 29 |
* 게시판 유형 관리 등록 |
20 | 30 |
*/ |
21 |
- public HashMap<String, Object> insertBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) throws Exception; |
|
31 |
+ public HashMap<String, Object> insertBbsTypeMng(BbsTypeMngVO bbsTypeMngVO); |
|
22 | 32 |
|
23 | 33 |
/** |
24 |
- * @author 하석형 |
|
25 |
- * @since 2024.05.13 |
|
34 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
35 |
+ * @return Map<String, Object> |
|
36 |
+ * - list : 게시판 유형 관리 정보를 담고 있는 객체 목록 |
|
37 |
+ * |
|
26 | 38 |
* 게시판 유형 관리 목록 조회 |
27 | 39 |
*/ |
28 |
- public Map<String, Object> findAllBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) throws Exception; |
|
40 |
+ public Map<String, Object> findAllBbsTypeMng(BbsTypeMngVO bbsTypeMngVO); |
|
29 | 41 |
|
30 | 42 |
/** |
31 |
- * @author 하석형 |
|
32 |
- * @since 2024.05.13 |
|
43 |
+ * @param bbsTypeId - 게시판 유형 아이디 |
|
44 |
+ * @return BbsTypeMngVO - 게시판 유형 관리 정보를 담고 있는 객체 |
|
45 |
+ * |
|
33 | 46 |
* 게시판 유형 관리 상세 조회 |
34 | 47 |
*/ |
35 |
- public BbsTypeMngVO findByBbsTypeId(String bbsTypeId) throws Exception; |
|
48 |
+ public BbsTypeMngVO findByBbsTypeId(String bbsTypeId); |
|
36 | 49 |
} |
--- src/main/java/com/takensoft/cms/bbs/service/CmntService.java
+++ src/main/java/com/takensoft/cms/bbs/service/CmntService.java
... | ... | @@ -1,23 +1,54 @@ |
1 | 1 |
package com.takensoft.cms.bbs.service; |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.bbs.vo.CmntVO; |
4 |
+import com.takensoft.common.exception.*; |
|
5 |
+import org.springframework.dao.DataAccessException; |
|
4 | 6 |
|
5 | 7 |
import java.util.HashMap; |
6 | 8 |
import java.util.List; |
7 | 9 |
|
8 | 10 |
/** |
9 |
- * @author : 방선주 |
|
10 |
- * @since : 2024.05.27 |
|
11 |
+ * @author 방선주 |
|
12 |
+ * @since 2024.05.27 |
|
13 |
+ * @modification |
|
14 |
+ * since | author | description |
|
15 |
+ * 2024.05.27 | 방선주 | 최초 등록 |
|
16 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
11 | 17 |
* |
12 |
- * 게시판 댓글 관련 Service |
|
18 |
+ * 게시판 댓글 관련 인터페이스 |
|
13 | 19 |
*/ |
14 | 20 |
public interface CmntService { |
15 |
- // 댓글 등록 |
|
16 |
- public HashMap<String, Object> saveCmnt(CmntVO cmntVO) throws Exception; |
|
17 |
- // 댓글 목록 조회 |
|
18 |
- public List<CmntVO> findCmntList(String bbsId) throws Exception; |
|
19 |
- // 댓글 업데이트 |
|
20 |
- public HashMap<String, Object> updateCmnt(CmntVO cmntVO) throws Exception; |
|
21 |
+ /** |
|
22 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
23 |
+ * @return HashMap<String, Object> |
|
24 |
+ * - result : 게시판 댓글 등록 결과 |
|
25 |
+ * |
|
26 |
+ * 게시판 댓글 등록 |
|
27 |
+ */ |
|
28 |
+ public HashMap<String, Object> saveCmnt(CmntVO cmntVO); |
|
21 | 29 |
|
22 |
- public int deleteCmnt(CmntVO cmntVO) throws Exception; |
|
30 |
+ /** |
|
31 |
+ * @param bbsId - 게시판 아이디 |
|
32 |
+ * @return List<CmntVO> - 게시판 댓글 목록 |
|
33 |
+ * |
|
34 |
+ * 게시판 댓글 목록 조회 |
|
35 |
+ */ |
|
36 |
+ public List<CmntVO> findCmntList(String bbsId); |
|
37 |
+ |
|
38 |
+ /** |
|
39 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
40 |
+ * @return HashMap<String, Object> |
|
41 |
+ * - result : 게시판 댓글 수정 결과 |
|
42 |
+ * |
|
43 |
+ * 게시판 댓글 수정 |
|
44 |
+ */ |
|
45 |
+ public HashMap<String, Object> updateCmnt(CmntVO cmntVO); |
|
46 |
+ |
|
47 |
+ /** |
|
48 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
49 |
+ * @return int - 게시판 댓글 삭제 결과 |
|
50 |
+ * |
|
51 |
+ * 게시판 댓글 삭제 |
|
52 |
+ */ |
|
53 |
+ public int deleteCmnt(CmntVO cmntVO); |
|
23 | 54 |
} |
--- src/main/java/com/takensoft/cms/bbs/service/Impl/BbsTypeMngServiceImpl.java
+++ src/main/java/com/takensoft/cms/bbs/service/Impl/BbsTypeMngServiceImpl.java
... | ... | @@ -3,23 +3,34 @@ |
3 | 3 |
import com.takensoft.cms.bbs.dao.BbsTypeMngDAO; |
4 | 4 |
import com.takensoft.cms.bbs.service.BbsTypeMngService; |
5 | 5 |
import com.takensoft.cms.bbs.vo.BbsTypeMngVO; |
6 |
+import com.takensoft.common.exception.CustomDataDuplicationException; |
|
7 |
+import com.takensoft.common.exception.CustomInsertFailException; |
|
8 |
+import com.takensoft.common.exception.CustomNotFoundException; |
|
6 | 9 |
import com.takensoft.common.idgen.service.IdgenService; |
7 | 10 |
import com.takensoft.common.util.JWTUtil; |
8 | 11 |
import lombok.RequiredArgsConstructor; |
9 | 12 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
13 |
+import org.springframework.dao.DataAccessException; |
|
10 | 14 |
import org.springframework.stereotype.Service; |
15 |
+import org.springframework.transaction.annotation.Transactional; |
|
11 | 16 |
|
12 | 17 |
import java.util.HashMap; |
13 | 18 |
import java.util.List; |
14 | 19 |
import java.util.Map; |
15 | 20 |
|
16 | 21 |
/** |
17 |
- * @author : 박정하 |
|
18 |
- * @since : 2024.05.08 |
|
22 |
+ * @author 박정하 |
|
23 |
+ * @since 2024.05.08 |
|
24 |
+ * @modification |
|
25 |
+ * since | author | description |
|
26 |
+ * 2024.05.08 | 박정하 | 최초 등록 |
|
27 |
+ * 2024.05.13 | 하석형 | findAllBbsTypeMng, findByBbsTypeId 추가 |
|
28 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
19 | 29 |
* |
20 |
- * 게시판 유형 관리 관련 구현체 |
|
21 | 30 |
* EgovAbstractServiceImpl : 전자정부 상속 |
22 |
- * BbsTypeMngService : 게시판 유형 관리 인터페이스 상속 |
|
31 |
+ * BbsTypeMngService : 게시판 유형 관리 관련 인터페이스 상속 |
|
32 |
+ * |
|
33 |
+ * 게시판 유형 관리 관련 인터페이스 구현체 |
|
23 | 34 |
*/ |
24 | 35 |
@Service("bbsTypeMngService") |
25 | 36 |
@RequiredArgsConstructor |
... | ... | @@ -29,48 +40,89 @@ |
29 | 40 |
private final JWTUtil jwtUtil; |
30 | 41 |
|
31 | 42 |
/** |
32 |
- * @author 박정하 |
|
33 |
- * @since 2024.05.08 |
|
43 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
44 |
+ * @return HashMap<String, Object> |
|
45 |
+ * - bbsTypeMngId : 게시판 유형 관리 아이디 |
|
46 |
+ * - result : 게시판 유형 관리 등록 결과 |
|
47 |
+ * @throws CustomInsertFailException - 게시판 유형 관리 등록 실패 시 |
|
48 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
49 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
50 |
+ * |
|
34 | 51 |
* 게시판 유형 관리 등록 |
35 | 52 |
*/ |
36 |
- public HashMap<String, Object> insertBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) throws Exception { |
|
37 |
- HashMap<String, Object> result = new HashMap<>(); |
|
53 |
+ @Override |
|
54 |
+ @Transactional(rollbackFor = Exception.class) |
|
55 |
+ public HashMap<String, Object> insertBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) { |
|
56 |
+ try { |
|
57 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
38 | 58 |
|
39 |
- // 게시판 유형 아이디 생성 |
|
40 |
- String bbsTypeMngId = bbsTypeIdgn.getNextStringId(); |
|
41 |
- bbsTypeMngVO.setBbsTypeId(bbsTypeMngId); |
|
59 |
+ // 게시판 유형 아이디 생성 |
|
60 |
+ String bbsTypeMngId = bbsTypeIdgn.getNextStringId(); |
|
61 |
+ bbsTypeMngVO.setBbsTypeId(bbsTypeMngId); |
|
42 | 62 |
|
43 |
- // 등록된 토큰에서 사용자 정보 조회 |
|
44 |
- String writer = jwtUtil.getWriter(); |
|
45 |
- bbsTypeMngVO.setRgtr(writer); |
|
63 |
+ // 등록된 토큰에서 사용자 정보 조회 |
|
64 |
+ String writer = jwtUtil.getWriter(); |
|
65 |
+ if (writer == null || writer.isEmpty()) { |
|
66 |
+ throw new CustomNotFoundException("사용자 정보 조회에 실패했습니다."); |
|
67 |
+ } |
|
68 |
+ bbsTypeMngVO.setRgtr(writer); |
|
46 | 69 |
|
47 |
- // 게시판 관리 등록 |
|
48 |
- int insertResult = bbsTypeMngDAO.insertBbsTypeMng(bbsTypeMngVO); |
|
70 |
+ // 게시판 관리 등록 |
|
71 |
+ int insertResult = bbsTypeMngDAO.insertBbsTypeMng(bbsTypeMngVO); |
|
72 |
+ if(insertResult == 0) { |
|
73 |
+ throw new CustomInsertFailException("게시판 유형 관리 등록에 실패했습니다."); |
|
74 |
+ } |
|
49 | 75 |
|
50 |
- result.put("bbsTypeMngId", bbsTypeMngId); |
|
51 |
- result.put("result", insertResult); |
|
52 |
- return result; |
|
76 |
+ result.put("bbsTypeMngId", bbsTypeMngId); |
|
77 |
+ result.put("result", insertResult); |
|
78 |
+ return result; |
|
79 |
+ } catch (DataAccessException dae) { |
|
80 |
+ throw dae; |
|
81 |
+ } catch (Exception e) { |
|
82 |
+ throw e; |
|
83 |
+ } |
|
53 | 84 |
} |
54 | 85 |
|
55 | 86 |
/** |
56 |
- * @author 하석형 |
|
57 |
- * @since 2024.05.13 |
|
87 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
88 |
+ * @return Map<String, Object> |
|
89 |
+ * - list : 게시판 유형 관리 정보를 담고 있는 객체 목록 |
|
90 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
91 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
92 |
+ * |
|
58 | 93 |
* 게시판 유형 관리 목록 조회 |
59 | 94 |
*/ |
60 |
- public Map<String, Object> findAllBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) throws Exception { |
|
61 |
- Map<String, Object> result = new HashMap<>(); |
|
95 |
+ @Override |
|
96 |
+ public Map<String, Object> findAllBbsTypeMng(BbsTypeMngVO bbsTypeMngVO) { |
|
97 |
+ try { |
|
98 |
+ Map<String, Object> result = new HashMap<>(); |
|
62 | 99 |
|
63 |
- List<BbsTypeMngVO> list = bbsTypeMngDAO.findAll(bbsTypeMngVO); |
|
64 |
- result.put("list", list); |
|
65 |
- return result; |
|
100 |
+ List<BbsTypeMngVO> list = bbsTypeMngDAO.findAll(bbsTypeMngVO); |
|
101 |
+ result.put("list", list); |
|
102 |
+ return result; |
|
103 |
+ } catch (DataAccessException dae) { |
|
104 |
+ throw dae; |
|
105 |
+ } catch (Exception e) { |
|
106 |
+ throw e; |
|
107 |
+ } |
|
66 | 108 |
} |
67 | 109 |
|
68 | 110 |
/** |
69 |
- * @author 하석형 |
|
70 |
- * @since 2024.05.13 |
|
111 |
+ * @param bbsTypeId - 게시판 유형 아이디 |
|
112 |
+ * @return BbsTypeMngVO - 게시판 유형 관리 정보를 담고 있는 객체 |
|
113 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
114 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
115 |
+ * |
|
71 | 116 |
* 게시판 유형 관리 상세 조회 |
72 | 117 |
*/ |
73 |
- public BbsTypeMngVO findByBbsTypeId(String bbsTypeId) throws Exception { |
|
74 |
- return bbsTypeMngDAO.findByBbsTypeId(bbsTypeId); |
|
118 |
+ @Override |
|
119 |
+ public BbsTypeMngVO findByBbsTypeId(String bbsTypeId) { |
|
120 |
+ try { |
|
121 |
+ return bbsTypeMngDAO.findByBbsTypeId(bbsTypeId); |
|
122 |
+ } catch (DataAccessException dae) { |
|
123 |
+ throw dae; |
|
124 |
+ } catch (Exception e) { |
|
125 |
+ throw e; |
|
126 |
+ } |
|
75 | 127 |
} |
76 | 128 |
} |
--- src/main/java/com/takensoft/cms/bbs/service/Impl/CmntServiceImpl.java
+++ src/main/java/com/takensoft/cms/bbs/service/Impl/CmntServiceImpl.java
... | ... | @@ -4,10 +4,13 @@ |
4 | 4 |
import com.takensoft.cms.bbs.dao.WordMngDAO; |
5 | 5 |
import com.takensoft.cms.bbs.service.CmntService; |
6 | 6 |
import com.takensoft.cms.bbs.vo.CmntVO; |
7 |
+import com.takensoft.common.exception.*; |
|
7 | 8 |
import com.takensoft.common.util.JWTUtil; |
8 | 9 |
import lombok.RequiredArgsConstructor; |
9 | 10 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
11 |
+import org.springframework.dao.DataAccessException; |
|
10 | 12 |
import org.springframework.stereotype.Service; |
13 |
+import org.springframework.transaction.annotation.Transactional; |
|
11 | 14 |
|
12 | 15 |
import java.util.ArrayList; |
13 | 16 |
import java.util.HashMap; |
... | ... | @@ -15,12 +18,17 @@ |
15 | 18 |
import java.util.Map; |
16 | 19 |
|
17 | 20 |
/** |
18 |
- * @author : 방선주 |
|
19 |
- * @since : 2024.05.27 |
|
21 |
+ * @author 방선주 |
|
22 |
+ * @since 2024.05.27 |
|
23 |
+ * @modification |
|
24 |
+ * since | author | description |
|
25 |
+ * 2024.05.27 | 방선주 | 최초 등록 |
|
26 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
20 | 27 |
* |
21 |
- * 게시판 댓글 관련 구현체 |
|
22 | 28 |
* EgovAbstractServiceImpl : 전자정부 상속 |
23 |
- * CmntService : 게시판 댓글 인터페이스 상속 |
|
29 |
+ * CmntService : 게시판 댓글 관련 인터페이스 상속 |
|
30 |
+ * |
|
31 |
+ * 게시판 댓글 관련 인터페이스 구현체 |
|
24 | 32 |
*/ |
25 | 33 |
@Service("cmntService") |
26 | 34 |
@RequiredArgsConstructor |
... | ... | @@ -31,62 +39,83 @@ |
31 | 39 |
private final WordMngDAO wordMngDAO; |
32 | 40 |
|
33 | 41 |
/** |
34 |
- * @author 방선주 |
|
35 |
- * @since 2024.05.27 |
|
42 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
43 |
+ * @return HashMap<String, Object> |
|
44 |
+ * - result : 게시판 댓글 등록 결과 |
|
45 |
+ * @throws CustomPrhibtWordException - 금지어 포함 예외 발생 시 |
|
46 |
+ * @throws CustomNotFoundException - 사용자 정보 조회 예외 발생 시 |
|
47 |
+ * @throws CustomInsertFailException - 게시판 댓글 등록 예외 발생 시 |
|
48 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
49 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
36 | 50 |
* |
37 | 51 |
* 게시판 댓글 등록 |
38 | 52 |
*/ |
39 |
- public HashMap<String, Object> saveCmnt(CmntVO cmntVO) throws Exception { |
|
40 |
- HashMap<String, Object> result = new HashMap<>(); |
|
41 |
- List<String> wordList = wordMngDAO.findWordList(); |
|
53 |
+ @Override |
|
54 |
+ @Transactional(rollbackFor = Exception.class) |
|
55 |
+ public HashMap<String, Object> saveCmnt(CmntVO cmntVO) { |
|
56 |
+ try { |
|
57 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
58 |
+ List<String> wordList = wordMngDAO.findWordList(); |
|
42 | 59 |
|
43 |
- // 내용에 금지어가 포함되어있는가? |
|
44 |
- String content = cmntVO.getCmntCn(); |
|
45 |
- for (String word : wordList) { |
|
46 |
- if (content.contains(word)) { |
|
47 |
- result.put("result", -1); |
|
48 |
- result.put("word", word); |
|
49 |
- return result; |
|
60 |
+ // 내용에 금지어가 포함되어있는가? |
|
61 |
+ String content = cmntVO.getCmntCn(); |
|
62 |
+ for (String word : wordList) { |
|
63 |
+ if (content.contains(word)) { |
|
64 |
+ throw new CustomPrhibtWordException("내용에 금지어가 포함되어있습니다.", word); |
|
65 |
+ } |
|
50 | 66 |
} |
51 |
- } |
|
52 | 67 |
|
53 |
- // 등록된 토큰에서 사용자 정보 조회 |
|
54 |
- String writer = jwtUtil.getWriter(); |
|
55 |
- if(writer == null) { |
|
56 |
- result.put("result", -2); |
|
68 |
+ // 등록된 토큰에서 사용자 정보 조회 |
|
69 |
+ String writer = jwtUtil.getWriter(); |
|
70 |
+ if (writer == null || writer.isEmpty()) { |
|
71 |
+ throw new CustomNotFoundException("사용자 정보 조회에 실패했습니다."); |
|
72 |
+ } |
|
73 |
+ cmntVO.setRgtr(writer); |
|
74 |
+ |
|
75 |
+ // 댓글 깊이 |
|
76 |
+ // 부모의 깊이 가져와 +1 |
|
77 |
+ |
|
78 |
+ if (cmntVO.getUpCmntId() != 0) { |
|
79 |
+ CmntVO parentCmnt = cmntDAO.findParentCmnt(cmntVO.getUpCmntId()); |
|
80 |
+ cmntVO.setCmntGrd(parentCmnt.getCmntGrd() + 1); |
|
81 |
+ } |
|
82 |
+ |
|
83 |
+ // 댓글 순서 |
|
84 |
+ int count = cmntDAO.getCmntCount(cmntVO); |
|
85 |
+ cmntVO.setCmntSn(count + 1); |
|
86 |
+ |
|
87 |
+ int saveResult = cmntDAO.saveCmnt(cmntVO); |
|
88 |
+ if (saveResult == 0) { |
|
89 |
+ throw new CustomInsertFailException("게시판 댓글 등록에 실패했습니다."); |
|
90 |
+ } |
|
91 |
+ result.put("result", saveResult); |
|
92 |
+ |
|
57 | 93 |
return result; |
94 |
+ } catch (DataAccessException dae) { |
|
95 |
+ throw dae; |
|
96 |
+ } catch (Exception e) { |
|
97 |
+ throw e; |
|
58 | 98 |
} |
59 |
- |
|
60 |
- cmntVO.setRgtr(writer); |
|
61 |
- |
|
62 |
- // 댓글 깊이 |
|
63 |
- // 부모의 깊이 가져와 +1 |
|
64 |
- |
|
65 |
- if (cmntVO.getUpCmntId() != 0) { |
|
66 |
- CmntVO parentCmnt = cmntDAO.findParentCmnt(cmntVO.getUpCmntId()); |
|
67 |
- cmntVO.setCmntGrd(parentCmnt.getCmntGrd() + 1); |
|
68 |
- } |
|
69 |
- |
|
70 |
- // 댓글 순서 |
|
71 |
- int count = cmntDAO.getCmntCount(cmntVO); |
|
72 |
- cmntVO.setCmntSn(count + 1); |
|
73 |
- |
|
74 |
- |
|
75 |
- result.put("result", cmntDAO.saveCmnt(cmntVO)); |
|
76 |
- |
|
77 |
- return result; |
|
78 | 99 |
} |
79 | 100 |
|
80 | 101 |
/** |
81 |
- * @author 방선주 |
|
82 |
- * @since 2024.05.27 |
|
102 |
+ * @param bbsId - 게시판 아이디 |
|
103 |
+ * @return List<CmntVO> - 게시판 댓글 목록 |
|
104 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
105 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
83 | 106 |
* |
84 | 107 |
* 게시판 댓글 목록 조회 |
85 | 108 |
*/ |
86 |
- public List<CmntVO> findCmntList(String bbsId) throws Exception { |
|
87 |
- |
|
88 |
- List<CmntVO> flatCommentList = cmntDAO.findCmntList(bbsId); |
|
89 |
- return buildCommentTree(flatCommentList); |
|
109 |
+ @Override |
|
110 |
+ public List<CmntVO> findCmntList(String bbsId) { |
|
111 |
+ try { |
|
112 |
+ List<CmntVO> flatCommentList = cmntDAO.findCmntList(bbsId); |
|
113 |
+ return buildCommentTree(flatCommentList); |
|
114 |
+ } catch (DataAccessException dae) { |
|
115 |
+ throw dae; |
|
116 |
+ } catch (Exception e) { |
|
117 |
+ throw e; |
|
118 |
+ } |
|
90 | 119 |
} |
91 | 120 |
|
92 | 121 |
private List<CmntVO> buildCommentTree(List<CmntVO> comments) { |
... | ... | @@ -111,49 +140,88 @@ |
111 | 140 |
|
112 | 141 |
return rootComments; // 최상위 댓글 리스트 반환 |
113 | 142 |
} |
143 |
+ |
|
114 | 144 |
/** |
115 |
- * @author 방선주 |
|
116 |
- * @since 2024.05.27 |
|
145 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
146 |
+ * @return HashMap<String, Object> |
|
147 |
+ * - result : 게시판 댓글 수정 결과 |
|
148 |
+ * @throws CustomPrhibtWordException - 금지어 포함 예외 발생 시 |
|
149 |
+ * @throws CustomNotFoundException - 사용자 정보 조회 예외 발생 시 |
|
150 |
+ * @throws CustomUpdateFailException - 게시판 댓글 수정 예외 발생 시 |
|
151 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
152 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
117 | 153 |
* |
118 |
- * 게시판 댓글 업데이트 |
|
154 |
+ * 게시판 댓글 수정 |
|
119 | 155 |
*/ |
120 |
- public HashMap<String, Object> updateCmnt(CmntVO cmntVO) throws Exception { |
|
121 |
- HashMap<String, Object> result = new HashMap<>(); |
|
122 |
- List<String> wordList = wordMngDAO.findWordList(); |
|
156 |
+ @Override |
|
157 |
+ @Transactional(rollbackFor = Exception.class) |
|
158 |
+ public HashMap<String, Object> updateCmnt(CmntVO cmntVO) { |
|
159 |
+ try { |
|
160 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
161 |
+ List<String> wordList = wordMngDAO.findWordList(); |
|
123 | 162 |
|
124 |
- // 내용에 금지어가 포함되어있는가? |
|
125 |
- String content = cmntVO.getCmntCn(); |
|
126 |
- for (String word : wordList) { |
|
127 |
- if (content.contains(word)) { |
|
128 |
- result.put("result", -1); |
|
129 |
- result.put("word", word); |
|
130 |
- return result; |
|
163 |
+ // 내용에 금지어가 포함되어있는가? |
|
164 |
+ String content = cmntVO.getCmntCn(); |
|
165 |
+ for (String word : wordList) { |
|
166 |
+ if (content.contains(word)) { |
|
167 |
+ throw new CustomPrhibtWordException("내용에 금지어가 포함되어있습니다.", word); |
|
168 |
+ } |
|
131 | 169 |
} |
170 |
+ |
|
171 |
+ // 등록된 토큰에서 사용자 정보 조회 |
|
172 |
+ String writer = jwtUtil.getWriter(); |
|
173 |
+ if (writer == null || writer.isEmpty()) { |
|
174 |
+ throw new CustomNotFoundException("사용자 정보 조회에 실패했습니다."); |
|
175 |
+ } |
|
176 |
+ cmntVO.setMdfr(writer); |
|
177 |
+ |
|
178 |
+ int updateResult = cmntDAO.updateCmnt(cmntVO); |
|
179 |
+ if (updateResult == 0) { |
|
180 |
+ throw new CustomUpdateFailException("게시판 댓글 수정에 실패했습니다."); |
|
181 |
+ } |
|
182 |
+ result.put("result", updateResult); |
|
183 |
+ |
|
184 |
+ return result; |
|
185 |
+ } catch (DataAccessException dae) { |
|
186 |
+ throw dae; |
|
187 |
+ } catch (Exception e) { |
|
188 |
+ throw e; |
|
132 | 189 |
} |
133 |
- |
|
134 |
- // 등록된 토큰에서 사용자 정보 조회 |
|
135 |
- String writer = jwtUtil.getWriter(); |
|
136 |
- cmntVO.setMdfr(writer); |
|
137 |
- |
|
138 |
- result.put("result", cmntDAO.updateCmnt(cmntVO)); |
|
139 |
- |
|
140 |
- return result; |
|
141 | 190 |
} |
142 | 191 |
|
143 | 192 |
/** |
144 |
- * @author 방선주 |
|
145 |
- * @since 2024.05.27 |
|
193 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
194 |
+ * @return int - 게시판 댓글 삭제 결과 |
|
195 |
+ * @throws CustomNotFoundException - 사용자 정보 조회 예외 발생 시 |
|
196 |
+ * @throws CustomDeleteFailException - 게시판 댓글 삭제 예외 발생 시 |
|
197 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
198 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
146 | 199 |
* |
147 | 200 |
* 게시판 댓글 삭제 |
148 | 201 |
*/ |
149 |
- public int deleteCmnt(CmntVO cmntVO) throws Exception { |
|
202 |
+ @Override |
|
203 |
+ @Transactional(rollbackFor = Exception.class) |
|
204 |
+ public int deleteCmnt(CmntVO cmntVO) { |
|
205 |
+ try { |
|
206 |
+ // 등록된 토큰에서 사용자 정보 조회 |
|
207 |
+ String writer = jwtUtil.getWriter(); |
|
208 |
+ if (writer == null || writer.isEmpty()) { |
|
209 |
+ throw new CustomNotFoundException("사용자 정보 조회에 실패했습니다."); |
|
210 |
+ } |
|
211 |
+ cmntVO.setMdfr(writer); |
|
150 | 212 |
|
151 |
- // 등록된 토큰에서 사용자 정보 조회 |
|
152 |
- String writer = jwtUtil.getWriter(); |
|
153 |
- cmntVO.setMdfr(writer); |
|
213 |
+ cmntVO.setUseYn("N"); |
|
154 | 214 |
|
155 |
- cmntVO.setUseYn("N"); |
|
215 |
+ int result = cmntDAO.deleteCmnt(cmntVO); |
|
216 |
+ if (result == 0) { |
|
217 |
+ throw new CustomDeleteFailException("게시판 댓글 삭제에 실패했습니다."); |
|
218 |
+ } |
|
156 | 219 |
|
157 |
- return cmntDAO.deleteCmnt(cmntVO); |
|
220 |
+ return result; |
|
221 |
+ } catch (DataAccessException dae) { |
|
222 |
+ throw dae; |
|
223 |
+ } catch (Exception e) { |
|
224 |
+ throw e; |
|
225 |
+ } |
|
158 | 226 |
} |
159 | 227 |
} |
--- src/main/java/com/takensoft/cms/bbs/service/Impl/WordMngServiceImpl.java
+++ src/main/java/com/takensoft/cms/bbs/service/Impl/WordMngServiceImpl.java
... | ... | @@ -4,14 +4,29 @@ |
4 | 4 |
import com.takensoft.cms.bbs.service.WordMngService; |
5 | 5 |
import com.takensoft.cms.bbs.vo.WordMngVO; |
6 | 6 |
import com.takensoft.common.Pagination; |
7 |
+import com.takensoft.common.exception.*; |
|
7 | 8 |
import com.takensoft.common.util.JWTUtil; |
8 | 9 |
import lombok.RequiredArgsConstructor; |
9 | 10 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
11 |
+import org.springframework.dao.DataAccessException; |
|
10 | 12 |
import org.springframework.stereotype.Service; |
11 | 13 |
|
12 | 14 |
import java.util.HashMap; |
13 | 15 |
import java.util.List; |
14 | 16 |
|
17 |
+/** |
|
18 |
+ * @author 방선주 |
|
19 |
+ * @since 2024.05.31 |
|
20 |
+ * @modification |
|
21 |
+ * since | author | description |
|
22 |
+ * 2024.05.31 | 방선주 | 최초 등록 |
|
23 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
24 |
+ * |
|
25 |
+ * EgovAbstractServiceImpl : 전자정부 상속 |
|
26 |
+ * WordMngService : 금지어 관련 인터페이스 상속 |
|
27 |
+ * |
|
28 |
+ * 금지어 관련 인터페이스 구현체 |
|
29 |
+ */ |
|
15 | 30 |
@Service("WordMngService") |
16 | 31 |
@RequiredArgsConstructor |
17 | 32 |
public class WordMngServiceImpl extends EgovAbstractServiceImpl implements WordMngService { |
... | ... | @@ -20,64 +35,104 @@ |
20 | 35 |
private final JWTUtil jwtUtil; |
21 | 36 |
|
22 | 37 |
/** |
23 |
- * @author 방선주 |
|
24 |
- * @since 2024.05.31 |
|
38 |
+ * @param wordList - 금지어 목록 정보 |
|
39 |
+ * @return int - 금지어 등록 결과 |
|
40 |
+ * @throws CustomNotFoundException - 사용자 정보 조회 예외 발생 시 |
|
41 |
+ * @throws CustomInsertFailException - 금지어 등록 예외 발생 시 |
|
42 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
43 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
25 | 44 |
* |
26 |
- * 금지어 추가 |
|
45 |
+ * 금지어 등록 |
|
27 | 46 |
*/ |
28 | 47 |
@Override |
29 |
- public int saveWords(HashMap<String, Object> wordList) throws Exception { |
|
30 |
- // 등록된 토큰에서 사용자 정보 조회 |
|
31 |
- String writer = jwtUtil.getWriter(); |
|
48 |
+ public int saveWords(HashMap<String, Object> wordList) { |
|
49 |
+ try { |
|
50 |
+ // 등록된 토큰에서 사용자 정보 조회 |
|
51 |
+ String writer = jwtUtil.getWriter(); |
|
52 |
+ if (writer == null || writer.isEmpty()) { |
|
53 |
+ throw new CustomNotFoundException("사용자 정보 조회에 실패했습니다."); |
|
54 |
+ } |
|
32 | 55 |
|
33 |
- List<String> wordsArr = (List<String>) wordList.get("wordsArr"); |
|
34 |
- // 금지어 등록 |
|
35 |
- for (String word : wordsArr){ |
|
36 |
- WordMngVO wordMngVO = new WordMngVO(); |
|
37 |
- wordMngVO.setCntrlNm(word); |
|
38 |
- wordMngVO.setRgtr(writer); |
|
39 |
- wordMngDAO.saveWords(wordMngVO); |
|
56 |
+ List<String> wordsArr = (List<String>) wordList.get("wordsArr"); |
|
57 |
+ // 금지어 등록 |
|
58 |
+ for (String word : wordsArr) { |
|
59 |
+ WordMngVO wordMngVO = new WordMngVO(); |
|
60 |
+ wordMngVO.setCntrlNm(word); |
|
61 |
+ wordMngVO.setRgtr(writer); |
|
62 |
+ int result = wordMngDAO.saveWords(wordMngVO); |
|
63 |
+ if(result == 0){ |
|
64 |
+ throw new CustomInsertFailException("금지어 등록에 실패했습니다."); |
|
65 |
+ } |
|
66 |
+ } |
|
67 |
+ |
|
68 |
+ return wordList.size(); |
|
69 |
+ } catch (DataAccessException dae) { |
|
70 |
+ throw dae; |
|
71 |
+ } catch (Exception e) { |
|
72 |
+ throw e; |
|
40 | 73 |
} |
41 |
- |
|
42 |
- return wordList.size(); |
|
43 | 74 |
} |
44 | 75 |
|
45 | 76 |
/** |
46 |
- * @author 방선주 |
|
47 |
- * @since 2024.05.31 |
|
77 |
+ * @param params - 금지어 정보 |
|
78 |
+ * @return HashMap<String, Object> |
|
79 |
+ * - wordList : 금지어 목록 |
|
80 |
+ * - pagination : 페이징 정보 |
|
81 |
+ * - wordsCnt : 금지어 개수 |
|
82 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
83 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
48 | 84 |
* |
49 | 85 |
* 금지어 목록 조회 |
50 | 86 |
*/ |
51 | 87 |
@Override |
52 |
- public HashMap<String, Object> findAllWord(HashMap<String, String> params) throws Exception { |
|
53 |
- HashMap<String, Object> result = new HashMap<>(); |
|
88 |
+ public HashMap<String, Object> findAllWord(HashMap<String, String> params) { |
|
89 |
+ try { |
|
90 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
54 | 91 |
|
55 |
- Pagination search = new Pagination(0, params); |
|
56 |
- int cnt = wordMngDAO.findAllCnt(search); |
|
57 |
- Pagination pagination = new Pagination(cnt, params); |
|
58 |
- List<WordMngVO> wordList = wordMngDAO.findAllWord(pagination); |
|
92 |
+ Pagination search = new Pagination(0, params); |
|
93 |
+ int cnt = wordMngDAO.findAllCnt(search); |
|
94 |
+ Pagination pagination = new Pagination(cnt, params); |
|
95 |
+ List<WordMngVO> wordList = wordMngDAO.findAllWord(pagination); |
|
59 | 96 |
|
60 |
- result.put("wordList", wordList); |
|
61 |
- result.put("pagination", pagination); |
|
62 |
- result.put("wordsCnt", cnt); |
|
97 |
+ result.put("wordList", wordList); |
|
98 |
+ result.put("pagination", pagination); |
|
99 |
+ result.put("wordsCnt", cnt); |
|
63 | 100 |
|
64 |
- return result; |
|
101 |
+ return result; |
|
102 |
+ } catch (DataAccessException dae) { |
|
103 |
+ throw dae; |
|
104 |
+ } catch (Exception e) { |
|
105 |
+ throw e; |
|
106 |
+ } |
|
65 | 107 |
} |
108 |
+ |
|
66 | 109 |
/** |
67 |
- * @author 방선주 |
|
68 |
- * @since 2024.05.31 |
|
110 |
+ * @param params - 금지어 정보 |
|
111 |
+ * @return int - 금지어 삭제 결과 |
|
112 |
+ * @throws CustomDeleteFailException - 금지어 삭제 예외 발생 시 |
|
113 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
114 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
69 | 115 |
* |
70 | 116 |
* 금지어 삭제 |
71 | 117 |
*/ |
72 | 118 |
@Override |
73 |
- public int deleteWords(HashMap<String, Object> params) throws Exception { |
|
74 |
- List<Integer> wordsArr = (List<Integer>) params.get("wordsArr"); |
|
119 |
+ public int deleteWords(HashMap<String, Object> params) { |
|
120 |
+ try { |
|
121 |
+ List<Integer> wordsArr = (List<Integer>) params.get("wordsArr"); |
|
75 | 122 |
|
76 |
- // 금지어 id로 삭제 |
|
77 |
- for (int cntrlNmId : wordsArr){ |
|
78 |
- wordMngDAO.deleteWords(cntrlNmId); |
|
123 |
+ // 금지어 id로 삭제 |
|
124 |
+ for (int cntrlNmId : wordsArr) { |
|
125 |
+ int result = wordMngDAO.deleteWords(cntrlNmId); |
|
126 |
+ if(result == 0){ |
|
127 |
+ throw new CustomDeleteFailException("금지어 삭제에 실패했습니다."); |
|
128 |
+ } |
|
129 |
+ } |
|
130 |
+ |
|
131 |
+ return wordsArr.size(); |
|
132 |
+ } catch (DataAccessException dae) { |
|
133 |
+ throw dae; |
|
134 |
+ } catch (Exception e) { |
|
135 |
+ throw e; |
|
79 | 136 |
} |
80 |
- |
|
81 |
- return wordsArr.size(); |
|
82 | 137 |
} |
83 | 138 |
} |
--- src/main/java/com/takensoft/cms/bbs/service/WordMngService.java
+++ src/main/java/com/takensoft/cms/bbs/service/WordMngService.java
... | ... | @@ -1,18 +1,50 @@ |
1 | 1 |
package com.takensoft.cms.bbs.service; |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.bbs.vo.WordMngVO; |
4 |
+import com.takensoft.common.exception.CustomDeleteFailException; |
|
5 |
+import com.takensoft.common.exception.CustomInsertFailException; |
|
6 |
+import com.takensoft.common.exception.CustomNotFoundException; |
|
7 |
+import org.springframework.dao.DataAccessException; |
|
4 | 8 |
|
5 | 9 |
import java.util.HashMap; |
6 | 10 |
import java.util.List; |
7 | 11 |
import java.util.Map; |
8 | 12 |
|
13 |
+/** |
|
14 |
+ * @author 방선주 |
|
15 |
+ * @since 2024.05.31 |
|
16 |
+ * @modification |
|
17 |
+ * since | author | description |
|
18 |
+ * 2024.05.31 | 방선주 | 최초 등록 |
|
19 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
20 |
+ * |
|
21 |
+ * 금지어 관련 인터페이스 |
|
22 |
+ */ |
|
9 | 23 |
public interface WordMngService { |
10 |
- // 금지어 관리 등록 |
|
11 |
- public int saveWords(HashMap<String, Object> wordList) throws Exception; |
|
24 |
+ /** |
|
25 |
+ * @param wordList - 금지어 목록 정보 |
|
26 |
+ * @return int - 금지어 등록 결과 |
|
27 |
+ * |
|
28 |
+ * 금지어 등록 |
|
29 |
+ */ |
|
30 |
+ public int saveWords(HashMap<String, Object> wordList); |
|
12 | 31 |
|
13 |
- // 금지어 관리 목록 조회 |
|
14 |
- public HashMap<String, Object> findAllWord(HashMap<String, String> params) throws Exception; |
|
32 |
+ /** |
|
33 |
+ * @param params - 금지어 정보 |
|
34 |
+ * @return HashMap<String, Object> |
|
35 |
+ * - wordList : 금지어 목록 |
|
36 |
+ * - pagination : 페이징 정보 |
|
37 |
+ * - wordsCnt : 금지어 개수 |
|
38 |
+ * |
|
39 |
+ * 금지어 목록 조회 |
|
40 |
+ */ |
|
41 |
+ public HashMap<String, Object> findAllWord(HashMap<String, String> params); |
|
15 | 42 |
|
16 |
- // 금지어 관리 삭제 |
|
17 |
- public int deleteWords(HashMap<String, Object> params) throws Exception; |
|
43 |
+ /** |
|
44 |
+ * @param params - 금지어 정보 |
|
45 |
+ * @return int - 금지어 삭제 결과 |
|
46 |
+ * |
|
47 |
+ * 금지어 삭제 |
|
48 |
+ */ |
|
49 |
+ public int deleteWords(HashMap<String, Object> params); |
|
18 | 50 |
} |
--- src/main/java/com/takensoft/cms/bbs/vo/WordMngVO.java
+++ src/main/java/com/takensoft/cms/bbs/vo/WordMngVO.java
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 |
* 2024.05.31 | 방선주 | 최초 등록 |
12 | 12 |
* 2025.03.20 | 하석형 | 코드 리펙토링 |
13 | 13 |
* |
14 |
- * 금지단어 관련 VO |
|
14 |
+ * 금지어 관련 VO |
|
15 | 15 |
*/ |
16 | 16 |
@Setter |
17 | 17 |
@Getter |
--- src/main/java/com/takensoft/cms/bbs/web/BbsTypeMngController.java
+++ src/main/java/com/takensoft/cms/bbs/web/BbsTypeMngController.java
... | ... | @@ -17,12 +17,15 @@ |
17 | 17 |
|
18 | 18 |
import java.nio.charset.Charset; |
19 | 19 |
import java.util.*; |
20 |
+ |
|
20 | 21 |
/** |
21 | 22 |
* @author 박정하 |
22 | 23 |
* @since 2024.05.08 |
23 | 24 |
* @modification |
24 | 25 |
* since | author | description |
25 | 26 |
* 2024.05.08 | 박정하 | 최초 등록 |
27 |
+ * 2024.05.13 | 하석형 | findAll 추가 |
|
28 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
26 | 29 |
* |
27 | 30 |
* 게시판 유형 관리 관련 컨트롤러 |
28 | 31 |
*/ |
... | ... | @@ -35,37 +38,21 @@ |
35 | 38 |
private final BbsTypeMngService bbsTypeMngService; |
36 | 39 |
|
37 | 40 |
/** |
38 |
- * @author 박정하 |
|
39 |
- * @since 2024.05.08 |
|
40 |
- * @param bbsTypeMngVO |
|
41 |
- * @return |
|
42 |
- * @throws Exception |
|
41 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
42 |
+ * @return ResponseEntity - 게시판 유형 관리 등록 결과를 포함하는 응답 |
|
43 | 43 |
* |
44 | 44 |
* 게시판 유형 관리 등록 |
45 | 45 |
*/ |
46 | 46 |
@PostMapping("/insertBbsTypeMng.json") |
47 |
- public ResponseEntity<?> insertBbsTypeMng(@RequestBody BbsTypeMngVO bbsTypeMngVO) throws Exception { |
|
47 |
+ public ResponseEntity<?> insertBbsTypeMng(@RequestBody BbsTypeMngVO bbsTypeMngVO) { |
|
48 | 48 |
// 게시판 관리 등록 |
49 | 49 |
HashMap<String, Object> result = bbsTypeMngService.insertBbsTypeMng(bbsTypeMngVO); |
50 |
- int insertResult = (int) result.get("result"); |
|
51 |
- |
|
52 |
- // 응답 처리 |
|
53 |
- HttpHeaders headers = new HttpHeaders(); |
|
54 |
- headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8"))); |
|
55 |
- ResponseData responseData = new ResponseData(); |
|
56 |
- if(insertResult > 0) { |
|
57 |
- return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
58 |
- } else { |
|
59 |
- return resUtil.errorRes(MessageCode.COMMON_INSERT_FAIL); |
|
60 |
- } |
|
50 |
+ return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
61 | 51 |
} |
62 | 52 |
|
63 | 53 |
/** |
64 |
- * @author 하석형 |
|
65 |
- * @since 2024.05.13 |
|
66 |
- * @param bbsTypeMngVO |
|
67 |
- * @return |
|
68 |
- * @throws Exception |
|
54 |
+ * @param bbsTypeMngVO - 게시판 유형 관리 정보 |
|
55 |
+ * @return ResponseEntity - 게시판 유형 관리 목록 조회 결과를 포함하는 응답 |
|
69 | 56 |
* |
70 | 57 |
* 게시판 유형 관리 목록 조회 |
71 | 58 |
*/ |
... | ... | @@ -73,8 +60,6 @@ |
73 | 60 |
public ResponseEntity<?> findAll(@RequestBody BbsTypeMngVO bbsTypeMngVO) throws Exception{ |
74 | 61 |
// 게시판 유형 관리 목록 조회 |
75 | 62 |
Map<String, Object> result = bbsTypeMngService.findAllBbsTypeMng(bbsTypeMngVO); |
76 |
- |
|
77 |
- // 응답처리 |
|
78 | 63 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
79 | 64 |
} |
80 | 65 |
} |
--- src/main/java/com/takensoft/cms/bbs/web/CmntController.java
+++ src/main/java/com/takensoft/cms/bbs/web/CmntController.java
... | ... | @@ -20,14 +20,16 @@ |
20 | 20 |
import java.util.HashMap; |
21 | 21 |
import java.util.List; |
22 | 22 |
import java.util.Map; |
23 |
+ |
|
23 | 24 |
/** |
24 | 25 |
* @author 방선주 |
25 | 26 |
* @since 2024.05.27 |
26 | 27 |
* @modification |
27 | 28 |
* since | author | description |
28 | 29 |
* 2024.05.27 | 방선주 | 최초 등록 |
30 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
29 | 31 |
* |
30 |
- * 게시판 댓글 관련 Controller |
|
32 |
+ * 게시판 댓글 관련 컨트롤러 |
|
31 | 33 |
*/ |
32 | 34 |
@RestController |
33 | 35 |
@RequiredArgsConstructor |
... | ... | @@ -37,58 +39,30 @@ |
37 | 39 |
|
38 | 40 |
private final CmntService cmntService; |
39 | 41 |
private final ResponseUtil resUtil; |
42 |
+ |
|
40 | 43 |
/** |
41 |
- * @author 방선주 |
|
42 |
- * @since 2024.05.27 |
|
43 |
- * @param cmntVO |
|
44 |
- * @return |
|
45 |
- * @throws Exception |
|
44 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
45 |
+ * @return ResponseEntity - 게시판 댓글 등록 결과를 포함하는 응답 |
|
46 | 46 |
* |
47 |
- * 댓글 등록 |
|
47 |
+ * 게시판 댓글 등록 |
|
48 | 48 |
*/ |
49 | 49 |
@PostMapping("/saveProc.json") |
50 |
- public ResponseEntity<?> saveProc(@RequestBody CmntVO cmntVO) throws Exception { |
|
51 |
- // 응답 처리 |
|
52 |
- HttpHeaders headers = new HttpHeaders(); |
|
53 |
- headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8"))); |
|
54 |
- ResponseData responseData = new ResponseData(); |
|
55 |
- |
|
56 |
- // 댓글 등록 |
|
57 |
- |
|
50 |
+ public ResponseEntity<?> saveProc(@RequestBody CmntVO cmntVO) { |
|
51 |
+ // 게시판 댓글 등록 |
|
58 | 52 |
HashMap<String,Object> result = cmntService.saveCmnt(cmntVO); |
59 |
- |
|
60 |
- int insertResult = (int) result.get("result"); |
|
61 |
- |
|
62 |
- if(insertResult > 0) { |
|
63 |
- return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
64 |
- } else if (insertResult == -1) { |
|
65 |
- responseData.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
66 |
- responseData.setStatusText(HttpStatus.INTERNAL_SERVER_ERROR); |
|
67 |
- responseData.setMessage("아래의 금지어가 포함되어 있습니다.\n* " + result.get("word")); |
|
68 |
- return new ResponseEntity<>(responseData, headers, HttpStatus.INTERNAL_SERVER_ERROR); |
|
69 |
- } else if (insertResult == -2){ |
|
70 |
- responseData.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
71 |
- responseData.setStatusText(HttpStatus.INTERNAL_SERVER_ERROR); |
|
72 |
- responseData.setMessage("로그인 후 이용 가능합니다."); |
|
73 |
- return new ResponseEntity<>(responseData, headers, HttpStatus.INTERNAL_SERVER_ERROR); |
|
74 |
- } else { |
|
75 |
- return resUtil.errorRes(MessageCode.COMMON_INSERT_FAIL); |
|
76 |
- } |
|
53 |
+ return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
77 | 54 |
|
78 | 55 |
} |
79 | 56 |
|
80 | 57 |
/** |
81 |
- * @author 방선주 |
|
82 |
- * @since 2024.05.27 |
|
83 |
- * @param cmntVO |
|
84 |
- * @return |
|
85 |
- * @throws Exception |
|
58 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
59 |
+ * @return ResponseEntity - 게시판 댓글 목록 조회 결과를 포함하는 응답 |
|
86 | 60 |
* |
87 |
- * 댓글 목록 조회 |
|
61 |
+ * 게시판 댓글 목록 조회 |
|
88 | 62 |
*/ |
89 | 63 |
@PostMapping("/findCmntList.json") |
90 |
- public ResponseEntity<?> findCmntList(@RequestBody CmntVO cmntVO) throws Exception { |
|
91 |
- // 댓글 목록 조회 |
|
64 |
+ public ResponseEntity<?> findCmntList(@RequestBody CmntVO cmntVO) { |
|
65 |
+ // 게시판 댓글 목록 조회 |
|
92 | 66 |
List<CmntVO> cmntList = cmntService.findCmntList(cmntVO.getBbsId()); |
93 | 67 |
|
94 | 68 |
Map<String, Object> result = new HashMap<String, Object>(); |
... | ... | @@ -100,59 +74,28 @@ |
100 | 74 |
} |
101 | 75 |
|
102 | 76 |
/** |
103 |
- * @author 방선주 |
|
104 |
- * @since 2024.05.27 |
|
105 |
- * @param cmntVO |
|
106 |
- * @return |
|
107 |
- * @throws Exception |
|
77 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
78 |
+ * @return ResponseEntity - 게시판 댓글 수정 결과를 포함하는 응답 |
|
108 | 79 |
* |
109 |
- * 댓글 수정 |
|
80 |
+ * 게시판 댓글 수정 |
|
110 | 81 |
*/ |
111 | 82 |
@PostMapping("/updateProc.json") |
112 |
- public ResponseEntity<?> updateProc(@RequestBody CmntVO cmntVO) throws Exception { |
|
113 |
-// 응답 처리 |
|
114 |
- HttpHeaders headers = new HttpHeaders(); |
|
115 |
- headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8"))); |
|
116 |
- ResponseData responseData = new ResponseData(); |
|
117 |
- |
|
118 |
- // 댓글 수정 |
|
83 |
+ public ResponseEntity<?> updateProc(@RequestBody CmntVO cmntVO) { |
|
84 |
+ // 게시판 댓글 수정 |
|
119 | 85 |
HashMap<String, Object> result = cmntService.updateCmnt(cmntVO); |
120 |
- int updateResult = (int) result.get("result"); |
|
121 |
- |
|
122 |
- // 응답처리 |
|
123 |
- if(updateResult > 0) { |
|
124 |
- return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
125 |
- } else if (updateResult == -1){ |
|
126 |
- responseData.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); |
|
127 |
- responseData.setStatusText(HttpStatus.INTERNAL_SERVER_ERROR); |
|
128 |
- responseData.setMessage("아래의 금지어가 포함되어 있습니다.\n* " + result.get("word")); |
|
129 |
- return new ResponseEntity<>(responseData, headers, HttpStatus.INTERNAL_SERVER_ERROR); |
|
130 |
- } else { |
|
131 |
- return resUtil.errorRes(MessageCode.COMMON_UPDATE_FAIL); |
|
132 |
- } |
|
133 |
- |
|
86 |
+ return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
134 | 87 |
} |
88 |
+ |
|
135 | 89 |
/** |
136 |
- * @author 방선주 |
|
137 |
- * @since 2024.05.27 |
|
138 |
- * @param cmntVO |
|
139 |
- * @return |
|
140 |
- * @throws Exception |
|
90 |
+ * @param cmntVO - 게시판 댓글 정보 |
|
91 |
+ * @return ResponseEntity - 게시판 댓글 삭제 결과를 포함하는 응답 |
|
141 | 92 |
* |
142 |
- * 댓글 삭제 |
|
93 |
+ * 게시판 댓글 삭제 |
|
143 | 94 |
*/ |
144 | 95 |
@PostMapping("/deleteProc.json") |
145 |
- public ResponseEntity<?> deleteProc(@RequestBody CmntVO cmntVO) throws Exception { |
|
146 |
- |
|
147 |
- // 댓글 삭제 처리 (댓글 삭제는 업데이트로 처리 useYn = 'N') |
|
96 |
+ public ResponseEntity<?> deleteProc(@RequestBody CmntVO cmntVO) { |
|
97 |
+ // 게시판 댓글 삭제 처리 (댓글 삭제는 업데이트로 처리 useYn = 'N') |
|
148 | 98 |
int result = cmntService.deleteCmnt(cmntVO); |
149 |
- |
|
150 |
- // 응답처리 |
|
151 | 99 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
152 |
- |
|
153 | 100 |
} |
154 |
- |
|
155 |
- |
|
156 |
- |
|
157 |
- |
|
158 | 101 |
} |
--- src/main/java/com/takensoft/cms/bbs/web/WordMngController.java
+++ src/main/java/com/takensoft/cms/bbs/web/WordMngController.java
... | ... | @@ -20,14 +20,16 @@ |
20 | 20 |
import java.util.HashMap; |
21 | 21 |
import java.util.List; |
22 | 22 |
import java.util.Map; |
23 |
+ |
|
23 | 24 |
/** |
24 | 25 |
* @author 방선주 |
25 | 26 |
* @since 2024.05.31 |
26 | 27 |
* @modification |
27 | 28 |
* since | author | description |
28 | 29 |
* 2024.05.31 | 방선주 | 최초 등록 |
30 |
+ * 2025.03.21 | 하석형 | 코드 리펙토링 |
|
29 | 31 |
* |
30 |
- * 금지 단어 관리 Controller |
|
32 |
+ * 금지어 관련 컨트롤러 |
|
31 | 33 |
*/ |
32 | 34 |
@RestController |
33 | 35 |
@RequiredArgsConstructor |
... | ... | @@ -39,31 +41,29 @@ |
39 | 41 |
private final WordMngService wordMngService; |
40 | 42 |
|
41 | 43 |
/** |
42 |
- * @author 방선주 |
|
43 |
- * @since 2024.05.09 |
|
44 |
- * @param wordList |
|
45 |
- * @return |
|
46 |
- * @throws Exception |
|
44 |
+ * @param wordList - 금지어 목록 정보 |
|
45 |
+ * @return ResponseEntity - 금지어 등록 결과를 포함하는 응답 |
|
47 | 46 |
* |
48 |
- * 금지어 추가 |
|
47 |
+ * 금지어 등록 |
|
49 | 48 |
*/ |
50 | 49 |
@PostMapping("/saveProc.json") |
51 |
- public ResponseEntity<?> saveProc(@RequestBody HashMap<String, Object> wordList) throws Exception { |
|
50 |
+ public ResponseEntity<?> saveProc(@RequestBody HashMap<String, Object> wordList) { |
|
52 | 51 |
// 금지어 등록 |
53 | 52 |
int result = wordMngService.saveWords(wordList); |
54 |
- // 응답 처리 |
|
55 |
- if(result > 0) { |
|
56 |
- return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
57 |
- } else { |
|
58 |
- return resUtil.errorRes(MessageCode.COMMON_INSERT_FAIL); |
|
59 |
- } |
|
53 |
+ return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
60 | 54 |
} |
55 |
+ |
|
56 |
+ /** |
|
57 |
+ * @param params - 검색조건 및 페이징 정보 |
|
58 |
+ * @return ResponseEntity - 금지어 목록 조회 결과를 포함하는 응답 |
|
59 |
+ * |
|
60 |
+ * 금지어 목록 조회 |
|
61 |
+ */ |
|
61 | 62 |
@PostMapping("/findAll.json") |
62 |
- public ResponseEntity<?> findAll(@RequestBody HashMap<String, String> params) throws Exception { |
|
63 |
+ public ResponseEntity<?> findAll(@RequestBody HashMap<String, String> params) { |
|
63 | 64 |
// 금지어 목록 조회 |
64 | 65 |
Map<String, Object> result = new HashMap<>(); |
65 | 66 |
HashMap<String, Object> wordsList = wordMngService.findAllWord(params); |
66 |
- |
|
67 | 67 |
|
68 | 68 |
result.put("words", wordsList); |
69 | 69 |
|
... | ... | @@ -71,17 +71,16 @@ |
71 | 71 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
72 | 72 |
} |
73 | 73 |
|
74 |
+ /** |
|
75 |
+ * @param params - 금지어 정보 |
|
76 |
+ * @return ResponseEntity - 금지어 삭제 결과를 포함하는 응답 |
|
77 |
+ * |
|
78 |
+ * 금지어 삭제 |
|
79 |
+ */ |
|
74 | 80 |
@PostMapping("/deleteProc.json") |
75 |
- public ResponseEntity<?> deleteProc(@RequestBody HashMap<String, Object> params) throws Exception { |
|
76 |
- |
|
81 |
+ public ResponseEntity<?> deleteProc(@RequestBody HashMap<String, Object> params) { |
|
77 | 82 |
// 금지어 삭제 |
78 | 83 |
int result = wordMngService.deleteWords(params); |
79 |
- |
|
80 |
- // 응답 처리 |
|
81 |
- if(result > 0) { |
|
82 |
- return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
83 |
- } else { |
|
84 |
- return resUtil.errorRes(MessageCode.COMMON_DELETE_FAIL); |
|
85 |
- } |
|
84 |
+ return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
|
86 | 85 |
} |
87 | 86 |
} |
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?