admin
2021-08-27 8fee151ffae0c3818694b7318583814bf92663e2
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.yeshi.buwan.dao.juhe.funtv;
 
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import com.yeshi.buwan.videos.funtv.entity.VideoFunTV;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
 
import java.util.List;
 
@Repository
public class VideoFunTVNewDao extends MongodbBaseDao<VideoFunTV> {
 
    /**
     * 根据视频ID查询列表
     *
     * @param videoId
     * @return
     */
    public List<VideoFunTV> listByVideoId(Long videoId) {
        Query query = new Query();
        query.addCriteria(Criteria.where("videoId").is(videoId));
        return findList(query);
    }
 
    public List<VideoFunTV> listByAid(String aid) {
        Query query = new Query();
        query.addCriteria(Criteria.where("aid").is(aid));
        return findList(query);
    }
 
    public List<VideoFunTV> listByVid(String vid) {
        Query query = new Query();
        query.addCriteria(Criteria.where("vid").is(vid));
        return findList(query);
    }
 
 
 
    /**
     * 根据VideoId和Aid查找
     *
     * @param videoId
     * @param aid
     * @return
     */
    public long countByVideoIdAndAid(Long videoId, String aid) {
        Query query = new Query();
        query.addCriteria(Criteria.where("videoId").is(videoId).andOperator(Criteria.where("aid").is(aid)));
        return count(query);
    }
 
 
    public long countByVideoIdAndVid(Long videoId, String vid) {
        Query query = new Query();
        query.addCriteria(Criteria.where("videoId").is(videoId).andOperator(Criteria.where("vid").is(vid)));
        return count(query);
    }
 
 
    public long countByVideoId(Long videoId){
        Query query = new Query();
        query.addCriteria(Criteria.where("videoId").is(videoId));
        return count(query);
    }
 
 
}