mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-24 03:29:29 +08:00
返回资源分类的资源数量
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import cn.hutool.core.lang.hash.Hash;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -69,7 +70,14 @@ public class CourseController {
|
||||
filter.setDepIds(depIds);
|
||||
|
||||
PaginationResult<Course> result = courseService.paginate(page, size, filter);
|
||||
return JsonResponse.data(result);
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("data", result.getData());
|
||||
data.put("total", result.getTotal());
|
||||
data.put("category_count", courseService.getCategoryCount());
|
||||
data.put("pure_total", courseService.total());
|
||||
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
|
||||
|
||||
@@ -77,6 +77,8 @@ public class ResourceController {
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("result", result);
|
||||
data.put("category_count", resourceService.getCategoryCount(type));
|
||||
data.put("pure_total", resourceService.total(type));
|
||||
|
||||
if (type.equals(BackendConstant.RESOURCE_TYPE_VIDEO)) {
|
||||
List<ResourceVideo> resourceVideos = resourceVideoService.chunksByRids(result.getData().stream().map(Resource::getId).toList());
|
||||
|
||||
Reference in New Issue
Block a user