admin
2021-01-04 aa6ef62aef83e277d4171df1d9f0803f91738216
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
package com.newvideo.service.imp;
 
import java.util.List;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Service;
 
import com.newvideo.dao.VideoInfoDao;
import com.newvideo.dao.recommend.CategoryRecommendCacheVideoNumberDao;
import com.newvideo.domain.recommend.CategoryRecommendCacheVideoNumber;
 
//推荐服务
@Service
public class CategoryVideoRecommendService {
    @Resource
    private VideoInfoDao videoInfoDao;
    @Resource
    private CategoryRecommendCacheVideoNumberDao categoryRecommendCacheVideoNumberDao;
 
    public CategoryRecommendCacheVideoNumberDao getCategoryRecommendCacheVideoNumberDao() {
        return categoryRecommendCacheVideoNumberDao;
    }
 
    public void setCategoryRecommendCacheVideoNumberDao(
            CategoryRecommendCacheVideoNumberDao categoryRecommendCacheVideoNumberDao) {
        this.categoryRecommendCacheVideoNumberDao = categoryRecommendCacheVideoNumberDao;
    }
 
    public VideoInfoDao getVideoInfoDao() {
        return videoInfoDao;
    }
 
    public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
        this.videoInfoDao = videoInfoDao;
    }
 
    // 分区榜首数量
    public int getRankVideoNumber(long videotype) {
        List<CategoryRecommendCacheVideoNumber> list = categoryRecommendCacheVideoNumberDao
                .list("from CategoryRecommendCacheVideoNumber cr where cr.videoType.id=" + videotype);
        if (list != null && list.size() > 0)
            return list.get(0).getNumber();
        else
            return 30;
    }
 
}