shikeying
2022-10-28 e75364c0d66fff66432bce505c136d51034ba408
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.iplatform.recvideo.service;
 
import com.iplatform.model.po.Rc_video_batch;
import com.iplatform.model.po.Rc_video_t2;
import com.iplatform.model.po.Rc_video_user;
import com.walker.db.page.GenericPager;
import com.walker.jdbc.service.BaseServiceImpl;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class VideoShowServiceImpl extends BaseServiceImpl {
 
    /**
     * 查询给定用户推荐的视频集合
     * @param userId
     * @param limit 限制返回几条
     * @return
     */
    public List<Rc_video_user> queryRecommendList(long userId, int limit){
        if(limit <= 0){
            limit = 128;
        }
        return this.select("select video_id, score from rc_video_user where user_id=? order by score desc limit ?", new Object[]{userId, limit}, new Rc_video_user());
    }
 
    /**
     * 返回部分原始视频集合,用于选择相似视频使用。
     * @return
     */
    public GenericPager<Rc_video_batch> queryPageVideoBatchList(){
        return this.selectSplit("select * from rc_video_batch", new Object[]{}, 1, 128, new Rc_video_batch());
    }
 
    /**
     * 返回给定原始视频,相似视频集合。
     * @param srcVideoId
     * @return
     */
    public List<Rc_video_t2> querySimilarVideoList(String srcVideoId){
        return this.select(new Rc_video_t2(), "where src_video_id=?", new Object[]{srcVideoId});
    }
 
    /**
     * 根据原始视频ID,查询该视频信息。
     * @param srcVideoId
     * @return
     */
    public Rc_video_batch queryOneVideoInfo(String srcVideoId){
        return this.get(new Rc_video_batch(), "where src_video_id=?", new Object[]{srcVideoId});
    }
}