fix (farm): 物种库维护
- 分页查询重复bug
This commit is contained in:
@@ -397,7 +397,7 @@ public class SpeciesLibraryServiceImpl implements SpeciesLibraryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构建完整的树结构用于查询
|
// 构建完整的树结构用于查询
|
||||||
List<SpeciesTwoLevelTreeRespVO> fullTree = buildTree(allDicts);
|
List<SpeciesTwoLevelTreeRespVO> fullTree = buildTree(matchedDicts);
|
||||||
|
|
||||||
Set<Long> resultIds = new HashSet<>();
|
Set<Long> resultIds = new HashSet<>();
|
||||||
List<SpeciesTwoLevelTreeRespVO> result = new ArrayList<>();
|
List<SpeciesTwoLevelTreeRespVO> result = new ArrayList<>();
|
||||||
@@ -419,7 +419,16 @@ public class SpeciesLibraryServiceImpl implements SpeciesLibraryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result.stream()
|
||||||
|
.collect(Collectors.collectingAndThen(
|
||||||
|
Collectors.toMap(
|
||||||
|
SpeciesTwoLevelTreeRespVO::getName,
|
||||||
|
item -> item,
|
||||||
|
(existing, replacement) -> existing, // 保留第一个出现的
|
||||||
|
LinkedHashMap::new
|
||||||
|
),
|
||||||
|
map -> new ArrayList<>(map.values())
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user