删除资源分类的资源数量计算

This commit is contained in:
none
2023-03-21 15:08:13 +08:00
parent debf6c65fb
commit 9a3b8138f5
10 changed files with 2 additions and 49 deletions

View File

@@ -44,8 +44,6 @@ public interface CourseService extends IService<Course> {
List<Course> chunks(List<Integer> ids);
Map<Integer, Integer> getCategoryCount();
Integer total();
List<Course> openCoursesAndShow(Integer limit);

View File

@@ -30,8 +30,6 @@ public interface ResourceService extends IService<Resource> {
List<Resource> chunks(List<Integer> ids, List<String> fields);
Map<Integer, Integer> getCategoryCount(String type);
Integer total(String type);
Integer duration(Integer id);

View File

@@ -169,11 +169,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
return list(query().getWrapper().in("id", ids));
}
@Override
public Map<Integer, Integer> getCategoryCount() {
return getBaseMapper().getCategoryCount().stream().collect(Collectors.toMap(CourseCategoryCountMapper::getCid, CourseCategoryCountMapper::getTotal));
}
@Override
public Integer total() {
return Math.toIntExact(count());

View File

@@ -112,13 +112,6 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
return list(query().getWrapper().in("id", ids).select(fields));
}
@Override
public Map<Integer, Integer> getCategoryCount(String type) {
Map<Integer, Integer> data = getBaseMapper().getCategoryCount(type).stream().collect(Collectors.toMap(ResourceCategoryCountMapper::getCid, ResourceCategoryCountMapper::getTotal));
data.put(0, getBaseMapper().getNunCategoryCount(type));
return data;
}
@Override
public Integer total(String type) {
return Math.toIntExact(count(query().getWrapper().eq("type", type).eq("is_hidden", 0)));