使用对象里面属性一样的组成新map集合

2023-12-19 21:57:16

TableVo tableVo= AnalysisDruidSqlUtil.AnalysisSql(dto.getSqlInfo(),null);
List<MetaMappingInsideDto> metaMappingInsideDtos=new ArrayList<>();
List<TableMapVo> tableMapVos=tableVo.getTableMapVos();
Map<String, List<TableMapVo>> collect = tableMapVos.stream().collect(Collectors.groupingBy(v -> {
return v.getSourceTableName() +","+ v.getTargetTableName();
}));

list转string

qo.getDeptIds().stream().map(Objects::toString).collect(Collectors.joining(",")).toString();

根据对象属性过滤列表里面的属性过滤形成新集合

List<DataTablePermissionDo> tableTypes= dataTablePermissionService.findTableTypeListByQo(qo);

List<Person> personList = ... // 假设这是一个Person对象列表
Map<String, Person> personMap = personList.stream()
? ? ? ? .collect(Collectors.toMap(Person::getName, Function.identity()));

Map<Long, List<Integer>> dtypes = tableTypes.stream().collect(Collectors.groupingBy(DataTablePermissionDo::getMetaTableId,
Collectors.mapping(DataTablePermissionDo::getPermissionType,Collectors.toList())));
dataTablePermissions= dataTablePermissions.stream().collect(Collectors.filtering(tablePermissionDo -> {
List<Integer> dtypes1 = dtypes.get(tablePermissionDo.getMetaTableId());
boolean istrue=false;
if (dtypes1.contains(tablePermissionDo.getPermissionType())){
istrue=true;
}
return istrue;
},Collectors.toList()));

<trim prefix="AND (" prefixOverrides="OR" suffix=")">
<if test="deptIds != null and deptIds.size() > 0">
OR (
t.permission_object_type = 1
AND t.permission_object_id IN
<foreach collection="deptIds" item="deptId" open="(" close=")" separator=",">
#{deptId}
</foreach>
)
</if>

<if test="roleIds != null and roleIds.size() > 0">
OR (
t.permission_object_type = 2
AND t.permission_object_id IN
<foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
#{roleId}
</foreach>
)
</if>
<if test=" !spaceFiltering and projectIds != null and projectIds.size() > 0">
OR (
t.permission_object_type = 3
AND t.permission_object_id IN
<foreach collection="projectIds" item="projectId" open="(" close=")" separator=",">
#{projectId}
</foreach>
)
</if>
</trim>

Map<Long,String> tabbles=new HashMap<>();

tabbles= tableExtensionInsideDos.stream().collect(Collectors.toMap(TableExtensionInsideDo::getId,TableExtensionInsideDo::getTableName));

文章来源:https://blog.csdn.net/u012269637/article/details/134727919
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。