mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-24 11:49:51 +08:00
优化代码
This commit is contained in:
@@ -18,6 +18,8 @@ import xyz.playedu.api.service.internal.UserDepartmentService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
@@ -225,6 +227,11 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
||||
}
|
||||
updateBatchById(departments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, List<Department>> groupByParent() {
|
||||
return list(query().getWrapper().orderByAsc("sort")).stream().collect(Collectors.groupingBy(Department::getParentId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import xyz.playedu.api.service.internal.ResourceCourseCategoryService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
@@ -208,6 +210,11 @@ public class ResourceCategoryServiceImpl extends ServiceImpl<ResourceCategoryMap
|
||||
// 重置排序
|
||||
resetSort(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, List<ResourceCategory>> groupByParent() {
|
||||
return list(query().getWrapper().orderByAsc("sort")).stream().collect(Collectors.groupingBy(ResourceCategory::getParentId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user