From 8bfb63d06d6ce02cffafd191b0ae1688c72d556c Mon Sep 17 00:00:00 2001 From: minuk926 Date: Thu, 17 Mar 2022 21:48:16 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=AC=EC=82=AC=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MinSimsa680Controller.java | 11 ++++---- .../xit/biz/ctgy/dto/MinSimsa680GroupDto.java | 2 +- .../IMinSimsa680RepositoryCustom.java | 4 ++- .../IMinSimsa680RepositoryImpl.java | 26 ++++++++++++------- .../biz/ctgy/service/IMinSimsa680Service.java | 4 ++- .../ctgy/service/impl/MinSimsa680Service.java | 6 +++-- 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/xit/biz/ctgy/controller/MinSimsa680Controller.java b/src/main/java/com/xit/biz/ctgy/controller/MinSimsa680Controller.java index 767529c..40a5b82 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/MinSimsa680Controller.java +++ b/src/main/java/com/xit/biz/ctgy/controller/MinSimsa680Controller.java @@ -57,11 +57,10 @@ public class MinSimsa680Controller { @Operation(summary = "심사(대상) 상세 조회" , description = "심사(대상) 상세 조회") @Parameters({ - @Parameter(in = ParameterIn.QUERY, name = "msYear", description = "심사년도", required = true, example = "2021"), - @Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = false, example = " "), - @Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"), - @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") - + @Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-01-04"), + @Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-01-05"), + @Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = false, example = "3"), + @Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = true, example = "002") }) @GetMapping(value="details", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity findMinSimsa680Details( @@ -70,7 +69,7 @@ public class MinSimsa680Controller { final MinSimsa680GroupDto minSimsa680GroupDto, @Parameter(hidden = true) final Pageable pageable) { - return RestResponse.of(service.findMinSimsa680Details(minSimsa680GroupDto, pageable)); + return RestResponse.of(service.findMinSimsa680Details(minSimsa680GroupDto)); } // TODO :: 파라메터 정의 필요 diff --git a/src/main/java/com/xit/biz/ctgy/dto/MinSimsa680GroupDto.java b/src/main/java/com/xit/biz/ctgy/dto/MinSimsa680GroupDto.java index 561fa9b..9f8efe1 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinSimsa680GroupDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinSimsa680GroupDto.java @@ -26,5 +26,5 @@ public class MinSimsa680GroupDto { private String msClosesi; private Long cnt; - + private String msuTeam; } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryCustom.java index e82a9b8..3fddbe7 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryCustom.java @@ -6,9 +6,11 @@ import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.List; + public interface IMinSimsa680RepositoryCustom { Page findMinSimsa680Groups(MinSimsa680GroupDto pMinSimsa680GroupDto, Pageable pageable); - Page findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable); + List findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto); Page findMinSimsa680s2(Pageable pageable); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryImpl.java index f2c57f5..b3e31fe 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryImpl.java @@ -15,6 +15,7 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import java.time.LocalDate; +import java.util.List; import static com.xit.biz.ctgy.entity.QMinSimsa680.minSimsa680; import static com.xit.biz.ctgy.entity.QMinSimsaUser680.minSimsaUser680; @@ -67,8 +68,18 @@ public class IMinSimsa680RepositoryImpl implements IMinSimsa680RepositoryCustom return new PageImpl<>(rslt.getResults(), pageable, rslt.getTotal()); } - public Page findMinSimsa680Details(MinSimsa680GroupDto dto, Pageable pageable) { - QueryResults rslt = + public List findMinSimsa680Details(MinSimsa680GroupDto dto) { + + BooleanBuilder builder = new BooleanBuilder(); + builder.and(minSimsa680.msSdate.eq(dto.getMsSdate())); + builder.and(minSimsa680.msEdate.eq(dto.getMsEdate())); + builder.and(minSimsaUser680.msuTeam.eq(dto.getMsuTeam())); + + if (!Checks.isEmpty(dto.getMsChasu())) { + builder.and(minSimsa680.msChasu.eq(dto.getMsChasu())); + } + + List rslt = queryFactory .select(Projections.fields(MinSimsa680.class, minSimsa680.msSeq, @@ -79,19 +90,14 @@ public class IMinSimsa680RepositoryImpl implements IMinSimsa680RepositoryCustom .on(minSimsa680.msMaincode.eq(minSimsaUser680.msuMaincode)) .join(minUserinfo) .on(minSimsaUser680.msuUserid.eq(minUserinfo.userid)) - .where(minSimsaUser680.msuTeam.eq(""), - minSimsa680.msChasu.eq(dto.getMsChasu()), - minSimsa680.msSdate.eq(dto.getMsSdate()), - minSimsa680.msEdate.eq(dto.getMsEdate())) + .where(builder) .groupBy(minSimsa680.msCarnum, minSimsa680.msSeq, minSimsa680.msMaincode) .orderBy(minSimsa680.msSeq.asc()) - .offset(pageable.getOffset()) - .limit(pageable.getPageSize()) - .fetchResults(); + .fetch(); - return new PageImpl<>(rslt.getResults(), pageable, rslt.getTotal()); + return rslt; } @Override diff --git a/src/main/java/com/xit/biz/ctgy/service/IMinSimsa680Service.java b/src/main/java/com/xit/biz/ctgy/service/IMinSimsa680Service.java index 0a04dc3..e88293c 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IMinSimsa680Service.java +++ b/src/main/java/com/xit/biz/ctgy/service/IMinSimsa680Service.java @@ -6,11 +6,13 @@ import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.List; + public interface IMinSimsa680Service { //Page findMinSimsa680Groups(MinSimsa680 minSimsa680, Pageable pageable); Page findMinSimsa680Groups(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable); - Page findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable); + List findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto); Page findMinSimsa680s(MinSimsa680 minSimsa680, Pageable pageable); diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/MinSimsa680Service.java b/src/main/java/com/xit/biz/ctgy/service/impl/MinSimsa680Service.java index 5defd7e..5809eca 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/MinSimsa680Service.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/MinSimsa680Service.java @@ -11,6 +11,8 @@ import org.springframework.data.domain.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; @Service @@ -37,8 +39,8 @@ public class MinSimsa680Service implements IMinSimsa680Service { } @Transactional(readOnly = true) - public Page findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable) { - return repository.findMinSimsa680Details(minSimsa680GroupDto, pageable); + public List findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto) { + return repository.findMinSimsa680Details(minSimsa680GroupDto); } @Transactional(readOnly = true)