zoukankan      html  css  js  c++  java
  • pagehelper 分页不生效,总页数总是1解决方案

    问题:

      后台查询后的数据只有1页,已经设置了PageHelper也没用

         PageHelper.startPage(pageNum,pageSize);
            ModelAndView mv=new ModelAndView();
         Integer count= secondService.message();
            mv.addObject("count",count);
         List<Second> seconds= secondService.show();   
         mv.addObject("seconds",seconds);
         PageInfo<Second> pageInfo=new PageInfo<>(seconds);
        mv.addObject("pageInfo",pageInfo);

      

    解决方案:

    PageHelper.startPage(pageNum,pageSize);只对该语句以后的第一个查询语句得到的数据进行分页。

    问题解决。

    PS:

    pom.xml

       <!--mybatis分页插件-->
        <dependency>
          <groupId>com.github.pagehelper</groupId>
          <artifactId>pagehelper</artifactId>
          <version>5.1.2</version>
        </dependency>
    

     mybatis-config.xml

    <!--翻页插件-->
        <plugins>
            <plugin interceptor="com.github.pagehelper.PageInterceptor">
                <property name="helperDialect" value="mysql"></property>
                <property name="reasonable" value="true"></property>
            </plugin>
        </plugins>
  • 相关阅读:
    SCAU 9504 面试
    SCAU 9503 懒人选座位
    SCAU 8628 相亲
    SCAU 10691 ACM 光环
    SCAU 8626 原子量计数
    SCAU 10674 等差对
    HDU ACM 1048 The Hardest Problem Ever (水题)
    SCAU 9502 ARDF
    SCAU 10686 DeathGod不知道的事情
    SCAU 8629 热身游戏(高精度)
  • 原文地址:https://www.cnblogs.com/crazy-lc/p/12288473.html
Copyright © 2011-2022 走看看