|
|
@@ -375,7 +375,13 @@ public class WaterSupplyDeviceServiceImpl extends ServiceImpl<EquipmentBaseMappe
|
|
|
}
|
|
|
|
|
|
int total = allDevices.size();
|
|
|
- int fromIndex = (int) ((pageNum - 1) * pageSize);
|
|
|
+ long offset = (pageNum - 1) * pageSize;
|
|
|
+ if (pageNum < 1 || pageSize < 1 || offset >= total) {
|
|
|
+ Page<AbnormalDeviceVO> emptyPage = new Page<>(pageNum, pageSize, total);
|
|
|
+ emptyPage.setRecords(new ArrayList<>());
|
|
|
+ return emptyPage;
|
|
|
+ }
|
|
|
+ int fromIndex = (int) offset;
|
|
|
int toIndex = Math.min(fromIndex + (int) pageSize, total);
|
|
|
List<EquipmentBase> pageDevices = allDevices.subList(fromIndex, toIndex);
|
|
|
|