From aa552facf6d833acab0d3e3e29bda2a0fb826ffe Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期一, 25 十一月 2019 16:14:13 +0800 Subject: [PATCH] 品牌缓存生效 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java index 1eafeef..6e2cf5f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java @@ -21,6 +21,7 @@ import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; import com.yeshi.fanli.entity.brand.BrandGoodsCahe; import com.yeshi.fanli.entity.brand.BrandInfo; +import com.yeshi.fanli.entity.brand.BrandShopCahe; import com.yeshi.fanli.entity.jd.JDGoods; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoShop; @@ -149,6 +150,13 @@ public void run() { int goodsTotal = brandGoodsCaheService.addBrandGoods(record); record.setGoodsTotal(goodsTotal); + + List<BrandShopCahe> listshop = brandShopCaheService.getByBrandId(record.getId()); + if (listshop == null) { + record.setShopTotal(0); + } else { + record.setShopTotal(listshop.size()); + } brandInfoMapper.updateByPrimaryKeySelective(record); } }); @@ -288,6 +296,13 @@ BrandInfo updateInfo = new BrandInfo(); updateInfo.setId(brandInfo.getId()); updateInfo.setGoodsTotal((int)goodsTotal); + List<BrandShopCahe> listshop = brandShopCaheService.getByBrandId(brandInfo.getId()); + if (listshop == null) { + updateInfo.setShopTotal(0); + } else { + updateInfo.setShopTotal(listshop.size()); + } + brandInfoMapper.updateByPrimaryKeySelective(updateInfo); } } @@ -310,6 +325,13 @@ brandInfo.setGoodsTotal(goodsTotal); brandInfo.setUpdateTime(new Date()); + + List<BrandShopCahe> listshop = brandShopCaheService.getByBrandId(brandInfo.getId()); + if (listshop == null) { + brandInfo.setShopTotal(0); + } else { + brandInfo.setShopTotal(listshop.size()); + } brandInfoMapper.updateByPrimaryKeySelective(brandInfo); } } @@ -332,7 +354,7 @@ return brandInfoMapper.listValidByCidToApp(cid); } -// @Cacheable(value = "brandCache", key = "'listValidToApp-'+#start+'-'+#start +'-'+#cid") + @Cacheable(value = "brandCache", key = "'listValidToApp-'+#start+'-'+#cid") @Override public List<BrandInfoVO> listValidToApp(long start, int count, Long cid) { List<BrandInfoVO> list = brandInfoMapper.listBrandInfoVO(start, count, cid); -- Gitblit v1.8.0