From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandShopCaheDao.java |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandShopCaheDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandShopCaheDao.java
index de1fcd3..fb05451 100644
--- a/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandShopCaheDao.java
+++ b/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandShopCaheDao.java
@@ -1,5 +1,6 @@
 package com.yeshi.fanli.dao.brand;
 
+import java.util.Date;
 import java.util.List;
 
 import org.springframework.data.mongodb.core.query.Criteria;
@@ -11,6 +12,18 @@
 
 @Repository
 public class BrandShopCaheDao extends MongodbBaseDao<BrandShopCahe> {
+	
+	
+	/**
+	 * 鏂板
+	 * @param record
+	 */
+	public void insert(BrandShopCahe record) {
+		if (record == null) {
+			return;
+		}
+		mongoTemplate.insert(record);
+	}
 	
 	/**
 	 * 鏌ヨ鍝佺墝涓嬪簵閾�
@@ -25,4 +38,63 @@
         return mongoTemplate.find(query, BrandShopCahe.class);
 	}
 	
+	/**
+	 * 鏌ヨ鍝佺墝涓嬪簵閾�
+	 * @param brandId
+	 * @return
+	 */
+	public List<BrandShopCahe> getByBrandShop(Long brandId, int type){
+		if (brandId == null) 
+		    return null;
+		Query query = new Query();
+		query.addCriteria(
+        	    new Criteria().andOperator(
+        	        Criteria.where("brandId").is(brandId),
+        	        Criteria.where("shop.userType").is(type)
+        	        )
+            );
+        return mongoTemplate.find(query, BrandShopCahe.class);
+	}
+	
+	
+	/**
+	 * 鍝佺墝id
+	 * @param brandId
+	 */
+	public void removeByBrandId(Long brandId) {
+		Query query = new Query();
+		query.addCriteria(Criteria.where("brandId").is(brandId));
+        mongoTemplate.remove(query, BrandShopCahe.class);
+	}
+	
+	
+	/**
+	 * 鍒犻櫎鏍规嵁鏃堕棿
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public void removeByDate(Long brandId, int userType,Date createTime) {
+		Query query = new Query();
+		query.addCriteria(
+        	    new Criteria().andOperator(
+        	        Criteria.where("brandId").is(brandId),
+        	        Criteria.where("shop.userType").is(userType),
+        	        Criteria.where("createTime").lt(createTime)
+        	        )
+            );
+        mongoTemplate.remove(query, BrandShopCahe.class);
+	}
+	
+	/**
+	 * 鍒犻櫎鏍规嵁鏃堕棿
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public void removeAgoByDate(Date createTime) {
+		Query query = new Query();
+		query.addCriteria(Criteria.where("createTime").lt(createTime));
+        mongoTemplate.remove(query, BrandShopCahe.class);
+	}
 }

--
Gitblit v1.8.0