From 5e7b0ed4a154ad067cbcf4aa1a1c7cce32f9864c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 26 四月 2024 18:02:17 +0800
Subject: [PATCH] 唯品会链接解析升级

---
 fanli/src/main/java/com/yeshi/fanli/dao/dynamic/ArticleOfficialDao.java |  318 ++++++++++++++++++++++++++--------------------------
 1 files changed, 159 insertions(+), 159 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/ArticleOfficialDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/ArticleOfficialDao.java
index 13c1044..212253b 100644
--- a/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/ArticleOfficialDao.java
+++ b/fanli/src/main/java/com/yeshi/fanli/dao/dynamic/ArticleOfficialDao.java
@@ -1,159 +1,159 @@
-package com.yeshi.fanli.dao.dynamic;
-
-import java.util.Date;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-
-import org.springframework.data.domain.Sort;
-import org.springframework.data.mongodb.core.MongoTemplate;
-import org.springframework.data.mongodb.core.query.Criteria;
-import org.springframework.data.mongodb.core.query.Query;
-import org.springframework.data.mongodb.core.query.Update;
-import org.springframework.stereotype.Repository;
-
-import com.yeshi.fanli.entity.dynamic.ArticleOfficial;
-import com.yeshi.fanli.util.StringUtil;
-import com.yeshi.fanli.vo.dynamic.ArticleVO;
-
-@Repository
-public class ArticleOfficialDao {
-
-	@Resource
-	private MongoTemplate mongoTemplate;
-
-	/**
-	 * 鏂板
-	 * 
-	 * @param record
-	 */
-	public void save(ArticleOfficial record) {
-		if (record == null) {
-			return;
-		}
-		mongoTemplate.save(record);
-	}
-	
-	/**
-	 * 鐘舵�佸垏鎹�
-	 * 
-	 * @param record
-	 */
-	public void updateSatate(String id, int state) {
-		Query query = new Query();
-		query.addCriteria(Criteria.where("id").is(id));
-		Update update = Update.update("state", state);
-		mongoTemplate.updateMulti(query, update, ArticleOfficial.class);
-	}
-
-	/**
-	 * 鏍规嵁id鏌ヨ鏁版嵁
-	 * 
-	 * @param id
-	 * @return
-	 */
-	public ArticleOfficial getById(String id) {
-		Query query = new Query();
-		query.addCriteria(Criteria.where("id").is(id));
-		return mongoTemplate.findOne(query, ArticleOfficial.class);
-	}
-	
-	
-	/**
-	 * 鍒犻櫎
-	 * 
-	 * @param id
-	 * @return
-	 */
-	public void deleteById(String id) {
-		ArticleOfficial info = getById(id);
-		if (info == null) {
-			return;
-		}
-		mongoTemplate.remove(info);
-	}
-
-	/**
-	 * 鏌ヨ
-	 * 
-	 * @return
-	 */
-	public List<ArticleOfficial> query(int start, int count, String key, Integer state) {
-		Query query = new Query();
-		if (state != null) {
-			query.addCriteria(Criteria.where("state").is(state));
-		}
-		if (!StringUtil.isNullOrEmpty(key))
-			query.addCriteria(new Criteria().orOperator(
-					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
-					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
-					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
-					    ));
-		// 鍒嗛〉
-        query.skip(start).limit(count);
-		query.with(new Sort(Sort.Direction.DESC,"weight"));
-		
-		return mongoTemplate.find(query, ArticleOfficial.class);
-	}
-
-	public long count(String key, Integer state) {
-		Query query = new Query();
-		if (state != null) {
-			query.addCriteria(Criteria.where("state").is(state));
-		}
-		if (!StringUtil.isNullOrEmpty(key))
-			query.addCriteria(new Criteria().orOperator(
-					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
-					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
-					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
-					    ));
-		return mongoTemplate.count(query, ArticleOfficial.class);
-	}
-
-	/**
-	 * 鏌ヨ鏈夋晥
-	 * @param start
-	 * @param count
-	 * @param key
-	 * @return
-	 */
-	public List<ArticleVO> queryValid(int start, int count, String key) {
-		Date now = new Date();
-		Query query = new Query();
-		query.addCriteria(Criteria.where("state").is(1));
-		query.addCriteria(Criteria.where("startTime").lte(now));
-		query.addCriteria(Criteria.where("endTime").gte(now));
-		if (!StringUtil.isNullOrEmpty(key))
-			query.addCriteria(new Criteria().orOperator(
-					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
-					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
-					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
-					    ));
-		  //鍒嗛〉
-        query.skip(start).limit(count);
-		query.with(new Sort(Sort.Direction.DESC,"weight")).with(new Sort(Sort.Direction.DESC,"createTime"));
-		return mongoTemplate.find(query, ArticleVO.class);
-	}
-
-	/**
-	 * 缁熻鏈夋晥
-	 * @param key
-	 * @return
-	 */
-	public long countValid(String key) {
-		Date now = new Date();
-		Query query = new Query();
-		query.addCriteria(Criteria.where("state").is(1));
-		query.addCriteria(Criteria.where("startTime").lte(now));
-		query.addCriteria(Criteria.where("endTime").gte(now));
-		if (!StringUtil.isNullOrEmpty(key))
-			query.addCriteria(new Criteria().orOperator(
-					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
-					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
-					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
-					    ));
-		return mongoTemplate.count(query, ArticleOfficial.class);
-	}
-
-}
+package com.yeshi.fanli.dao.dynamic;
+
+import java.util.Date;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+
+import org.springframework.data.domain.Sort;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.data.mongodb.core.query.Update;
+import org.springframework.stereotype.Repository;
+
+import com.yeshi.fanli.entity.dynamic.ArticleOfficial;
+import com.yeshi.fanli.util.StringUtil;
+import com.yeshi.fanli.vo.dynamic.ArticleVO;
+
+@Repository
+public class ArticleOfficialDao {
+
+	@Resource
+	private MongoTemplate mongoTemplate;
+
+	/**
+	 * 鏂板
+	 * 
+	 * @param record
+	 */
+	public void save(ArticleOfficial record) {
+		if (record == null) {
+			return;
+		}
+		mongoTemplate.save(record);
+	}
+	
+	/**
+	 * 鐘舵�佸垏鎹�
+	 * 
+	 * @param record
+	 */
+	public void updateSatate(String id, int state) {
+		Query query = new Query();
+		query.addCriteria(Criteria.where("id").is(id));
+		Update update = Update.update("state", state);
+		mongoTemplate.updateMulti(query, update, ArticleOfficial.class);
+	}
+
+	/**
+	 * 鏍规嵁id鏌ヨ鏁版嵁
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public ArticleOfficial getById(String id) {
+		Query query = new Query();
+		query.addCriteria(Criteria.where("id").is(id));
+		return mongoTemplate.findOne(query, ArticleOfficial.class);
+	}
+	
+	
+	/**
+	 * 鍒犻櫎
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public void deleteById(String id) {
+		ArticleOfficial info = getById(id);
+		if (info == null) {
+			return;
+		}
+		mongoTemplate.remove(info);
+	}
+
+	/**
+	 * 鏌ヨ
+	 * 
+	 * @return
+	 */
+	public List<ArticleOfficial> query(int start, int count, String key, Integer state) {
+		Query query = new Query();
+		if (state != null) {
+			query.addCriteria(Criteria.where("state").is(state));
+		}
+		if (!StringUtil.isNullOrEmpty(key))
+			query.addCriteria(new Criteria().orOperator(
+					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
+					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
+					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
+					    ));
+		// 鍒嗛〉
+        query.skip(start).limit(count);
+		query.with(new Sort(Sort.Direction.DESC,"weight"));
+		
+		return mongoTemplate.find(query, ArticleOfficial.class);
+	}
+
+	public long count(String key, Integer state) {
+		Query query = new Query();
+		if (state != null) {
+			query.addCriteria(Criteria.where("state").is(state));
+		}
+		if (!StringUtil.isNullOrEmpty(key))
+			query.addCriteria(new Criteria().orOperator(
+					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
+					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
+					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
+					    ));
+		return mongoTemplate.count(query, ArticleOfficial.class);
+	}
+
+	/**
+	 * 鏌ヨ鏈夋晥
+	 * @param start
+	 * @param count
+	 * @param key
+	 * @return
+	 */
+	public List<ArticleVO> queryValid(int start, int count, String key) {
+		Date now = new Date();
+		Query query = new Query();
+		query.addCriteria(Criteria.where("state").is(1));
+		query.addCriteria(Criteria.where("startTime").lte(now));
+		query.addCriteria(Criteria.where("endTime").gte(now));
+		if (!StringUtil.isNullOrEmpty(key))
+			query.addCriteria(new Criteria().orOperator(
+					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
+					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
+					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
+					    ));
+		  //鍒嗛〉
+        query.skip(start).limit(count);
+		query.with(new Sort(Sort.Direction.DESC,"weight")).with(new Sort(Sort.Direction.DESC,"createTime"));
+		return mongoTemplate.find(query, ArticleVO.class);
+	}
+
+	/**
+	 * 缁熻鏈夋晥
+	 * @param key
+	 * @return
+	 */
+	public long countValid(String key) {
+		Date now = new Date();
+		Query query = new Query();
+		query.addCriteria(Criteria.where("state").is(1));
+		query.addCriteria(Criteria.where("startTime").lte(now));
+		query.addCriteria(Criteria.where("endTime").gte(now));
+		if (!StringUtil.isNullOrEmpty(key))
+			query.addCriteria(new Criteria().orOperator(
+					       Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)),
+					       		new Criteria().andOperator(Criteria.where("content").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE))),
+					       		new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))
+					    ));
+		return mongoTemplate.count(query, ArticleOfficial.class);
+	}
+
+}

--
Gitblit v1.8.0