REM:
1. 修正分页查询不存在数据是异常问题
This commit is contained in:
HuangXin 2020-09-17 09:23:46 +08:00
parent 2de126b7c5
commit 6e05714e46
2 changed files with 11 additions and 5 deletions

View File

@ -223,6 +223,7 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
@Override
public MulReturnType<PageInfo<DisposeDevice>, List<DisposeDevice>> getPagesOfDevices(Integer startPage,
Integer pageSize) {
List<DisposeDevice> rspList = new ArrayList<>();
// 设置分页信息
PageHelper.startPage(startPage, pageSize);
@ -236,9 +237,11 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
// 获取分页信息
PageInfo<DisposeDevice> pageInfo = new PageInfo<>(devList);
// 返回实际数据
List<Long> idArray = devList.stream().map(DisposeDevice::getId).collect(Collectors.toList());
List<DisposeDevice> rspList = disposeDeviceMapper.selectByIdSet(idArray);
if(devList.size() > 0) {
// 返回实际数据
List<Long> idArray = devList.stream().map(DisposeDevice::getId).collect(Collectors.toList());
rspList.addAll(disposeDeviceMapper.selectByIdSet(idArray));
}
return new MulReturnType<>(pageInfo, rspList);
}

View File

@ -119,6 +119,7 @@ public class DisposeTaskManagerImpl implements DisposeTaskManager {
@Override
public MulReturnType<PageInfo<DisposeTask>, List<DisposeTask>> getPagesOfTask(Integer startPage,
Integer pageSize) {
List<DisposeTask> rspList = new ArrayList<>();
// 设置分页信息
PageHelper.startPage(startPage, pageSize);
List<DisposeTask> taskList = disposeTaskMapper.selectAll();
@ -129,8 +130,10 @@ public class DisposeTaskManagerImpl implements DisposeTaskManager {
PageInfo<DisposeTask> pageInfo = new PageInfo<>(taskList);
List<Long> idArray = taskList.stream().map(DisposeTask::getId).collect(Collectors.toList());
List<DisposeTask> rspList = disposeTaskMapper.selectByIdSet(idArray);
if(taskList.size() > 0) {
List<Long> idArray = taskList.stream().map(DisposeTask::getId).collect(Collectors.toList());
rspList.addAll(disposeTaskMapper.selectByIdSet(idArray));
}
return new MulReturnType<>(pageInfo, rspList);
}