zoukankan      html  css  js  c++  java
  • Mybatis--->limit分页查询

    分页查询对比正常的查询差别不大,只是在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();
        }
  • 相关阅读:
    django的模板层
    django的视图层
    django的路由层
    web应用与http协议
    索引
    pymysql模块的使用
    多表查询
    单表查询
    数据的增删改
    自定义form组件
  • 原文地址:https://www.cnblogs.com/springxian/p/13246507.html
Copyright © 2011-2022 走看看