如何处理多个集合关联关系时,试试这个方法?
直接上代码:
// 主关系表
List<SiemLogRelationSourceVO> abnormalLogRelationCmdbInfo = siemLogSourceDao.getAbnormalLogRelationCmdbInfo();
// 查询(关联关系)
List<AbnormalLogStrategyLogSourceRel> sourceRels = abnormalLogStrategyLogSourceRelDao.selectList(sourceRelWrapper);
// 组合uuid关系
List<String> itcompUuidList = sourceRels.stream().map(AbnormalLogStrategyLogSourceRel::getItcompUuid).collect(Collectors.toList());
for (SiemLogRelationSourceVO vo : abnormalLogRelationCmdbInfo
) {
// 存在则赋值
if (itcompUuidList.contains(vo.getItcompUuid())){
vo.setIsRelated(1); // 增加属性值
}
}
return abnormalLogRelationCmdbInfo;
本作品采用《CC 协议》,转载必须注明作者和本文链接