From 0ec22dcf4fd9c4496e6f681e7fab89f56c6e4e8a Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期四, 02 四月 2020 14:45:20 +0800 Subject: [PATCH] vip 消息 --- fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java index 04d7df4..7d8ad83 100644 --- a/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java +++ b/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java @@ -12,6 +12,8 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Repository; +import com.mongodb.BasicDBObject; +import com.mongodb.QueryOperators; import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; import com.yeshi.fanli.util.StringUtil; @@ -33,6 +35,21 @@ mongoTemplate.save(record); } + + /** + * 鍒犻櫎 + * @param record + */ + public void remove(GoodsEvaluate record) { + if (record == null) { + return; + } + mongoTemplate.remove(record); + } + + + + /** * 鏍规嵁id鏌ヨ鏁版嵁 * @@ -108,7 +125,7 @@ query.addCriteria(Criteria.where("startTime").lte(now)); query.addCriteria(Criteria.where("endTime").gte(now)); query.skip(start).limit(count); - query.with(new Sort(Sort.Direction.DESC,"weight")).with(new Sort(Sort.Direction.DESC,"createTime")); + query.with(new Sort(Sort.Direction.DESC,"weight")).with(new Sort(Sort.Direction.DESC,"startTime")); return mongoTemplate.find(query, GoodsEvaluate.class); } @@ -126,5 +143,53 @@ query.addCriteria(Criteria.where("endTime").gte(now)); return mongoTemplate.count(query, GoodsEvaluate.class); } + + + /** + * 鏌ヨ鏈夋晥 + * @param start + * @param count + * @param key + * @return + */ + public List<GoodsEvaluate> querySingleExist() { + Query query = new Query(); + query.addCriteria(Criteria.where("dynamicType").is(1)); + query.addCriteria(Criteria.where("state").is(1)); + query.addCriteria(Criteria.where("goods.goodsType").is(1)); + return mongoTemplate.find(query, GoodsEvaluate.class); + } + + + /** + * 鏌ヨ鏈夋晥 + * @param start + * @param count + * @param key + * @return + */ + public List<GoodsEvaluate> queryExist(int goodsType, Long goodsId) { + Query query = new Query(); + query.addCriteria(Criteria.where("dynamicType").is(1)); + query.addCriteria(Criteria.where("state").is(1)); + query.addCriteria(Criteria.where("imgList.goods.goodsId").is(goodsId)); + query.addCriteria(Criteria.where("imgList.goods.goodsType").is(goodsType)); + return mongoTemplate.find(query, GoodsEvaluate.class); + } + + /** + * 鏌ヨ鏈夋晥 + * @param start + * @param count + * @param key + * @return + */ + public List<GoodsEvaluate> queryOverdue() { + Date now = new Date(); + Query query = new Query(); + query.addCriteria(Criteria.where("endTime").lte(now)); + query.with(new Sort(Sort.Direction.ASC,"createTime")); + return mongoTemplate.find(query, GoodsEvaluate.class); + } } -- Gitblit v1.8.0