From 207dc8655711cddac2653e18b51e58a88dba2084 Mon Sep 17 00:00:00 2001 From: yj <Administrator@192> Date: 星期五, 06 三月 2020 18:14:36 +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