@Test public void testListDepartmentsTree() throws Exception { }
@Override public CommonResult listDepartmentsTree() { List<Department> list = departmentMapper.list(); Map<String, Map<String, List<String>>> map = new HashMap<>(); for (Department department : list) { if (!map.containsKey(department.getType())) { map.put(department.getType(), new HashMap<>()); } if (!map.get(department.getType()).containsKey(department.getClassification())) { map.get(department.getType()).put(department.getClassification(), new ArrayList<>()); } if (!map.get(department.getType()).get(department.getClassification()).contains(department.getName())) { map.get(department.getType()).get(department.getClassification()).add(department.getName()); } } return CommonResult.success(map); }
DepartmentManagementImpl implements DepartmentManagementService { @Override public CommonResult listDepartmentsTree() { List<Department> list = departmentMapper.list(); Map<String, Map<String, List<String>>> map = new HashMap<>(); for (Department department : list) { if (!map.containsKey(department.getType())) { map.put(department.getType(), new HashMap<>()); } if (!map.get(department.getType()).containsKey(department.getClassification())) { map.get(department.getType()).put(department.getClassification(), new ArrayList<>()); } if (!map.get(department.getType()).get(department.getClassification()).contains(department.getName())) { map.get(department.getType()).get(department.getClassification()).add(department.getName()); } } return CommonResult.success(map); } }
DepartmentManagementImpl implements DepartmentManagementService { @Override public CommonResult listDepartmentsTree() { List<Department> list = departmentMapper.list(); Map<String, Map<String, List<String>>> map = new HashMap<>(); for (Department department : list) { if (!map.containsKey(department.getType())) { map.put(department.getType(), new HashMap<>()); } if (!map.get(department.getType()).containsKey(department.getClassification())) { map.get(department.getType()).put(department.getClassification(), new ArrayList<>()); } if (!map.get(department.getType()).get(department.getClassification()).contains(department.getName())) { map.get(department.getType()).get(department.getClassification()).add(department.getName()); } } return CommonResult.success(map); }  }
DepartmentManagementImpl implements DepartmentManagementService { @Override public CommonResult listDepartmentsTree() { List<Department> list = departmentMapper.list(); Map<String, Map<String, List<String>>> map = new HashMap<>(); for (Department department : list) { if (!map.containsKey(department.getType())) { map.put(department.getType(), new HashMap<>()); } if (!map.get(department.getType()).containsKey(department.getClassification())) { map.get(department.getType()).put(department.getClassification(), new ArrayList<>()); } if (!map.get(department.getType()).get(department.getClassification()).contains(department.getName())) { map.get(department.getType()).get(department.getClassification()).add(department.getName()); } } return CommonResult.success(map); }  @Override CommonResult getDepartmentById(Integer id); @Override CommonResult insertDepartment(Department department); @Override CommonResult updateDepartmentById(Department department); @Override CommonResult deleteDepartmentById(Integer id); @Override CommonResult listAllDepartments(); @Override CommonResult listPage(Integer pageNum, Integer pageSize); @Override CommonResult listDepartmentsTree(); CommonResult listDoctorDepartments(); }
DepartmentManagementImpl implements DepartmentManagementService { @Override public CommonResult listDepartmentsTree() { List<Department> list = departmentMapper.list(); Map<String, Map<String, List<String>>> map = new HashMap<>(); for (Department department : list) { if (!map.containsKey(department.getType())) { map.put(department.getType(), new HashMap<>()); } if (!map.get(department.getType()).containsKey(department.getClassification())) { map.get(department.getType()).put(department.getClassification(), new ArrayList<>()); } if (!map.get(department.getType()).get(department.getClassification()).contains(department.getName())) { map.get(department.getType()).get(department.getClassification()).add(department.getName()); } } return CommonResult.success(map); }  @Override CommonResult getDepartmentById(Integer id); @Override CommonResult insertDepartment(Department department); @Override CommonResult updateDepartmentById(Department department); @Override CommonResult deleteDepartmentById(Integer id); @Override CommonResult listAllDepartments(); @Override CommonResult listPage(Integer pageNum, Integer pageSize); @Override CommonResult listDepartmentsTree(); CommonResult listDoctorDepartments();  }