mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-25 12:22:03 +08:00
优化代码
This commit is contained in:
@@ -66,9 +66,8 @@ public class CourseController {
|
||||
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
|
||||
@GetMapping("/create")
|
||||
public JsonResponse create() {
|
||||
Map<Integer, List<ResourceCategory>> categories = categoryService.all().stream().collect(Collectors.groupingBy(ResourceCategory::getParentId));
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("categories", categories);
|
||||
data.put("categories", categoryService.groupByParent());
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,8 @@ public class DepartmentController {
|
||||
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index() {
|
||||
Map<Integer, List<Department>> departments = departmentService.all().stream().collect(Collectors.groupingBy(Department::getParentId));
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("departments", departments);
|
||||
|
||||
data.put("departments", departmentService.groupByParent());
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
@@ -61,11 +58,8 @@ public class DepartmentController {
|
||||
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
|
||||
@GetMapping("/create")
|
||||
public JsonResponse create() {
|
||||
Map<Integer, List<Department>> departments = departmentService.all().stream().collect(Collectors.groupingBy(Department::getParentId));
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("departments", departments);
|
||||
|
||||
data.put("departments", departmentService.groupByParent());
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,8 @@ public class ResourceCategoryController {
|
||||
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index() {
|
||||
Map<Integer, List<ResourceCategory>> categories = categoryService.all().stream().collect(Collectors.groupingBy(ResourceCategory::getParentId));
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("categories", categories);
|
||||
|
||||
data.put("categories", categoryService.groupByParent());
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
@@ -61,11 +58,8 @@ public class ResourceCategoryController {
|
||||
|
||||
@GetMapping("/create")
|
||||
public JsonResponse create() {
|
||||
Map<Integer, List<ResourceCategory>> categories = categoryService.all().stream().collect(Collectors.groupingBy(ResourceCategory::getParentId));
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("categories", categories);
|
||||
|
||||
data.put("categories", categoryService.groupByParent());
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user