| | |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | |
| | | * @param show |
| | | * @return |
| | | */ |
| | | public List<FloatAD> list(Boolean show, int start, int count) { |
| | | public List<FloatAD> list(Boolean show, Date showTime, int start, int count) { |
| | | Query query = new Query(); |
| | | Criteria criteria = null; |
| | | if (show != null) |
| | | query.addCriteria(Criteria.where("show").is(show)); |
| | | criteria = Criteria.where("show").is(show); |
| | | |
| | | if (showTime != null) { |
| | | criteria = criteria.andOperator(Criteria.where("showEndTime").gt(showTime), Criteria.where("showStartTime").lte(showTime)); |
| | | } |
| | | |
| | | query.addCriteria(criteria); |
| | | List<Sort.Order> orders = new ArrayList<>(); |
| | | orders.add(new Sort.Order(Sort.Direction.DESC, "weight")); |
| | | query.with(new Sort(orders)); |