update:分页数据属性名改为rows

V0.5.x
tangfudong 2023-06-09 10:55:17 +08:00
parent d3dd5701df
commit 9c6e07a7b3
6 changed files with 8 additions and 8 deletions

View File

@ -23,7 +23,7 @@ public class Paging<T> {
private long total; private long total;
private List<T> data; private List<T> rows;
public <VO> Paging<VO> to(Class<VO> voClass) { public <VO> Paging<VO> to(Class<VO> voClass) {
return MapstructUtils.convert(this, voClass); return MapstructUtils.convert(this, voClass);

View File

@ -99,10 +99,10 @@ public class MapstructUtils {
if (ObjectUtil.isNull(source)) { if (ObjectUtil.isNull(source)) {
return null; return null;
} }
if (CollUtil.isEmpty(source.getData())) { if (CollUtil.isEmpty(source.getRows())) {
return new Paging<>(0, new ArrayList<>()); return new Paging<>(0, new ArrayList<>());
} }
return new Paging<>(source.getTotal(), CONVERTER.convert(source.getData(), desc)); return new Paging<>(source.getTotal(), CONVERTER.convert(source.getRows(), desc));
} }
} }

View File

@ -65,9 +65,9 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi
pageRequest.setPageSize(1000); pageRequest.setPageSize(1000);
pageRequest.setPageNum(page); pageRequest.setPageNum(page);
while ((paged = deviceInfoData.findAll(pageRequest)).getData().size() > 0) { while ((paged = deviceInfoData.findAll(pageRequest)).getRows().size() > 0) {
pageRequest.setPageNum(page++); pageRequest.setPageNum(page++);
List<DeviceInfo> devices = paged.getData(); List<DeviceInfo> devices = paged.getRows();
for (DeviceInfo device : devices) { for (DeviceInfo device : devices) {
//装载设备信息缓存 //装载设备信息缓存
deviceInfoCachePut.findByDeviceId(device.getDeviceId(), device); deviceInfoCachePut.findByDeviceId(device.getDeviceId(), device);

View File

@ -205,7 +205,7 @@ public class ProtocolServiceImpl implements IProtocolService {
@Override @Override
public Paging<ProtocolComponentVo> selectPageList(PageRequest<ProtocolComponentBo> query) { public Paging<ProtocolComponentVo> selectPageList(PageRequest<ProtocolComponentBo> query) {
Paging<ProtocolComponentVo> components = protocolComponentData.findAll(query.to(ProtocolComponent.class)).to(ProtocolComponentVo.class); Paging<ProtocolComponentVo> components = protocolComponentData.findAll(query.to(ProtocolComponent.class)).to(ProtocolComponentVo.class);
components.getData().forEach(c -> c.setState( components.getRows().forEach(c -> c.setState(
componentManager.isRunning(c.getId()) ? componentManager.isRunning(c.getId()) ?
ProtocolComponent.STATE_RUNNING : ProtocolComponent.STATE_STOPPED ProtocolComponent.STATE_RUNNING : ProtocolComponent.STATE_STOPPED
)); ));

View File

@ -79,7 +79,7 @@ public class RuleManager {
pageRequest.setPageNum(idx+=1); pageRequest.setPageNum(idx+=1);
pageRequest.setPageSize(100); pageRequest.setPageSize(100);
Paging<RuleInfo> all = ruleInfoData.findAll(pageRequest); Paging<RuleInfo> all = ruleInfoData.findAll(pageRequest);
List<RuleInfo> rules = all.getData(); List<RuleInfo> rules = all.getRows();
if(CollectionUtil.isEmpty(rules)){ if(CollectionUtil.isEmpty(rules)){
return; return;
} }

View File

@ -59,7 +59,7 @@ public class TaskManager implements ApplicationContextAware {
pageRequest.setPageNum(idx+=1); pageRequest.setPageNum(idx+=1);
pageRequest.setPageSize(100); pageRequest.setPageSize(100);
Paging<TaskInfo> all = taskInfoData.findAll(pageRequest); Paging<TaskInfo> all = taskInfoData.findAll(pageRequest);
List<TaskInfo> tasks = all.getData(); List<TaskInfo> tasks = all.getRows();
// 如果记录为空,直接跳出循环 // 如果记录为空,直接跳出循环
if (CollectionUtil.isEmpty(tasks)) { if (CollectionUtil.isEmpty(tasks)) {
break; break;