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);
|
}
|
|
}
|