|
@@ -36,9 +36,9 @@ public class BinSectionServiceImpl extends ServiceImpl<BinSectionMapper, BinSect
|
|
|
public List<BinSection> list(String id, String sectionName, String sectionCode) {
|
|
|
|
|
|
List<BinSection> list =CacheContext.bsnList;
|
|
|
- List<BinSection> treeList = convert(list);
|
|
|
+
|
|
|
|
|
|
- return treeList;
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -69,50 +69,50 @@ public class BinSectionServiceImpl extends ServiceImpl<BinSectionMapper, BinSect
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
- * 转换为有树形结构的列表
|
|
|
- *
|
|
|
- * @param source 源数据所有数据
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<BinSection> convert(List<BinSection> source) {
|
|
|
- if (CollectionUtil.isEmpty(source)) {
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
- List<BinSection> result = new ArrayList<>();
|
|
|
- List<String> idList = source.stream().map(BinSection::getId).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (BinSection menuVO : source) {
|
|
|
-
|
|
|
- if (!idList.contains(menuVO.getParentId())) {
|
|
|
- result.add(menuVO);
|
|
|
- }
|
|
|
- }
|
|
|
- for (BinSection menuVO : result) {
|
|
|
-
|
|
|
- getChildren(source, menuVO);
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- * 循环设置子级
|
|
|
- *
|
|
|
- * @param list 所有元素列表
|
|
|
- * @param treeSelectVO 父级元素
|
|
|
- * @return 父级元素
|
|
|
- */
|
|
|
- public static BinSection getChildren(List<BinSection> list, BinSection treeSelectVO) {
|
|
|
- for (BinSection section : list) {
|
|
|
- if (treeSelectVO.getId().equals(section.getParentId())) {
|
|
|
- List<BinSection> children = CollectionUtil.isEmpty(treeSelectVO.getChildren()) ? new ArrayList<>() : treeSelectVO.getChildren();
|
|
|
- children.add(getChildren(list, section));
|
|
|
- treeSelectVO.setChildren(children);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- return treeSelectVO;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|