标签:bsp 对比 com on() select 文件 nbsp sele pre
分页查询对比正常的查询差别不大,只是在sql语句上有区别
userMapper.class文件
//limit分页
List<User> limit(Map<String,Integer> map);
User mapper.xml 文件下映射对应文件
<select id="limit" parameterType="map" resultType="com.xian.pojo.User"> select * from testdb.test001 limit #{index},#{end} </select>
test.class
@Test public void limit(){ SqlSession sqlsession = MybatisUtils.getSqlsession(); UserMapper mapper = sqlsession.getMapper(UserMapper.class); Map<String, Integer> map = new HashMap<String, Integer>(); map.put("index",1); map.put("end",3); List<User> limit = mapper.limit(map); for (User user : limit) { System.out.println(user); } sqlsession.close(); }
标签:bsp 对比 com on() select 文件 nbsp sele pre
原文地址:https://www.cnblogs.com/springxian/p/13246507.html