@Test public void testListConstantsTree() throws Exception { }
@Override public CommonResult listConstantsTree() { List<Constant> list = constantMapper.list(); Map<String, Map<Byte, String>> map = new HashMap<>(); for (Constant constant : list) { if (!map.containsKey(constant.getType())) { map.put(constant.getType(), new HashMap<>()); } if (!map.get(constant.getType()).containsKey(constant.getChildId())) { map.get(constant.getType()).put(constant.getChildId(), ""); } if ("".equals(map.get(constant.getType()).get(constant.getChildId()))) { map.get(constant.getType()).put(constant.getChildId(), constant.getName()); } } Map<String, JSONArray> map2 = new HashMap<>(); for (Constant constant : list) { if (!map2.containsKey(constant.getType())) { map2.put(constant.getType(), new JSONArray()); } JSONObject object = new JSONObject(); object.put("label", constant.getName()); object.put("value", constant.getChildId()); if (!map2.get(constant.getType()).contains(object)) { map2.get(constant.getType()).add(object); } } return CommonResult.success(map2); }
ConstantManagementImpl implements ConstantManagementService { @Override public CommonResult listConstantsTree() { List<Constant> list = constantMapper.list(); Map<String, Map<Byte, String>> map = new HashMap<>(); for (Constant constant : list) { if (!map.containsKey(constant.getType())) { map.put(constant.getType(), new HashMap<>()); } if (!map.get(constant.getType()).containsKey(constant.getChildId())) { map.get(constant.getType()).put(constant.getChildId(), ""); } if ("".equals(map.get(constant.getType()).get(constant.getChildId()))) { map.get(constant.getType()).put(constant.getChildId(), constant.getName()); } } Map<String, JSONArray> map2 = new HashMap<>(); for (Constant constant : list) { if (!map2.containsKey(constant.getType())) { map2.put(constant.getType(), new JSONArray()); } JSONObject object = new JSONObject(); object.put("label", constant.getName()); object.put("value", constant.getChildId()); if (!map2.get(constant.getType()).contains(object)) { map2.get(constant.getType()).add(object); } } return CommonResult.success(map2); } }
ConstantManagementImpl implements ConstantManagementService { @Override public CommonResult listConstantsTree() { List<Constant> list = constantMapper.list(); Map<String, Map<Byte, String>> map = new HashMap<>(); for (Constant constant : list) { if (!map.containsKey(constant.getType())) { map.put(constant.getType(), new HashMap<>()); } if (!map.get(constant.getType()).containsKey(constant.getChildId())) { map.get(constant.getType()).put(constant.getChildId(), ""); } if ("".equals(map.get(constant.getType()).get(constant.getChildId()))) { map.get(constant.getType()).put(constant.getChildId(), constant.getName()); } } Map<String, JSONArray> map2 = new HashMap<>(); for (Constant constant : list) { if (!map2.containsKey(constant.getType())) { map2.put(constant.getType(), new JSONArray()); } JSONObject object = new JSONObject(); object.put("label", constant.getName()); object.put("value", constant.getChildId()); if (!map2.get(constant.getType()).contains(object)) { map2.get(constant.getType()).add(object); } } return CommonResult.success(map2); }  }
ConstantManagementImpl implements ConstantManagementService { @Override public CommonResult listConstantsTree() { List<Constant> list = constantMapper.list(); Map<String, Map<Byte, String>> map = new HashMap<>(); for (Constant constant : list) { if (!map.containsKey(constant.getType())) { map.put(constant.getType(), new HashMap<>()); } if (!map.get(constant.getType()).containsKey(constant.getChildId())) { map.get(constant.getType()).put(constant.getChildId(), ""); } if ("".equals(map.get(constant.getType()).get(constant.getChildId()))) { map.get(constant.getType()).put(constant.getChildId(), constant.getName()); } } Map<String, JSONArray> map2 = new HashMap<>(); for (Constant constant : list) { if (!map2.containsKey(constant.getType())) { map2.put(constant.getType(), new JSONArray()); } JSONObject object = new JSONObject(); object.put("label", constant.getName()); object.put("value", constant.getChildId()); if (!map2.get(constant.getType()).contains(object)) { map2.get(constant.getType()).add(object); } } return CommonResult.success(map2); }  @Override List<Constant> list(); @Override CommonResult listConstantsTree(); }
ConstantManagementImpl implements ConstantManagementService { @Override public CommonResult listConstantsTree() { List<Constant> list = constantMapper.list(); Map<String, Map<Byte, String>> map = new HashMap<>(); for (Constant constant : list) { if (!map.containsKey(constant.getType())) { map.put(constant.getType(), new HashMap<>()); } if (!map.get(constant.getType()).containsKey(constant.getChildId())) { map.get(constant.getType()).put(constant.getChildId(), ""); } if ("".equals(map.get(constant.getType()).get(constant.getChildId()))) { map.get(constant.getType()).put(constant.getChildId(), constant.getName()); } } Map<String, JSONArray> map2 = new HashMap<>(); for (Constant constant : list) { if (!map2.containsKey(constant.getType())) { map2.put(constant.getType(), new JSONArray()); } JSONObject object = new JSONObject(); object.put("label", constant.getName()); object.put("value", constant.getChildId()); if (!map2.get(constant.getType()).contains(object)) { map2.get(constant.getType()).add(object); } } return CommonResult.success(map2); }  @Override List<Constant> list(); @Override CommonResult listConstantsTree();  }