Jelajahi Sumber

update CategoryService

reghao 1 tahun lalu
induk
melakukan
34fc965298

+ 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;
     }