From 6652345922bb40729a62b418c2cb415c15c0bbf4 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Mon, 21 Mar 2022 15:46:51 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/ctgy/controller/BoardController.java | 2 +- .../ctgy/controller/MinUserController.java | 19 +++++++++++-------- .../ctgy/controller/ParkingController.java | 2 +- .../controller/PublicBoardController.java | 13 +++++++++++-- .../repository/IPublicBoardRepository.java | 1 + .../xit/biz/ctgy/service/IMinUserService.java | 4 +++- .../biz/ctgy/service/IPublicBoardService.java | 1 + .../biz/ctgy/service/impl/MinUserService.java | 7 ++++++- .../ctgy/service/impl/PublicBoardService.java | 5 +++++ .../config/support/SpringDocApiConfig.java | 8 ++++---- .../IMinSimsa680RepositoryTest.java | 3 --- 11 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/xit/biz/ctgy/controller/BoardController.java b/src/main/java/com/xit/biz/ctgy/controller/BoardController.java index 421c384..372f1b6 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/BoardController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/BoardController.java @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -@Tag(name = "MinCivBoard680Controller", description = "게시글 관리") +@Tag(name = "BoardController", description = "게시글 관리") @RestController @RequestMapping("/api/v1/ctgy/board") @Validated diff --git a/src/main/java/com/xit/biz/ctgy/controller/MinUserController.java b/src/main/java/com/xit/biz/ctgy/controller/MinUserController.java index 8fa1767..c604d54 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/MinUserController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/MinUserController.java @@ -19,12 +19,9 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; -@Tag(name = "MinUserinfoController", description = "사용자 관리") +@Tag(name = "MinUserController", description = "사용자 관리") @RestController @RequestMapping("/api/v1/ctgy/user") @Validated @@ -44,7 +41,7 @@ public class MinUserController { @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") }) @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity findMinUserinfos( + public ResponseEntity findMinUsers( @Parameter(hidden = true) @ModelAttribute("minUserinfoDto") final MinUserinfoDto minUserinfoDto, @@ -57,8 +54,14 @@ public class MinUserController { @GetMapping("/info") @Secured(policy = SecurityPolicy.TOKEN) @Transactional(readOnly = true) - public ResponseEntity getUserInfo() { - return RestResponse.of(service.findMyUserWithoutAuthorities()); + public ResponseEntity getMinUser() { + return RestResponse.of(service.findMinUser()); } + @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회") + @GetMapping("/{userid}") + //@Transactional(readOnly = true) + public ResponseEntity getMinUser(@PathVariable String userid) { + return RestResponse.of(service.findMinUserByUserid(userid)); + } } diff --git a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java index eed12de..c303db8 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java @@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; -@Tag(name = "ParkingController", description = "주정차의견진술") +@Tag(name = "ParkingController", description = "주정차의견진술관리") @RestController @RequestMapping("/api/v1/ctgy/parking") @Validated diff --git a/src/main/java/com/xit/biz/ctgy/controller/PublicBoardController.java b/src/main/java/com/xit/biz/ctgy/controller/PublicBoardController.java index 1d91eb0..581a13f 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/PublicBoardController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/PublicBoardController.java @@ -17,10 +17,11 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -@Tag(name = "MinInfoBoard680Controller", description = "공지사항 관리") +@Tag(name = "PublicBoardController", description = "공지사항 관리") @RestController @RequestMapping("/api/v1/ctgy/pboard") @Validated @@ -40,7 +41,7 @@ public class PublicBoardController { @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") }) @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity findMinCivBoard680s( + public ResponseEntity findAll( @Parameter(hidden = true) final MinInfoBoard680Dto dto, @Parameter(hidden = true) @@ -48,4 +49,12 @@ public class PublicBoardController { return RestResponse.of(service.findAll(mapstruct.toEntity(dto), pageable)); } + @Operation(summary = "게시글상세" , description = "게시글상세") + @Parameters({ + @Parameter(in = ParameterIn.PATH, name = "inCode", description = "게시글번호", required = true, example = "18"), + }) + @GetMapping(value = "/{inCode}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity findByInCode(@PathVariable Long inCode) { + return RestResponse.of(service.findByInCode(inCode)); + } } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IPublicBoardRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IPublicBoardRepository.java index 07172dd..aea00c6 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IPublicBoardRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IPublicBoardRepository.java @@ -4,4 +4,5 @@ import com.xit.biz.ctgy.entity.MinInfoBoard680; import org.springframework.data.jpa.repository.JpaRepository; public interface IPublicBoardRepository extends JpaRepository { + MinInfoBoard680 findByInCode(Long inCode); } diff --git a/src/main/java/com/xit/biz/ctgy/service/IMinUserService.java b/src/main/java/com/xit/biz/ctgy/service/IMinUserService.java index 8c24f56..3ef31c8 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IMinUserService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IMinUserService.java @@ -11,5 +11,7 @@ public interface IMinUserService { Page findMinUsers(MinUserinfo minUserinfo, Pageable pageable); - MinUserinfo findMyUserWithoutAuthorities(); + MinUserinfo findMinUser(); + + MinUserinfo findMinUserByUserid(String userId); } diff --git a/src/main/java/com/xit/biz/ctgy/service/IPublicBoardService.java b/src/main/java/com/xit/biz/ctgy/service/IPublicBoardService.java index 47178d7..3f71687 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IPublicBoardService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IPublicBoardService.java @@ -7,4 +7,5 @@ import org.springframework.data.domain.Pageable; public interface IPublicBoardService { Page findAll(MinInfoBoard680 entity, Pageable pageable); + MinInfoBoard680 findByInCode(Long inCode); } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/MinUserService.java b/src/main/java/com/xit/biz/ctgy/service/impl/MinUserService.java index e7a31d6..60d880a 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/MinUserService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/MinUserService.java @@ -40,9 +40,14 @@ public class MinUserService implements IMinUserService { @Override @Transactional(readOnly = true) - public MinUserinfo findMyUserWithoutAuthorities() { + public MinUserinfo findMinUser() { //cmmUserRepos //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); return repository.findMinUserinfoByUserid(HeaderUtil.getUserId()); } + + @Override + public MinUserinfo findMinUserByUserid(String userid) { + return repository.findMinUserinfoByUserid(userid); + } } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/PublicBoardService.java b/src/main/java/com/xit/biz/ctgy/service/impl/PublicBoardService.java index 6aefdbe..1c18ca1 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/PublicBoardService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/PublicBoardService.java @@ -32,4 +32,9 @@ public class PublicBoardService implements IPublicBoardService { // List userList = page.getContent(); return page; } + + @Override + public MinInfoBoard680 findByInCode(Long inCode) { + return repository.findByInCode(inCode); + } } diff --git a/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java b/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java index 10e26c3..a54eeb5 100644 --- a/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java +++ b/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java @@ -66,7 +66,7 @@ public class SpringDocApiConfig { @Bean public GroupedOpenApi ctgyBizApi() { return GroupedOpenApi.builder() - .group("Ctgy-biz-API") + .group("1. Ctgy-biz-API") .pathsToMatch( "/api/v1/ctgy/**" ) @@ -76,7 +76,7 @@ public class SpringDocApiConfig { @Bean public GroupedOpenApi authorizeApi() { return GroupedOpenApi.builder() - .group("Authorize-API") + .group("2. Authorize-API") .pathsToMatch( "/api/v1/auth/**", "/api/v1/users/**" @@ -87,7 +87,7 @@ public class SpringDocApiConfig { @Bean public GroupedOpenApi commonApi() { return GroupedOpenApi.builder() - .group("common-API") + .group("3. common-API") .pathsToMatch( "/api/biz/cmm/**", "/api/v1/biz/cmm/**" @@ -101,7 +101,7 @@ public class SpringDocApiConfig { @Bean public GroupedOpenApi sampleApi() { return GroupedOpenApi.builder() - .group("Sample-API") + .group("4. Sample-API") .pathsToMatch("/api/sample/**") .build(); } diff --git a/src/test/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryTest.java b/src/test/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryTest.java index 020d3be..626b537 100644 --- a/src/test/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryTest.java +++ b/src/test/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryTest.java @@ -33,9 +33,6 @@ class IMinSimsa680RepositoryTest { private JPAQueryFactory queryFactory; - @Autowired - private IMinSimsa680Repository iMinSimsa680Repository; - @BeforeEach void beforeEach(){ queryFactory = new JPAQueryFactory(em);