소스 검색

update CategoryService

reghao 1 년 전
부모
커밋
34fc965298
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/CategoryServiceImpl.java

+ 7 - 4
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/CategoryServiceImpl.java

@@ -10,6 +10,7 @@ import cn.reghao.tnb.content.app.util.redis.ds.RedisStringObject;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author reghao
@@ -55,11 +56,13 @@ public class CategoryServiceImpl implements CategoryService {
             }
         }
 
-        List<VideoRegion> parents = new ArrayList<>(map.values());
-        parents.sort(Comparator.comparingInt(VideoRegion::getSort));
-        parents.forEach(videoRegion -> {
+        List<VideoRegion> parents = new ArrayList<>(map.values()).stream()
+                .filter(videoRegion -> !videoRegion.getChildren().isEmpty())
+                .sorted(Comparator.comparingInt(VideoRegion::getSort))
+                .collect(Collectors.toList());
+        /*parents.forEach(videoRegion -> {
             videoRegion.getChildren().sort(Comparator.comparingInt(VideoRegion::getSort));
-        });
+        });*/
         return parents;
     }