-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
分页时错误,总共只有9条记录,查询第100页时,理论上应该显示null,但是将最后一条数据返回。
page 传入100 size 传入 2 ,理论上应该为空,但是实际上却是返回了最后一条记录。请大佬解惑下
@GetMapping("/getRecord")
public Result getRecord(
@RequestParam(value="page", required= true) Integer page,
@RequestParam(value="size", required= true) Integer size ){
PageHelper.startPage(page, size);
List<ProgramUpgrade> all = programUpgradeRepos.getAll();
PageInfo<ProgramUpgrade> info = new PageInfo(all);
log.info("info:{}",info);
return Result.ok(0,"获取成功",all,info.getTotal());
}
@Select("select * from programUpgrade order by date desc ")
List<ProgramUpgrade> getAll();
sql语句打印如下:
[15:20:33.026] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 132 connectionLog - {conn-10005} pool-connect
[15:20:33.027] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction 87 openConnection - JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@27aa66dc] will not be managed by Spring
[15:20:33.027] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Preparing: SELECT count(0) FROM programUpgrade
[15:20:33.029] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Parameters:
[15:20:33.030] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20002, rs-50001} open
[15:20:33.030] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20002, rs-50001} Header: [count(0)]
[15:20:33.031] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20002, rs-50001} Result: [9]
[15:20:33.032] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - <== Total: 1
[15:20:33.032] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20002, rs-50001} closed
[15:20:33.034] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Preparing: select * from programUpgrade order by date desc LIMIT ?, ?
[15:20:33.036] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Parameters: 8(Integer), 2(Integer)
[15:20:33.039] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20003, rs-50002} open
[15:20:33.039] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20003, rs-50002} Header: [id, md5FileContent, compressFileName, compressFileMd5Code, date, username]
[15:20:33.039] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20003, rs-50002} Result: [1, 57e63128ef2fbe861e7526a254e93316 MyUpdateFile.tgz, MyUpdateFile.tgz, null, 2020-09-07 15:36:50.0, null]
[15:20:33.040] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - <== Total: 1
[15:20:33.040] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 142 resultSetLog - {conn-10005, pstmt-20003, rs-50002} closed
[15:20:33.041] DEBUG org.mybatis.spring.SqlSessionUtils 191 closeSqlSession - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7e96f57b]
[15:20:33.041] DEBUG com.alibaba.druid.filter.logging.Log4j2Filter 132 connectionLog - {conn-10005} pool-recycle
[15:20:33.042] INFO com.xinda.controller.ProgramUpgradeController 90 getRecord - info:PageInfo{pageNum=5, pageSize=2, size=1, startRow=9, endRow=9, total=9, pages=5, list=Page{count=true, pageNum=5, pageSize=2, startRow=8, endRow=10, total=9, pages=5, reasonable=true, pageSizeZero=false}[ProgramUpgrade(id=1, md5FileContent=57e63128ef2fbe861e7526a254e93316 MyUpdateFile.tgz, compressFileName=MyUpdateFile.tgz, compressFileMd5Code=null, date=Mon Sep 07 15:36:50 CST 2020, username=null)], prePage=4, nextPage=0, isFirstPage=false, isLastPage=true, hasPreviousPage=true, hasNextPage=false, navigatePages=8, navigateFirstPage=1, navigateLastPage=5, navigatepageNums=[1, 2, 3, 4, 5]}
Metadata
Metadata
Assignees
Labels
No labels