分页源码分析
运行流程
org.apache.ibatis.session.defaults.DefaultSqlSession#selectList(java.lang.String, java.lang.Object, org.apache.ibatis.session.RowBounds)
org.apache.ibatis.plugin.Plugin#invoke
com.github.pagehelper.PageInterceptor#intercept
com.github.pagehelper.PageHelper#skip
com.github.pagehelper.util.PageObjectUtil#getPageFromObject
参数如果不传 pageNum,pageSize则不分页,传的有值则进行分页计算
com.github.pagehelper.util.ExecutorUtil#executeAutoCount
真正组装分页sql,并进行列表统计总数
总结:插件是什么,就是把我们经常写的东西,统一封装进行共用,直接调用就行。所以插件就是简化代码量,方便我们开发。
想一想你用的某些插件,如果没有这些插件,你自己该怎么写?