PagerHelper

一:添加依赖

            <!-- mybatis的分页插件 -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.3</version>
        </dependency>

二:配置

pagehelper: 
    helperDialect: mysql
    reasonable: true
    supportMethodsArguments: true
    params: count=countSql

三:开包即食

对一个查询全部的方法分页

        @GetMapping("/yy")
	public Object getYY() {
		PageHelper.startPage(1, 2);
		List<teacher> list = ts.getAll();
		System.out.println(list);
		System.out.println(new PageInfo<>(list));
		return list;
	}

然后,我。。。。。。。。。。。。。

Springboot集成mybati-PageHelper插件

然后返回的对象,What hell ,man!!

然而,页面显示是这样子的,有点意思

Springboot集成mybati-PageHelper插件

Springboot集成mybati-PageHelper插件

相关文章: