admin
2022-04-16 04f09e52ffd4681bdfd85e51acd3da0d1280c3d3
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
package com.yeshi.buwan.dao.juhe.hanmi;
 
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode;
import org.springframework.data.domain.Sort;
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 HanmiShowEpisodeDao extends MongodbBaseDao<HanmiShowEpisode> {
 
 
    public List<HanmiShowEpisode> listByShowId(String showId, int start, int count) {
        Query query = new Query();
        query.addCriteria(Criteria.where("showId").is(showId));
        query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "orderBy")));
        return findList(query);
    }
 
 
 
    public HanmiShowEpisode getLatestEpisode(String showId) {
        Query query = new Query();
        query.addCriteria(Criteria.where("showId").is(showId));
        query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "orderBy")));
        query.limit(1);
        return findOne(query);
    }
 
    public long countByShowId(String showId) {
        Query query = new Query();
        query.addCriteria(Criteria.where("showId").is(showId));
        return count(query);
    }
 
 
}