fix: 零部件书搜索

This commit is contained in:
2024-08-12 19:01:11 +08:00
parent a4b98c3fd0
commit 8fd710198b
2 changed files with 4 additions and 2 deletions
@@ -123,7 +123,8 @@ public class DictTreeService {
Set<String> rootNodeIds = rootNodes.stream().map(SysDictItem::getId).collect(Collectors.toSet());
rootNodes.forEach(node -> {
node.setLeafFlag(matchedNodes.stream()
.noneMatch(n -> rootNodeIds.contains(n.getParentId())));
.noneMatch(n -> (rootNodeIds.contains(n.getParentId()) &&
n.getParentId().equals(node.getId()))));
});
return new ArrayList<>(rootNodes);
@@ -288,7 +288,8 @@ public class PartNameServiceImpl extends ServiceImpl<PartNameMapper, PartName>
Set<String> rootNodeCodes = rootNodes.stream().map(PartName::getCode).collect(Collectors.toSet());
rootNodes.forEach(node -> {
node.setLeafFlag(matchedNodes.stream()
.noneMatch(n -> rootNodeCodes.contains(n.getParentCode())));
.noneMatch(n -> (rootNodeCodes.contains(n.getParentCode()) &&
n.getParentCode().equals(node.getCode()))));
});
return new ArrayList<>(rootNodes);