public static void main(String[] args) throws UnsupportedEncodingException {
Properties prop = System.getProperties();
System.setProperty("mykey", "myvalue");
String value = System.getProperty("os.name");
System.out.println("value=" + value);
String v = System.getProperty("haha");
System.out.println("v=" + v);
for (Object obj : prop.keySet()) {
String value1 = (String) prop.get(obj);
System.out.println(obj + "::" + value1);
}
}
@Override
public List<Menu> queryMenus() {
List<Menu> pMenu = menuMapper.queryAllMenu();
List<Menu> lists = pMenu.stream().filter(e -> e.getPid().equals("0")).map(root -> {
root.setChild(getChildrens(root, pMenu));
return root;
}).collect(Collectors.toList());
return lists;
}
private List<Menu> getChildrens(Menu root, List<Menu> all) {
List<Menu> children = all.stream().filter(categoryEntity -> {
return categoryEntity.getPid().equals(root.getId());
}).map(categoryEntity -> {
categoryEntity.setChild(getChildrens(categoryEntity, all));
return categoryEntity;
}).collect(Collectors.toList());
return children;
}
@Override
public List<Menu> queryMenus() {
List<Menu> pMenu = menuMapper.queryParentMenu();
return pMenu.stream().map(this::getChild).collect(Collectors.toList());
}
public Menu getChild(Menu mu) {
List<Menu> child = menuMapper.queryMenuByParentID(mu.getId());
if (null != child && child.size() > 0) {
mu.setChild(child.stream().map(this::getChild).collect(Collectors.toList()));
}
return mu;
}