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