From db88b87df461820152d68d3d55a28f30c2da83e6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 20 九月 2019 17:54:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandShopCaheDao.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 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..46e3bc9 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,40 @@ 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); + } + + + /** + * 鍒犻櫎鏍规嵁鏃堕棿 + * + * @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); + } } -- Gitblit v1.8.0