MyBatis分页插件

1. 在mybatis.xml中配置标签,在程序员所编写的sql命令基础上添加一些内容.

2. 在 pom.xml 配置依赖

	
	
		com.github.pagehelper
		pagehelper
		4.1.6
	

3. 创建 mybatis.xml 并配置插件信息



	
		
			
				
				
			
		
	

4. 在 applicationContext.xml 中配置加载 mybatis.xml



	
	
	

5. 编写代码时注意: PageHelper.startPage()写在查询全部上面.

PageHelper.startPage(page, rows);
//查询全部
List list = tbItemMapper.selectByExample(new TbItemExample());
//分页代码
//设置分页条件
PageInfo pi = new PageInfo<>(list);

你可能感兴趣的:(MyBatis分页插件)