Skip to content

zuilafeng/mybatis-page-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mybatis-page-plugin

This is a mybatis plugin for pagenation.

Usage

1.在mysql的config文件中添加如下配置

  <plugins>
    <plugin interceptor="com.xjd.mybatis.page.PageInterceptor">
      <property name="databaseType" value="mysql"/>
    </plugin>
  </plugins>

2.修改原来Mapper类中的方法(可以采取重载的方式,这样可以不影响原有方法)

	List<TestBean> selectByCity(String city);

	List<TestBean> selectByCity(@Param("city") String city, Pagination page);

3.最后在程序中使用

	Page<TestBean> page = new Page<TestBean>(1, 20); // 第1页取20条
	List<TestBean> list = testMapper.selectByCity("SH", page); // 调用重载方法
	page.setResultList(list); // 注意此处要自己设值

	// 使用查询出来的结果...

About

This is a mybatis plugin for pagenation.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%