|
@@ -271,22 +271,26 @@ public class DataStrategyImpl implements DataStrategy {
|
|
|
* @return 系统图列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Diagram> getDiagrams(String diagramType, String projectId, String systemId, String groupCode, String name) {
|
|
|
+ public List<Diagram> getDiagrams(String diagramType, String projectId,
|
|
|
+ String systemId, String groupCode, String name) {
|
|
|
|
|
|
Set<DiagramEntity> result = new HashSet<>();
|
|
|
//所有系统实例
|
|
|
List<ObjectNode> objectNodes = loadSystemInstance(projectId, groupCode);
|
|
|
- //获取所有id
|
|
|
- List<String> ids = objectNodes.stream().filter(node -> {
|
|
|
- String objectName = Optional.ofNullable(node.get(Constants.NAME)).map(JsonNode::asText).orElse(StrUtil.EMPTY);
|
|
|
- return StrUtil.contains(objectName, name);
|
|
|
- }).map(jsonNodes -> jsonNodes.get(Constants.ID).asText()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (CollectionUtil.isNotEmpty(ids)) {
|
|
|
- //由系统实例名模糊匹配到的系统图列表
|
|
|
- List<DiagramEntity> diagramsBySystemIds = diagramMapper.getDiagramsBySystemIds(ids);
|
|
|
- //合并
|
|
|
- result.addAll(diagramsBySystemIds);
|
|
|
+ //名称不为空时
|
|
|
+ if (StrUtil.isNotBlank(name)) {
|
|
|
+ //获取所有id
|
|
|
+ List<String> ids = objectNodes.stream().filter(node -> {
|
|
|
+ String objectName = Optional.ofNullable(node.get(Constants.NAME)).map(JsonNode::asText).orElse(StrUtil.EMPTY);
|
|
|
+ return StrUtil.contains(objectName, name);
|
|
|
+ }).map(jsonNodes -> jsonNodes.get(Constants.ID).asText()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollectionUtil.isNotEmpty(ids)) {
|
|
|
+ //由系统实例名模糊匹配到的系统图列表
|
|
|
+ List<DiagramEntity> diagramsBySystemIds = diagramMapper.getDiagramsBySystemIds(ids);
|
|
|
+ //合并
|
|
|
+ result.addAll(diagramsBySystemIds);
|
|
|
+ }
|
|
|
}
|
|
|
//直接去系统图表根据名称模糊查询查出来的数据
|
|
|
List<DiagramEntity> diagrams = diagramMapper.getDiagrams(diagramType,
|