@Test public void testFindModel() { List<EasyUITreeModel> json = service.findChildren(getList(), p -> { EasyUITreeModel m = new EasyUITreeModel(); m.setId(p.getParamId()); m.setText(p.getParamName()); m.setPid(p.getParamType()); return m; }); assertNotNull(json); }
private EasyUITreeModel findModel(List<T> list, Function<T, EasyUITreeModel> mc) { if (null == list) { throw new RuntimeException("没有EasyUI菜单"); } Map<Integer, EasyUITreeModel> p = new HashMap<>(list.size() + 1); EasyUITreeModel root = new EasyUITreeModel(); root.setId(0); p.put(root.getId(), root); findModel(list, p, mc); root.setId(null); return root; }
EasyUITreeServiceImpl implements EasyUITreeService<T> { private EasyUITreeModel findModel(List<T> list, Function<T, EasyUITreeModel> mc) { if (null == list) { throw new RuntimeException("没有EasyUI菜单"); } Map<Integer, EasyUITreeModel> p = new HashMap<>(list.size() + 1); EasyUITreeModel root = new EasyUITreeModel(); root.setId(0); p.put(root.getId(), root); findModel(list, p, mc); root.setId(null); return root; } }
EasyUITreeServiceImpl implements EasyUITreeService<T> { private EasyUITreeModel findModel(List<T> list, Function<T, EasyUITreeModel> mc) { if (null == list) { throw new RuntimeException("没有EasyUI菜单"); } Map<Integer, EasyUITreeModel> p = new HashMap<>(list.size() + 1); EasyUITreeModel root = new EasyUITreeModel(); root.setId(0); p.put(root.getId(), root); findModel(list, p, mc); root.setId(null); return root; }  }
EasyUITreeServiceImpl implements EasyUITreeService<T> { private EasyUITreeModel findModel(List<T> list, Function<T, EasyUITreeModel> mc) { if (null == list) { throw new RuntimeException("没有EasyUI菜单"); } Map<Integer, EasyUITreeModel> p = new HashMap<>(list.size() + 1); EasyUITreeModel root = new EasyUITreeModel(); root.setId(0); p.put(root.getId(), root); findModel(list, p, mc); root.setId(null); return root; }  @Override List<EasyUITreeModel> findChildren(List<T> list, Function<T, EasyUITreeModel> mc); void setCheck(List<EasyUITreeModel> easyUITreeModels); }
EasyUITreeServiceImpl implements EasyUITreeService<T> { private EasyUITreeModel findModel(List<T> list, Function<T, EasyUITreeModel> mc) { if (null == list) { throw new RuntimeException("没有EasyUI菜单"); } Map<Integer, EasyUITreeModel> p = new HashMap<>(list.size() + 1); EasyUITreeModel root = new EasyUITreeModel(); root.setId(0); p.put(root.getId(), root); findModel(list, p, mc); root.setId(null); return root; }  @Override List<EasyUITreeModel> findChildren(List<T> list, Function<T, EasyUITreeModel> mc); void setCheck(List<EasyUITreeModel> easyUITreeModels);  }