From 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 04 七月 2020 15:38:00 +0800
Subject: [PATCH] 多系统兼容优化

---
 fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java |   72 ++++++++++++++++++------------------
 1 files changed, 36 insertions(+), 36 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 eb21b43..11c8c75 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
@@ -7,6 +7,7 @@
 
 import javax.annotation.Resource;
 
+import com.yeshi.fanli.entity.SystemEnum;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.query.Criteria;
@@ -37,11 +38,10 @@
 		mongoTemplate.save(record);
 	}
 
-	
 	/**
 	 * 鐘舵�佸垏鎹�
-	 * 
-	 * @param record
+	 * @param id
+	 * @param state
 	 */
 	public void updateSatate(String id, int state) {
 		Query query = new Query();
@@ -99,7 +99,7 @@
 	 * 
 	 * @return
 	 */
-	public List<GoodsEvaluate> query(int start, int count, String key, Integer state, int dynamicType, String typeEnum) {
+	public List<GoodsEvaluate> query(int start, int count, String key, Integer state, int dynamicType, String typeEnum, SystemEnum system) {
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
 		list.add(Criteria.where("dynamicType").is(dynamicType));
@@ -110,6 +110,9 @@
 		
 		if (!StringUtil.isNullOrEmpty(typeEnum))
 			list.add(Criteria.where("type").is(typeEnum));
+
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		
 		if (!StringUtil.isNullOrEmpty(key))
 			list.add(new Criteria().orOperator(
@@ -127,7 +130,7 @@
 		return mongoTemplate.find(query, GoodsEvaluate.class);
 	}
 
-	public long count(String key, Integer state, int dynamicType, String typeEnum) {
+	public long count(String key, Integer state, int dynamicType, String typeEnum, SystemEnum system) {
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
 		list.add(Criteria.where("dynamicType").is(dynamicType));
@@ -135,6 +138,9 @@
 		if (state != null) {
 			list.add(Criteria.where("state").is(state));
 		}
+
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		
 		if (!StringUtil.isNullOrEmpty(typeEnum))
 			list.add(Criteria.where("type").is(typeEnum));
@@ -157,10 +163,9 @@
 	 * 鏌ヨ鏈夋晥
 	 * @param start
 	 * @param count
-	 * @param key
 	 * @return
 	 */
-	public List<GoodsEvaluate> queryValid(int start, int count, int dynamicType) {
+	public List<GoodsEvaluate> queryValid(int start, int count, int dynamicType,SystemEnum system) {
 		Date now = new Date();
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
@@ -169,6 +174,8 @@
 		list.add(Criteria.where("state").is(1));
 		list.add(Criteria.where("startTime").lte(now));
 		list.add(Criteria.where("endTime").gte(now));
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		
 		if (list.size() > 0) {
 			Criteria[] cas = new Criteria[list.size()];
@@ -184,10 +191,9 @@
 
 	/**
 	 * 缁熻鏈夋晥
-	 * @param key
 	 * @return
 	 */
-	public long countValid(int dynamicType) {
+	public long countValid(int dynamicType,SystemEnum system) {
 		Date now = new Date();
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
@@ -196,6 +202,8 @@
 		list.add(Criteria.where("state").is(1));
 		list.add(Criteria.where("startTime").lte(now));
 		list.add(Criteria.where("endTime").gte(now));
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		
 		if (list.size() > 0) {
 			Criteria[] cas = new Criteria[list.size()];
@@ -209,18 +217,17 @@
 	
 	/**
 	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
 	 * @return
 	 */
-	public List<GoodsEvaluate> querySingleExist() {
+	public List<GoodsEvaluate> querySingleExist(SystemEnum system) {
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
 		
 		list.add(Criteria.where("dynamicType").is(1));
 		list.add(Criteria.where("state").is(1));
 		list.add(Criteria.where("goods.goodsType").is(1));
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		
 		if (list.size() > 0) {
 			Criteria[] cas = new Criteria[list.size()];
@@ -231,19 +238,21 @@
 		return mongoTemplate.find(query, GoodsEvaluate.class);
 	}
 	
-	
+
 	/**
 	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
+	 * @param goodsType
+	 * @param goodsId
+	 * @param system
 	 * @return
 	 */
-	public List<GoodsEvaluate> queryExist(int goodsType, String goodsId) {
+	public List<GoodsEvaluate> queryExist(int goodsType, String goodsId,SystemEnum system) {
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
 		list.add(Criteria.where("dynamicType").is(1));
 		list.add(Criteria.where("state").is(1));
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		list.add(Criteria.where("imgList.goods.goodsId").is(goodsId));
 		list.add(Criteria.where("imgList.goods.goodsType").is(goodsType));
 		
@@ -260,17 +269,16 @@
 	
 	/**
 	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
 	 * @return
 	 */
-	public List<GoodsEvaluate> queryExistSingle(int goodsType, String goodsId) {
+	public List<GoodsEvaluate> queryExistSingle(int goodsType, String goodsId,SystemEnum system) {
 		Query query = new Query();
 		List<Criteria> list = new ArrayList<Criteria>();
 		list.add(Criteria.where("dynamicType").is(1));
 		list.add(Criteria.where("state").is(1));
 		list.add(Criteria.where("type").is("single"));
+		if(system!=null)
+			list.add(Criteria.where("system").is(system));
 		list.add(Criteria.where("imgList.goods.goodsId").is(goodsId));
 		list.add(Criteria.where("imgList.goods.goodsType").is(goodsType));
 		
@@ -287,9 +295,6 @@
 	
 	/**
 	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
 	 * @return
 	 */
 	public List<GoodsEvaluate> queryOverdue() {
@@ -300,12 +305,8 @@
 		return mongoTemplate.find(query, GoodsEvaluate.class);
 	}
 	
-	
+
 	/**
-	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
 	 * @return
 	 */
 	public List<GoodsEvaluate> removeDownGoods() {
@@ -355,7 +356,6 @@
 	 * 鏌ヨ鏈夋晥-鍊掑簭
 	 * @param start
 	 * @param count
-	 * @param key
 	 * @return
 	 */
 	public List<GoodsEvaluate> queryValidSortASC(int start, int count, EvaluateEnum tyepEnum, boolean sortDesc) {
@@ -386,12 +386,12 @@
 		return mongoTemplate.find(query, GoodsEvaluate.class);
 	}
 
-	
+
 	/**
-	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
+	 *
+	 * @param goodsType
+	 * @param goodsId
+	 * @param limitTime
 	 * @return
 	 */
 	public List<GoodsEvaluate> queryExistLimitTime(int goodsType, String goodsId, Date limitTime) {

--
Gitblit v1.8.0