其他分享
首页 > 其他分享> > # MybatisHelper

# MybatisHelper

作者:互联网

引入依赖

<dependency>
    <groupId>com.ithub.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.2.12</version>
</dependency>

配置yaml

pagehelper:
	helperDialect: mysql
	spportMethodsArguments: true

使用插件

在查询前使用分页插件,原理:统一拦截sql,为其提供分页功能

PageHelper.startPage(page,pageSize);
//查询List
List list = mapper.selextListxxx(xxx);
//封装返回结果
PageInfo<?> pageList = new PageInfo<>(list);
PagedGridResult grid = new PagedGridResult();
grid.setPage(page);
grid.setRows(list);
grid.setTotal(pageList.getPages());
grid.setRecords(pageList.getTotal());
return grid;

标签:插件,pageList,MybatisHelper,list,pagehelper,grid,PagedGridResult
来源: https://www.cnblogs.com/Deng-23-binb/p/15940564.html