List<TdZwkfPrescItem> prescItemList = tdZwkfPatientInfoService.findPrescItemByMainRidList(mainRidList); //key 主表rid value 主表对应的子表 Map<Integer, List<TdZwkfPrescItem>> prescItemMap = new HashMap<>(); if (CollectionUtils.isEmpty(prescItemList)) { return; } for (TdZwkfPrescItem prescItem : prescItemList) { Integer mainRid = null == prescItem.getFkByMainId() ? null : prescItem.getFkByMainId().getRid(); if (null == mainRid) { continue; } List<TdZwkfPrescItem> tmpList = prescItemMap.get(mainRid); if (null == tmpList) { tmpList = new ArrayList<>(); } tmpList.add(prescItem); prescItemMap.put(mainRid, tmpList); }
map存值的操作
最新推荐文章于 2024-05-31 10:46:10 发布