Commit 40e5e3e5 by 吕明尚

Merge branch 'dev' into test

parents 72b71eae 3eab2782
......@@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 设备信息Service业务层处理
......@@ -170,10 +171,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Override
public TableDataInfo devicePage(DeviceDto device) {
List<Device> devices = deviceMapper.selectDeviceList(device);
List<DeviceVo> deviceVoList = convertDosToVos(devices);
TableDataInfo tableDataInfo = new TableDataInfo();
PageDomain pageDomain = TableSupport.buildPageRequest();
tableDataInfo.setTotal(devices.size());
int start = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
int end = Math.min(start + pageDomain.getPageSize(), devices.size());
List<Device> deviceVos = devices.subList(start, end);
List<DeviceVo> deviceVoList = convertDosToVos(deviceVos);
if (CollectionUtils.isNotEmpty(deviceVoList)) {
List<SStore> sStoreList = storeMapper.selectList(new LambdaQueryWrapper<>());
List<SRoom> sRoomList = roomMapper.selectList(new LambdaQueryWrapper<>());
List<SRoom> sRoomList = roomMapper.selectList(new LambdaQueryWrapper<SRoom>().in(SRoom::getId, deviceVoList.stream().map(DeviceVo::getRoomId).collect(Collectors.toList())));
List<SStore> sStoreList = storeMapper.selectList(new LambdaQueryWrapper<SStore>().in(SStore::getId, sRoomList.stream().map(SRoom::getStoreId).collect(Collectors.toList())));
deviceVoList.stream().forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getRoomId())) {
SRoom sRoom = sRoomList.stream().filter(room -> room.getId().equals(item.getRoomId())).findFirst().orElse(null);
......@@ -188,13 +195,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
});
}
deviceVoList.sort(Comparator.comparing(DeviceVo::getCreateTime).reversed());
PageDomain pageDomain = TableSupport.buildPageRequest();
int start = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
int end = Math.min(start + pageDomain.getPageSize(), deviceVoList.size());
List<DeviceVo> deviceVos = deviceVoList.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(deviceVos);
tableDataInfo.setTotal(deviceVoList.size());
tableDataInfo.setRows(deviceVoList);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
......
......@@ -158,17 +158,16 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
@Override
public TableDataInfo pageList(RoomLabelDto roomLabel) {
List<RoomLabel> roomLabels = roomLabelMapper.pageList(roomLabel);
List<RoomLabelVo> voList = doListToVoList(roomLabels);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setTotal(roomLabels.size());
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, voList.size());
List<RoomLabelVo> pagedList = voList.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(pagedList);
tableDataInfo.setTotal(roomLabels.size());
int end = Math.min(start + pageSize, roomLabels.size());
List<RoomLabel> pagedList = roomLabels.subList(start, end);
List<RoomLabelVo> voList = doListToVoList(pagedList);
tableDataInfo.setRows(voList);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
......
......@@ -617,22 +617,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public TableDataInfo queryOrderList(SOrder sOrder) {
List<SOrder> sOrderList = baseMapper.queryList(sOrder.getRoomId());
List<SOrderVo> sOrderVos = convertDosToVos(sOrderList);
List<SStore> list = storeService.list();
List<SRoom> list1 = roomService.list();
sOrderVos.stream().forEach(vo -> {
vo.setRoomName(list1.stream().filter(room -> room.getId().equals(vo.getRoomId())).findFirst().get().getName());
vo.setStoreName(list.stream().filter(store -> store.getId().equals(vo.getStoreId())).findFirst().get().getName());
});
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setTotal(sOrderList.size());
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, sOrderVos.size());
List<SOrderVo> pagedList = sOrderVos.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(pagedList);
tableDataInfo.setTotal(sOrderVos.size());
int end = Math.min(start + pageSize, sOrderList.size());
List<SOrder> pagedList = sOrderList.subList(start, end);
List<SOrderVo> sOrderVos = convertDosToVos(pagedList);
// List<SStore> list = storeService.list();
// List<SRoom> list1 = roomService.list();
// sOrderVos.stream().forEach(vo -> {
// vo.setRoomName(list1.stream().filter(room -> room.getId().equals(vo.getRoomId())).findFirst().get().getName());
// vo.setStoreName(list.stream().filter(store -> store.getId().equals(vo.getStoreId())).findFirst().get().getName());
// });
tableDataInfo.setRows(sOrderVos);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment