Mybatis分页插件PageInfo
生活随笔
收集整理的這篇文章主要介紹了
Mybatis分页插件PageInfo
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、導入依賴
<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper</artifactId><version>5.1.2</version> </dependency>2、yml文件配置
pagehelper:reasonable: truesupport-methods-arguments: trueparams: count=countSql3、業務實現
@Service public class FruitServiceImpl extends ServiceImpl<FruitMapper, Fruit> implements FruitService{@AutowiredFruitMapper fruitMapper;@Overridepublic PageInfo getFruitList(PageParam pageParam) {//1、定義PageHelper.startPage(pageParam.getCurrent(),pageParam.getPageSize());//2、操作List<Fruit> fruitList = fruitMapper.selectList(new QueryWrapper<Fruit>());//3、返回PageInfo<Fruit> pageInfo = new PageInfo<>(fruitList);return pageInfo;} }總結
以上是生活随笔為你收集整理的Mybatis分页插件PageInfo的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 码神之路博客项目构建记录
- 下一篇: get/post请求params/dat