Mybatis - pageHelper

공부는 혼자하는 거·2021년 9월 4일
0

Spring Tip

목록 보기
11/52

https://github.com/pagehelper/Mybatis-PageHelper

https://goodteacher.tistory.com/251

https://badstorage.tistory.com/13 custom

https://www.bswen.com/2018/06/springboot-mybatis-with-pageHelper.html

https://www.cnblogs.com/zyl187110/p/11442897.html

1page: Page{count=true, pageNum=1, pageSize=10, startRow=0, endRow=10, total=100, pages=10, reasonable=false, pageSizeZero=false}[Book(id=101, author=.......

11page: Page{count=true, pageNum=11, pageSize=10, startRow=100, endRow=110, total=100, pages=10, reasonable=false, pageSizeZero=false}[]

<plugins>
		<plugin interceptor="com.github.pagehelper.PageInterceptor">
			<!-- config params as the following -->
			<property name="helperDialect" value="oracle" />
			
		</plugin>
	</plugins>
<dependency>
			<groupId>com.github.pagehelper</groupId>
			<artifactId>pagehelper</artifactId>
			<version>5.2.0</version>
		</dependency>
@Test
	public void selectAllPaging() {
	    int perPage = 10;
	    // 몇 페이지에 대한 조회인지 설정 후 조회
	    PageHelper.startPage(1, perPage);
	    Page<Book> p = bookRepository.pageTest();
	    //log.info("1 page: {}", p);
	    log.info("1page: " + p);
	    
	    PageHelper.startPage(2, perPage);
	    p =  bookRepository.pageTest();
	    //log.info("2 page: {}", p);
	    log.info("2page: " + p);
	    
	    
	    PageHelper.startPage(10, perPage);
	    p =  bookRepository.pageTest();
	    log.info("10page: " + p);
	    
	    PageHelper.startPage(11, perPage);
	    p =  bookRepository.pageTest();
	    log.info("11page: " + p);
	    
	    PageInfo<Book> books = new PageInfo<Book>(p);
	    log.info("pageInfo: "+books);
	}

PageInfo{pageNum=10, pageSize=10, size=10, startRow=91, endRow=100, total=100, pages=10, list=Page{count=true, pageNum=10, pageSize=10, startRow=90, endRow=100, total=100, pages=10, reasonable=false, pageSizeZero=false}[Book(id=11, author=창현 박종.......

.....title=잠수네 아이들의

)], prePage=9, nextPage=0, isFirstPage=false, isLastPage=true, hasPreviousPage=true, hasNextPage=false, navigatePages=8, navigateFirstPage=3, navigateLastPage=10, navigatepageNums=[3, 4, 5, 6, 7, 8, 9, 10]}

https://github.com/stella6767/spring-legacy-booklist

profile
시간대비효율

0개의 댓글