페이징 유틸 추가
This commit is contained in:
parent
6437f0e721
commit
75257e241e
@ -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<Long> getCong();
|
||||
List<MapDto> getCong();
|
||||
}
|
||||
|
||||
@ -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<Long> getCong(){
|
||||
return testMapper.getCong();
|
||||
public PageInfo<MapDto> getCong(){
|
||||
PageHelper.startPage( 1 , 10);
|
||||
return PageUtil.redefineNavigation(new PageInfo<>(testMapper.getCong(),10));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Map<String , Object>> redefineNavigation(PageInfo<Map<String , Object>> list){
|
||||
public static PageInfo<MapDto> redefineNavigation(PageInfo<MapDto> list){
|
||||
|
||||
// 페이지 배열
|
||||
int[] nav = list.getNavigatepageNums();
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.company.localhost.mapper.TestMapper">
|
||||
|
||||
<select id="getCong" resultType="Long">
|
||||
<select id="getCong" resultType="Map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
test.cong
|
||||
cong
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user