Skip to content

Instantly share code, notes, and snippets.

@sunxboy
Created August 1, 2018 02:48
Show Gist options
  • Save sunxboy/3327a02d9d0f53dee0af6ca0befdf3e1 to your computer and use it in GitHub Desktop.
Save sunxboy/3327a02d9d0f53dee0af6ca0befdf3e1 to your computer and use it in GitHub Desktop.
mybatis 分页
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- 使用下面的方式配置参数,后面会有所有的参数介绍 -->
<property name="supportMethodsArguments" value="true"/>
<property name="params" value="pageNum=pageNumKey;pageSize=pageSizeKey;"/>
</plugin>
</plugins>
List<Country> selectByPageNumSize(
@Param("user") User user,
@Param("pageNumKey") int pageNum,
@Param("pageSizeKey") int pageSize);
当调用这个方法时,由于同时发现了 pageNumKey 和 pageSizeKey 参数,这个方法就会被分页。params 提供的几个参数都可以这样使用。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment