package com.fs.course.service.impl;

import com.fs.course.service.IRecommendationService;
import com.fs.course.vo.FsUserVideoListUVO;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class RecommendationServiceImpl implements IRecommendationService {

    @Override
    public List<FsUserVideoListUVO> recommendVideos(Long userId, List<FsUserVideoListUVO> videos) {
        //根据like数量排序
        List<FsUserVideoListUVO> list =  videos.stream()
                .sorted((v1, v2) -> Integer.compare(v2.getLikeNum(), v1.getLikeNum()))
                .collect(Collectors.toList());
        return list;
    }
}
