問題:
后台查詢后的數據只有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>
