diff --git a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java b/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java index 153f3af..c991539 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java @@ -34,11 +34,11 @@ public class ResidentController { @Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"), @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") }) - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity findAll( + @GetMapping(value="/data", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity findResidentDatas( @Parameter(hidden = true) final Pageable pageable) { - return RestResponse.of(service.findResidents(pageable)); + return RestResponse.of(service.findResidentDatas(pageable)); } @Operation(summary = "거주자의견진술 상세" , description = "거주자의견진술 상세") diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java index e698c00..a365601 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java @@ -4,5 +4,5 @@ import com.xit.biz.ctgy.entity.GnRecallSc; import org.springframework.data.jpa.repository.JpaRepository; public interface IResidentRepository extends JpaRepository, IResidentRepositoryCustom { - GnRecallSc findByScCode(Long scCode); + GnRecallSc findByScCode(final Long scCode); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java index 02da500..1ffdeea 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java @@ -11,8 +11,8 @@ import org.springframework.data.domain.Pageable; import java.util.List; public interface IResidentRepositoryCustom { - Page findResidents(Pageable pageable); + Page findResidentDatas(Pageable pageable); - GnRecallScDto findResident(Long scCode); + GnRecallScDto findResident(final Long scCode); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java index 382cd2a..1c4d1a5 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java @@ -26,7 +26,7 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom { private final JPAQueryFactory queryFactory; @Override - public Page findResidents(Pageable pageable) { + public Page findResidentDatas(Pageable pageable) { // 커버링 인덱스로 대상 조회 QueryResults scCodeList = queryFactory @@ -34,7 +34,7 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom { .from(gnRecallSc) .where(gnRecallSc.scDatagb.eq(CtgyConstants.Resident.DATAGB_1.getCode())) .orderBy(gnRecallSc.scCode.desc()) - .offset(pageable.getPageSize()) + .offset(pageable.getOffset()) .limit(pageable.getPageSize()) .fetchResults(); @@ -79,7 +79,7 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom { } @Override - public GnRecallScDto findResident(Long scCode) { + public GnRecallScDto findResident(final Long scCode) { BooleanBuilder builder = new BooleanBuilder(); builder.and(gnRecallSc.scDatagb.eq(CtgyConstants.Resident.DATAGB_1.getCode())); builder.and(gnRecallSc.scCode.eq(scCode)); diff --git a/src/main/java/com/xit/biz/ctgy/service/IResidentService.java b/src/main/java/com/xit/biz/ctgy/service/IResidentService.java index e8aa266..68d6cb5 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentService.java @@ -5,13 +5,14 @@ import com.xit.biz.ctgy.entity.GnRecallSc; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import javax.annotation.Nonnull; import java.util.List; public interface IResidentService { - Page findResidents(Pageable pageable); + Page findResidentDatas(Pageable pageable); - GnRecallScDto findResident(Long scCode); + GnRecallScDto findResident(final Long scCode); - Page findAll(GnRecallSc entity, Pageable pageable); + Page findAll(final GnRecallSc entity, Pageable pageable); } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java index 5ee145f..d70ebb7 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java @@ -18,10 +18,10 @@ public class ResidentService implements IResidentService { @Override @Transactional(readOnly = true) - public Page findResidents(Pageable pageable) { + public Page findResidentDatas(Pageable pageable) { // Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); pageable = JpaUtil.getPagingInfo(pageable); - Page page = repository.findResidents( + Page page = repository.findResidentDatas( PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending())); // List userList = page.getContent(); return page; @@ -29,13 +29,13 @@ public class ResidentService implements IResidentService { @Override @Transactional(readOnly = true) - public GnRecallScDto findResident(Long scCode) { + public GnRecallScDto findResident(final Long scCode) { return repository.findResident(scCode); } @Override @Transactional(readOnly = true) - public Page findAll(GnRecallSc entity, Pageable pageable) { + public Page findAll(final GnRecallSc entity, Pageable pageable) { // Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); pageable = JpaUtil.getPagingInfo(pageable); // pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("inCode").descending())