zoukankan      html  css  js  c++  java
  • mybatis分页插件PageHelper简单应用

    --添加依赖

    <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
    <dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper</artifactId>
    <version>5.1.10</version>
    </dependency>

    <!--boot框架可引入该依赖 https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
    <dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.2.10</version>
    </dependency>

    --springboot配置(.yml)

    #pagehelper
    pagehelper:
        helperDialect: mysql
        #设置超过最大页数不再返回数据
        reasonable: false
        supportMethodsArguments: true
        params: count=countSql
        returnPageInfo: check

    --简单使用(对于线程安全问题可以参考官网,注意对于大数据量,会用性能瓶颈)

    int pageNum = Integer.parseInt(request.getParameter("pageNum"));
    int pageSize = Integer.parseInt(request.getParameter("pageSize"));
    PageHelper.startPage(pageNum,pageSize);
    List<Map<String,Object>> list = getMarkersiteListNew(paramMap);
    PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(list);
    Map<String,Object> listMap = new HashMap<>();
    listMap.put("list",list);
    listMap.put("pageNum",pageNum);
    listMap.put("pageSize",pageSize/*list.size()*/);
    listMap.put("total",pageInfo.getTotal());

  • 相关阅读:
    osgearth 编译日志
    osg Error osgearth_viewerd fails with "Loaded scene graph does not contain a MapNode
    多自由度机械臂模拟-吊绳伸缩
    多自由度机械臂模拟7
    osgViewer
    多自由度机械臂模拟6
    多自由度机械臂模拟5
    多自由度机械臂模拟4
    多自由度机械臂模拟3
    多自由度机械臂模拟2
  • 原文地址:https://www.cnblogs.com/sung1024/p/11178691.html
Copyright © 2011-2022 走看看