admin
2020-10-10 81db7b3b070c003e6f5f0d1c757ab30b6f42c944
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
package com.yeshi.buwan.dao.video;
 
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import com.yeshi.buwan.domain.video.AlbumVideoMap;
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 AlbumVideoMapDao extends MongodbBaseDao<AlbumVideoMap> {
 
    /**
     * 根据视频ID查询
     *
     * @param videoIds
     * @return
     */
    public List<AlbumVideoMap> listByVideoIds(List<String> videoIds) {
        Query query = new Query();
        Criteria[] cts = new Criteria[videoIds.size()];
        for (int i = 0; i < videoIds.size(); i++) {
            cts[i] = Criteria.where("videoId").is(videoIds.get(i));
        }
        query.addCriteria(new Criteria().orOperator(cts));
        return findList(query);
    }
 
 
    /**
     * 拉取所有数据
     *
     * @param start
     * @param count
     * @return
     */
    public List<AlbumVideoMap> listAll(int start, int count) {
        Query query = new Query();
        query.skip(start);
        query.limit(count);
        return findList(query);
    }
 
 
    /**
     * 计算所有
     *
     * @return
     */
    public long countAll() {
        Query query = new Query();
        return count(query);
    }
 
 
    public AlbumVideoMap selectByVideoId(String videoId) {
        Query query = new Query();
        query.addCriteria(Criteria.where("videoId").is(videoId));
        return findOne(query);
    }
 
}