Commit bfe68181 by 杨伟程
parents 5c46e321 4f6e42f6
...@@ -92,4 +92,11 @@ public class PlatSpaceController { ...@@ -92,4 +92,11 @@ public class PlatSpaceController {
} }
@ApiOperation("树-上级空间")
@PostMapping("parentListTree")
public ApiResponseEntity<List<PlatSpaceVO>> parentListTree(@RequestBody PlatSpaceQueryDTO dto) {
List<PlatSpaceVO> data = spaceService.parentListTree(dto);
return ApiResponseUtils.success(data);
}
} }
...@@ -76,4 +76,5 @@ public interface PlatSpaceService extends IService<PlatSpace> { ...@@ -76,4 +76,5 @@ public interface PlatSpaceService extends IService<PlatSpace> {
*/ */
public ExcelImportVo importSpaceExcel(MultipartFile excelFile); public ExcelImportVo importSpaceExcel(MultipartFile excelFile);
List<PlatSpaceVO> parentListTree(PlatSpaceQueryDTO dto);
} }
...@@ -471,5 +471,44 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -471,5 +471,44 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
return excelImportVo; return excelImportVo;
} }
@Override
public List<PlatSpaceVO> parentListTree(PlatSpaceQueryDTO dto) {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
return new ArrayList<>();
}
//房间
List<PlatRoom> listRoom = platRoomService.list(new LambdaQueryWrapper<>());
List<String> spaceIds = listRoom.stream().map(PlatRoom::getSpaceId).collect(Collectors.toList());
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()),PlatSpace::getName,dto.getName());
queryWrapper.in(PlatSpace::getOrgId, orgIds);
if(!spaceIds.isEmpty()){
queryWrapper.notIn(PlatSpace::getId, spaceIds);
}
List<PlatSpace> list = this.list(queryWrapper);
list = list.stream()
.filter(s->(StringUtil.isNotEmpty(s.getParentPath()) && s.getParentPath().split(",").length < 3)
|| StringUtil.isEmpty(s.getParentPath()))
.collect(Collectors.toList());
//父级
List<PlatSpace> listParent = list.stream().filter(item->StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
//子集
List<PlatSpace> listChild = list.stream().filter(item->item.getParentId() != null).collect(Collectors.toList());
Map<String,List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpaceVO> data = new ArrayList<>();
for(PlatSpace space:listParent){
PlatSpaceVO vo = convertToVO(space);
vo = child(vo,map);
data.add(vo);
}
return data;
}
} }
...@@ -230,8 +230,11 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -230,8 +230,11 @@ public class WorkStationServiceImpl implements WorkStationService {
|| PlatAlarmConfigEnum.AlarmTypeEnum.BREATHE.getValue().equals(a.getAlarmType()) || PlatAlarmConfigEnum.AlarmTypeEnum.BREATHE.getValue().equals(a.getAlarmType())
){ ){
if(typeMap.containsKey(a.getAlarmType())){ if(typeMap.containsKey(a.getAlarmType())){
if(StringUtil.isNotEmpty(a.getRemark())){
typeMap.get(a.getAlarmType()).add(a.getRemark()); typeMap.get(a.getAlarmType()).add(a.getRemark());
typeMap.put(a.getAlarmType(),typeMap.get(a.getAlarmType())); typeMap.put(a.getAlarmType(),typeMap.get(a.getAlarmType()));
}
}else { }else {
if(StringUtil.isNotEmpty(a.getRemark())){ if(StringUtil.isNotEmpty(a.getRemark())){
List<String> stautsList = new ArrayList<>(); List<String> stautsList = new ArrayList<>();
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</select> </select>
<select id="selectByRoomIds" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO"> <select id="selectByRoomIds" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO">
SELECT pb.`name` as bedName, pb.id as bedId, pb.room_id as roomId , pe.id as elderId, pb.name as elderName, prbd.device_id as deviceId,pb.status SELECT pb.`name` as bedName, pb.id as bedId, pb.room_id as roomId , pe.id as elderId, pe.name as elderName, prbd.device_id as deviceId,pb.status
FROM plat_bed pb FROM plat_bed pb
LEFT JOIN plat_elder pe ON pe.bed_id = pb.id and pe.del_flag = 0 LEFT JOIN plat_elder pe ON pe.bed_id = pb.id and pe.del_flag = 0
LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id and prbd.del_flag = 0 LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id and prbd.del_flag = 0
......
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