diff --git a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java index 6a31086227ca8603f91895f4bd24c9bda60c09ef..758d9008613439e90520ec56d7ec583965f193f8 100644 --- a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java +++ b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java @@ -18,10 +18,13 @@ package neatlogic.framework.cmdb.dto.resourcecenter; import com.alibaba.fastjson.JSONArray; +import neatlogic.framework.cmdb.crossover.ICiCrossoverMapper; +import neatlogic.framework.cmdb.dto.ci.CiVo; import neatlogic.framework.condition.dto.ConditionBaseVo; import neatlogic.framework.condition.dto.ConditionConfigBaseVo; import neatlogic.framework.condition.dto.ConditionGroupBaseVo; import neatlogic.framework.condition.dto.RelVo; +import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.sqlgenerator.$sql; import neatlogic.framework.sqlgenerator.ExpressionVo; import neatlogic.framework.sqlgenerator.SqlVo; @@ -152,7 +155,18 @@ public class ResourceConditionConfigVo extends ConditionConfigBaseVo typeIdList = convertLongList(valueList); + ICiCrossoverMapper ciCrossoverMapper = CrossoverServiceFactory.getApi(ICiCrossoverMapper.class); + Set ciIdSet = new HashSet<>(); + for (Long ciId : typeIdList) { + CiVo ciVo = ciCrossoverMapper.getCiById(ciId); + if (ciVo != null) { + List ciList = ciCrossoverMapper.getDownwardCiListByLR(ciVo.getLft(), ciVo.getRht()); + List ciIdList = ciList.stream().map(CiVo::getId).toList(); + ciIdSet.addAll(ciIdList); + } + } + valueVo = $sql.value(new ArrayList<>(ciIdSet)); } else if (Objects.equals(name, "appSystemIdList")) { columnName = fieldName2ColumnMap.get("app_system_id").toString(); valueVo = $sql.value(convertLongList(valueList));