关于pagehelper-spring-boot-starter排序的一个小测试

关于pagehelper-spring-boot-starter排序的一个小测试

 

1. 依赖和配置信息

<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.2.5</version>
</dependency>

pagehelper:
   
helper-dialect: mysql
   
reasonable: true
   
support-methods-arguments: true
   
params: count=countSql

 

2.表中有两个时间字段 create_time、update_time

3.在xml的select语句中设置order by update_time desc

4. 程序中查询语句直接输出结果

 

5.程序的查询语句之前添加 PageHelper.orderBy("create_time asc");输出查询结果

扫描二维码关注公众号,回复: 4361822 查看本文章

6.最终测试结果,是按照create_time asc来进行排序的。

备注:pagehelper-spring-boot-starter 依赖mybatis-spring-boot-starter和pagehelper了,不需要再额外添加依赖

pagehelper-spring-boot-starter gitbub地址 https://github.com/pagehelper/pagehelper-spring-boot

猜你喜欢

转载自my.oschina.net/u/2329222/blog/2967510