问题:

  后台查询后的数据只有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);只对该语句以后的第一个查询语句得到的数据进行分页。

pagehelper 分页不生效,总页数总是1解决方案

 

 

 

问题解决。

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>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-01
  • 2022-12-23
  • 2021-08-15
  • 2021-07-14
  • 2022-02-19
  • 2021-07-15
  • 2022-12-23
相关资源
相似解决方案