配置mybatis
mybatis: #mapper路径
mapper-locations: classpath:mapper/*.xml
configuration: #日志输出
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#开启驼峰命名
map-underscore-to-camel-case: true
分页配置
pagehelper:
helper-dialect: mysql #数据库,不指定默认自动检测数据库
reasonable: true #是否启动分页合理化
support-methods-arguments: true #默认为 false,分页插件会从查询方法的参数值中,自动根据上面 params 配置的字段中取值,查找到合适的值时就会自动分页。
params: count=countSql #从对象中根据属性名取值,可以配置 pageNum,pageSize,count,pageSizeZero,reasonable,默认值 pageNum=pageNum;pageSize=pageSize;count=countSql;reasonable=reasonable
分页插件 pagehelper依赖
com.github.pagehelper
pagehelper-spring-boot-starter
1.2.3
使用分页
// 设置第几条记录开始,多少页记录为一页
PageHelper.startPage(1,5);
List list=mapper.findAll();
PageInfo pageInfo = new PageInfo<>(list);
Original: https://www.cnblogs.com/eternality/p/16744064.html
Author: 逆梦
Title: SpringBoot之Mybatis开启SQL记录和Pagehelper
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/621602/
转载文章受原作者版权保护。转载请注明原作者出处!