Commit 260e7e4e by lzy

绑定设备列表-bug

parent c6815154
...@@ -13,14 +13,14 @@ import com.makeit.dto.platform.space.PlatSpaceDeviceQueryDTO; ...@@ -13,14 +13,14 @@ import com.makeit.dto.platform.space.PlatSpaceDeviceQueryDTO;
import com.makeit.dto.platform.space.PlatUnbindingDeviceDTO; import com.makeit.dto.platform.space.PlatUnbindingDeviceDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.entity.platform.space.PlatRoomBedDevice; import com.makeit.entity.platform.space.PlatRoomBedDevice;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.platform.device.PlatDeviceEnum; import com.makeit.enums.platform.device.PlatDeviceEnum;
import com.makeit.mapper.platform.space.PlatRoomBedDeviceMapper; import com.makeit.mapper.platform.space.PlatRoomBedDeviceMapper;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.space.PlatBedService; import com.makeit.service.platform.space.*;
import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.service.platform.space.PlatRoomBedDeviceService;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
...@@ -50,6 +50,10 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -50,6 +50,10 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
private PlatBedService platBedService; private PlatBedService platBedService;
@Autowired @Autowired
private PlatRegionSettingService platRegionSettingService; private PlatRegionSettingService platRegionSettingService;
@Autowired
private PlatRoomService platRoomService;
@Autowired
private PlatSpaceService platSpaceService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -84,12 +88,19 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -84,12 +88,19 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
if (StringUtil.isNotEmpty(dto.getRoomId())) { if (StringUtil.isNotEmpty(dto.getRoomId())) {
queryWrapper1.ne(PlatRoomBedDevice::getRoomId, dto.getRoomId()); queryWrapper1.ne(PlatRoomBedDevice::getRoomId, dto.getRoomId());
} }
if (CommonEnum.NO.getValue().equals(dto.getIsRoom())) { if (CommonEnum.YES.getValue().equals(dto.getIsRoom())) {
queryWrapper1.isNull(PlatRoomBedDevice::getBedId); queryWrapper1.isNull(PlatRoomBedDevice::getBedId);
} }
List<PlatRoomBedDevice> list = list(queryWrapper1); List<PlatRoomBedDevice> list = list(queryWrapper1);
List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList()); List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList());
String orgId = null;
if(StringUtil.isNotEmpty(dto.getRoomId())){
PlatRoom platRoom = platRoomService.getById(dto.getRoomId());
PlatSpace platSpace = platSpaceService.getById(platRoom.getSpaceId());
orgId = platSpace.getOrgId();
}
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO); Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
...@@ -99,6 +110,7 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -99,6 +110,7 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatDevice::getName, dto.getName()); queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatDevice::getName, dto.getName());
queryWrapper.like(StringUtil.isNotEmpty(dto.getProductName()), PlatDevice::getProductName, dto.getProductName()); queryWrapper.like(StringUtil.isNotEmpty(dto.getProductName()), PlatDevice::getProductName, dto.getProductName());
queryWrapper.eq(StringUtil.isNotEmpty(dto.getStatus()), PlatDevice::getStatus, dto.getStatus()); queryWrapper.eq(StringUtil.isNotEmpty(dto.getStatus()), PlatDevice::getStatus, dto.getStatus());
queryWrapper.eq(StringUtil.isNotEmpty(orgId),PlatDevice::getOrgId,orgId);
Page<PlatDevice> pages = platDeviceService.page(p, queryWrapper); Page<PlatDevice> pages = platDeviceService.page(p, queryWrapper);
List<PlatDeviceDTO> listRecord = BeanDtoVoUtils.listVo(pages.getRecords(), PlatDeviceDTO.class); List<PlatDeviceDTO> listRecord = BeanDtoVoUtils.listVo(pages.getRecords(), PlatDeviceDTO.class);
......
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 sign in to comment