From a96672d534b9121027bb9043aa53324c67fb173e Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 16 Mar 2022 21:25:56 +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 | 18 ++++++ .../IMinSimsa680RepositoryCustom.java | 3 + .../IMinSimsa680RepositoryImpl.java | 61 ++++++++----------- .../biz/ctgy/service/IMinSimsa680Service.java | 1 + .../ctgy/service/impl/MinSimsa680Service.java | 5 ++ src/main/resources/logback-spring.xml | 7 ++- 6 files changed, 57 insertions(+), 38 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 279c343..767529c 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/MinSimsa680Controller.java +++ b/src/main/java/com/xit/biz/ctgy/controller/MinSimsa680Controller.java @@ -55,6 +55,24 @@ public class MinSimsa680Controller { return RestResponse.of(service.findMinSimsa680Groups(minSimsa680GroupDto, pageable)); } + @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") + + }) + @GetMapping(value="details", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity findMinSimsa680Details( + @Valid + @Parameter(hidden = true) + final MinSimsa680GroupDto minSimsa680GroupDto, + @Parameter(hidden = true) + final Pageable pageable) { + return RestResponse.of(service.findMinSimsa680Details(minSimsa680GroupDto, pageable)); + } + // TODO :: 파라메터 정의 필요 @Operation(summary = "심사(대상)자 조회" , description = "심사(대상)자 조회") @Parameters({ 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 fabe796..e82a9b8 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryCustom.java @@ -2,10 +2,13 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.dto.MinSimsa680GroupDto; import com.xit.biz.ctgy.dto.MinSimsaReviewGroupDto; +import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; public interface IMinSimsa680RepositoryCustom { Page findMinSimsa680Groups(MinSimsa680GroupDto pMinSimsa680GroupDto, Pageable pageable); + Page findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable); 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 8cc8b9c..f2c57f5 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IMinSimsa680RepositoryImpl.java @@ -37,10 +37,10 @@ public class IMinSimsa680RepositoryImpl implements IMinSimsa680RepositoryCustom BooleanBuilder builder = new BooleanBuilder(); - if( !Checks.isEmpty(pMinSimsa680GroupDto.getMsYear())) { + if (!Checks.isEmpty(pMinSimsa680GroupDto.getMsYear())) { builder.and(minSimsa680.msYear.eq(pMinSimsa680GroupDto.getMsYear())); } - if( !Checks.isEmpty(pMinSimsa680GroupDto.getMsChasu())) { + if (!Checks.isEmpty(pMinSimsa680GroupDto.getMsChasu())) { builder.and(minSimsa680.msChasu.like(String.valueOf(pMinSimsa680GroupDto.getMsChasu()))); } QueryResults rslt = @@ -67,40 +67,31 @@ public class IMinSimsa680RepositoryImpl implements IMinSimsa680RepositoryCustom return new PageImpl<>(rslt.getResults(), pageable, rslt.getTotal()); } - public Page findMinSimsa680Details(MinSimsa680GroupDto dto, Pageable pageable){ - //LocalDate now = LocalDate.now(); - LocalDate now = LocalDate.of(2021, 12, 11); - LocalDate now2 = LocalDate.of(2021, 12, 12); - + public Page findMinSimsa680Details(MinSimsa680GroupDto dto, Pageable pageable) { + QueryResults rslt = + queryFactory + .select(Projections.fields(MinSimsa680.class, + minSimsa680.msSeq, + minSimsa680.msCarnum, + minSimsa680.msMaincode)) + .from(minSimsaUser680) + .join(minSimsa680) + .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())) + .groupBy(minSimsa680.msCarnum, + minSimsa680.msSeq, + minSimsa680.msMaincode) + .orderBy(minSimsa680.msSeq.asc()) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .fetchResults(); - queryFactory - .select(minSimsa680.msSeq, - minSimsa680.msCarnum, - minSimsa680.msMaincode) - .from(minSimsaUser680) - .join(minSimsa680) - .on(minSimsa680.msMaincode.eq(minSimsaUser680.msuMaincode)) - .join(minUserinfo) - .on(minSimsaUser680.msuUserid.eq(minUserinfo.userid)) - .where(minSimsaUser680.msuTeam.eq(""), - minSimsa680.msChasu.eq(1L), - minSimsa680.msSdate.eq(java.sql.Date.valueOf(now)), - minSimsa680.msEdate.eq(java.sql.Date.valueOf(now2))) - .groupBy(minSimsa680.msCarnum, - minSimsa680.msSeq, - minSimsa680.msMaincode) - .orderBy(minSimsa680.msSeq.asc()) - .offset(0L) - .limit(10L) - //, minSimsa680.msSdate.eq(java.sql.Date.valueOf(now))) - .fetchResults(); -// jpaQueryFactory.selectFrom(minSimsa680) -// .leftJoin(minSimsa680.msMaincode, minSimsaUser680).fetchJoin() -// .groupBy(minSimsa680.msEdate, minSimsaUser680.msuTeam, qMinUserinfo.name) -// .orderBy(minSimsa680.msChasu.desc()) -// //.where(minSimsa680.name.eq(name)) - // .fetch(); - return null; + return new PageImpl<>(rslt.getResults(), pageable, rslt.getTotal()); } @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 4253cec..0a04dc3 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IMinSimsa680Service.java +++ b/src/main/java/com/xit/biz/ctgy/service/IMinSimsa680Service.java @@ -10,6 +10,7 @@ public interface IMinSimsa680Service { //Page findMinSimsa680Groups(MinSimsa680 minSimsa680, Pageable pageable); Page findMinSimsa680Groups(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable); + Page findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable); 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 187e8e4..5defd7e 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 @@ -36,6 +36,11 @@ public class MinSimsa680Service implements IMinSimsa680Service { return repository.findMinSimsa680Groups(minSimsa680GroupDto, pageable); } + @Transactional(readOnly = true) + public Page findMinSimsa680Details(MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable) { + return repository.findMinSimsa680Details(minSimsa680GroupDto, pageable); + } + @Transactional(readOnly = true) public Page findMinSimsa680s2(MinSimsa680 minSimsa680, Pageable pageable) { return repository.findMinSimsa680s2(pageable); diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 975015f..d454a44 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -4,11 +4,12 @@ - + + - - + +