未使用SpringBoot
第⼀步:引⼊依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.3.1</version>
</dependency>
第⼆步:在mybatis-config.xml⽂件中配置插件
typeAliases标签下⾯进⾏配置:
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor"></plugin>
</plugins>
第三步:编写Java代码
CarMapper接⼝
List<Car> selectAll();
CarMapper.xml
<select id="selectAll" resultType="Car">
select * from t_car
</select>
关键点:
在查询语句之前开启分⻚功能。
在查询语句之后封装PageInfo对象。(PageInfo对象将来会存储到request域当中。在⻚⾯上展

最低0.47元/天 解锁文章
811

被折叠的 条评论
为什么被折叠?



