| | |
| | | * |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> query(int start, int count, String key, Integer state) { |
| | | public List<GoodsEvaluate> query(int start, int count, String key, Integer state, int dynamicType) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("dynamicType").is(dynamicType)); |
| | | if (state != null) { |
| | | query.addCriteria(Criteria.where("state").is(state)); |
| | | } |
| | |
| | | return mongoTemplate.find(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | public long count(String key, Integer state) { |
| | | public long count(String key, Integer state, int dynamicType) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("dynamicType").is(dynamicType)); |
| | | |
| | | if (state != null) { |
| | | query.addCriteria(Criteria.where("state").is(state)); |
| | | } |
| | |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> queryValid(int start, int count) { |
| | | public List<GoodsEvaluate> queryValid(int start, int count, int dynamicType) { |
| | | Date now = new Date(); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("state").is(dynamicType)); |
| | | query.addCriteria(Criteria.where("state").is(1)); |
| | | query.addCriteria(Criteria.where("startTime").lte(now)); |
| | | query.addCriteria(Criteria.where("endTime").gte(now)); |
| | |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public long countValid() { |
| | | public long countValid(int dynamicType) { |
| | | Date now = new Date(); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("dynamicType").is(dynamicType)); |
| | | query.addCriteria(Criteria.where("state").is(1)); |
| | | query.addCriteria(Criteria.where("startTime").lte(now)); |
| | | query.addCriteria(Criteria.where("endTime").gte(now)); |