mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-22 18:29:51 +08:00
优化资源列表视频资源的读取
This commit is contained in:
@@ -54,12 +54,13 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
if (filter.getType() != null) {
|
||||
wrapper.eq("type", filter.getType());
|
||||
}
|
||||
if (filter.getCategoryIds() != null && filter.getCategoryIds().length > 0) {
|
||||
List<Integer> ridArray = relationService.getRidsByCids(Arrays.asList(filter.getCategoryIds()));
|
||||
if (ridArray == null || ridArray.size() == 0) {
|
||||
ridArray = HelperUtil.zeroIntegerList();
|
||||
if (filter.getCategoryIds() != null && filter.getCategoryIds().trim().length() > 0) {
|
||||
List<Integer> categoryIds = Arrays.stream(filter.getCategoryIds().split(",")).map(Integer::valueOf).toList();
|
||||
List<Integer> ids = relationService.getRidsByCids(categoryIds);
|
||||
if (ids == null || ids.size() == 0) {
|
||||
ids = HelperUtil.zeroIntegerList();
|
||||
}
|
||||
wrapper.in("id", ridArray);
|
||||
wrapper.in("id", ids);
|
||||
}
|
||||
|
||||
String sortFiled = filter.getSortField();
|
||||
|
||||
@@ -6,6 +6,7 @@ import xyz.playedu.api.service.ResourceVideoService;
|
||||
import xyz.playedu.api.mapper.ResourceVideoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +35,9 @@ public class ResourceVideoServiceImpl extends ServiceImpl<ResourceVideoMapper, R
|
||||
|
||||
@Override
|
||||
public List<ResourceVideo> chunksByRids(List<Integer> resourceIds) {
|
||||
if (resourceIds == null || resourceIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return list(query().getWrapper().in("rid", resourceIds));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user