不再使用SQL实现分页
1.接口
//分页
List<User> getUserByRowBounds();
2.mapper.xml
<!-- 分页-->
<select id="getUserByRowBounds" resultType="UserMap">
select * from mybatis.user
</select>
3.测试
@Test
public void getUserByRowBounds(){
SqlSession sqlSession = MybatisUtils.getSqlSession ();
//RowBounds实现
RowBounds rowBounds = new RowBounds (1,2);
//通过java代码层面实现分页
List<User> userList = sqlSession.selectList ("com.bubbles.dao.UserMapper.getUserByRowBounds",null,rowBounds);
for (User user : userList) {
System.out.println (user);
}
sqlSession.close ();
}
分页插件
了解即可,万一以后,说要使用,你需要知道它是什么东西!