把集合转换为map集合的使用 Map<Long, FzDoctor> subListMap = subListList.stream().collect(Collectors.toMap(FzDoctor::getDocId, a -> a, (k1, k2) -> k1));
取出属性为集合
List<String> stateNameList = dictEntityList.stream().map(DictEntity::getName).collect(Collectors.toList());
private void deletedData(List<FzDoctorVO> subList,Map<Long, FzDoctor> dbMap) { Long hospitalId = LoginUserContext.getLoginUserInfo().getHospitalId(); List<FzDoctor> deleteList = new ArrayList<>(); List<FzDoctor> subListList = this.fzDocConvert.vo2Po(subList); Map<Long, FzDoctor> subListMap = subListList.stream().collect(Collectors.toMap(FzDoctor::getDocId, a -> a, (k1, k2) -> k1)); dbMap.keySet().stream().filter(v -> { FzDoctor fzDoctor = subListMap.get(v); // 表示 HIS数据库里 不存在,就直接删除 本地数据库里面 数据。 if (null == fzDoctor) { FzDoctor infoFormat = new FzDoctor(); infoFormat.setEnableFlag("0"); infoFormat.setDocId(v); infoFormat.setHospitalId(hospitalId); deleteList.add(infoFormat); } return false; }).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(deleteList)) { fzDocMapper.deleteBatch(deleteList); } }