From 75257e241e078b6b7703f37f6e8bde913465cb42 Mon Sep 17 00:00:00 2001 From: ckx6954 Date: Thu, 12 Dec 2024 15:55:39 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=95=20=EC=9C=A0?= =?UTF-8?q?=ED=8B=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/company/localhost/mapper/TestMapper.java | 7 ++++--- .../io/company/localhost/service/TestService.java | 14 ++++++++------ .../java/io/company/localhost/utils/PageUtil.java | 5 ++--- src/main/resources/mapper/testMapper.xml | 4 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/io/company/localhost/mapper/TestMapper.java b/src/main/java/io/company/localhost/mapper/TestMapper.java index a6dd455..4fb92df 100644 --- a/src/main/java/io/company/localhost/mapper/TestMapper.java +++ b/src/main/java/io/company/localhost/mapper/TestMapper.java @@ -1,11 +1,12 @@ package io.company.localhost.mapper; -import java.util.List; - +import io.company.localhost.common.dto.MapDto; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface TestMapper { - List getCong(); + List getCong(); } diff --git a/src/main/java/io/company/localhost/service/TestService.java b/src/main/java/io/company/localhost/service/TestService.java index d0cca17..11f9241 100644 --- a/src/main/java/io/company/localhost/service/TestService.java +++ b/src/main/java/io/company/localhost/service/TestService.java @@ -1,11 +1,12 @@ package io.company.localhost.service; -import java.util.List; - -import org.springframework.stereotype.Service; - +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import io.company.localhost.common.dto.MapDto; import io.company.localhost.mapper.TestMapper; +import io.company.localhost.utils.PageUtil; import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @@ -13,7 +14,8 @@ public class TestService { private final TestMapper testMapper; - public List getCong(){ - return testMapper.getCong(); + public PageInfo getCong(){ + PageHelper.startPage( 1 , 10); + return PageUtil.redefineNavigation(new PageInfo<>(testMapper.getCong(),10)); } } diff --git a/src/main/java/io/company/localhost/utils/PageUtil.java b/src/main/java/io/company/localhost/utils/PageUtil.java index 97ce83a..854be52 100644 --- a/src/main/java/io/company/localhost/utils/PageUtil.java +++ b/src/main/java/io/company/localhost/utils/PageUtil.java @@ -1,13 +1,12 @@ package io.company.localhost.utils; import com.github.pagehelper.PageInfo; - -import java.util.Map; +import io.company.localhost.common.dto.MapDto; public class PageUtil { - public static PageInfo> redefineNavigation(PageInfo> list){ + public static PageInfo redefineNavigation(PageInfo list){ // 페이지 배열 int[] nav = list.getNavigatepageNums(); diff --git a/src/main/resources/mapper/testMapper.xml b/src/main/resources/mapper/testMapper.xml index 94073ae..bee6f8d 100644 --- a/src/main/resources/mapper/testMapper.xml +++ b/src/main/resources/mapper/testMapper.xml @@ -2,11 +2,11 @@ - SELECT * FROM - test.cong + cong