| | |
| | | package com.yeshi.buwan.dao.juhe.pptv; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.pptv.PPTVQuery; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeriesProgramMap; |
| | | import com.yeshi.buwan.videos.pptv.PPTVQuery; |
| | | import com.yeshi.buwan.videos.pptv.entity.PPTVSeriesProgramMap; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | |
| | | if (pptvQuery.seriesCode != null) { |
| | | whereList.add(Criteria.where("seriesCode").is(pptvQuery.seriesCode)); |
| | | } |
| | | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "rank"))); |
| | | Criteria[] wheres = new Criteria[whereList.size()]; |
| | | whereList.toArray(wheres); |
| | | query.addCriteria(new Criteria().andOperator(wheres)); |
| | | query.skip(pptvQuery.start); |
| | | query.limit(pptvQuery.count); |
| | | List<Sort.Order> orders = new ArrayList<>(); |
| | | orders.add(new Sort.Order(Sort.Direction.ASC, "rank")); |
| | | query.with(new Sort(orders)); |
| | | |
| | | return findList(query); |
| | | } |
| | | |
| | |
| | | public PPTVSeriesProgramMap getLatestByInfoId(String infoId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("infoId").is(infoId)); |
| | | List<Sort.Order> orders = new ArrayList<>(); |
| | | orders.add(new Sort.Order(Sort.Direction.DESC, "rank")); |
| | | query.with(new Sort(orders)); |
| | | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "rank"))); |
| | | return findOne(query); |
| | | } |
| | | |