查询出所有组织结构的数据,列表显示时进行映射
该代码查询的参数是逗号相隔的多个数据
//查询对应组织机构 List<Map<String,Object>> deptList = businessManagerMapper.querySysDept(); Map<Object, List<Map<String, Object>>> groupMap = deptList.stream().collect(Collectors.groupingBy(map -> map.get("path"))); StringBuffer stringBuffer = new StringBuffer(); String[] scopeIds = String.valueOf(item.get("sopes")).split(","); if(!ObjectUtils.isEmpty(item.get("sopes")) && scopeIds.length>0){ for(String id : scopeIds){ if(groupMap.containsKey(id)){ if(ObjectUtils.isEmpty(stringBuffer)){ stringBuffer.append(String.valueOf(groupMap.get(id).get(0).get("deptName"))); }else{ stringBuffer.append(",").append(String.valueOf(groupMap.get(id).get(0).get("deptName"))); } } } }
标签:Java,String,映射,get,stringBuffer,查询,groupMap,id From: https://www.cnblogs.com/wwqkrt/p/17967216