1、The following is the framework introduced by the project:
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
2、The following is the business code:
public PageInfo<DbInstanceDTO> dsInstanceList(DsQueryDTO dto) {
PageInfo<DbInstance> entityPage = PageHelper.startPage(dto.getPageNum(), dto.getPageSize())
.doSelectPageInfo(() -> this.list(Wrappers.<DbInstance>lambdaQuery()
.eq(StrUtil.isNotEmpty(dto.getDbAlias()), DbInstance::getDbAlias, dto.getDbAlias())
.eq(StrUtil.isNotEmpty(dto.getDbType()), DbInstance::getDbType, dto.getDbType())
.orderByAsc(DbInstance::getDbAlias))
);
return dsConvert.entityPage2DtoPage(entityPage);
}
3、The following is the json serialized output of the entityPage object:
{"endRow":0,"hasNextPage":false,"hasPreviousPage":false,"isFirstPage":true,"isLastPage":true,"list":[],"navigateFirstPage":0,"navigateLastPage":0,"navigatePages":8,"navigatepageNums":[],"nextPage":0,"pageNum":1,"pageSize":10,"pages":0,"prePage":0,"size":0,"startRow":0,"total":0}
4、In fact, the following code block returns data:
this.list(Wrappers.<DbInstance>lambdaQuery()
.eq(StrUtil.isNotEmpty(dto.getDbAlias()), DbInstance::getDbAlias, dto.getDbAlias())
.eq(StrUtil.isNotEmpty(dto.getDbType()), DbInstance::getDbType, dto.getDbType())
.orderByAsc(DbInstance::getDbAlias))
);
returns data:
[{"connectStatus":"SUCCESS","connectTime":1696641422000,"connectUserId":"1","connectWay":"DIRECT","dbAlias":"Mysql-local"},{"connectStatus":"SUCCESS","connectTime":1696641422000,"connectUserId":"1","connectWay":"DIRECT","dbAlias":"PostGIS-local"}]
I have debugged countless times and still haven't found a solution. Do you have any suggestions on the direction of troubleshooting?
PageHelper paging is normal, and there is data returned in {..."list":[]...}