|
@@ -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);
|
|
|
+// 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;
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 转换为有树形结构的列表
|
|
|
+// *
|
|
|
+// * @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;
|
|
|
+// }
|
|
|
|
|
|
}
|