From dc5be7d38446f70e6ff86df311119c32b41fe7f8 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 28 十一月 2020 16:37:05 +0800 Subject: [PATCH] 大淘客搜索接口升级 --- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java index c957007..8cc434f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java @@ -314,6 +314,30 @@ } @Override + public void switchState(Long id) throws GoodsClassException { + if (id == null) { + throw new GoodsClassException(1, "璇蜂紶閫掓纭弬鏁�"); + } + GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id); + if (resultObj == null) { + throw new GoodsClassException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�"); + } + + Integer state = resultObj.getState(); + if (state == null || state == 0) { + state = 1; + } else { + state = 0; + } + + GoodsClass updateObj = new GoodsClass(); + updateObj.setId(id); + updateObj.setState(state); + goodsClassMapper.updateByPrimaryKeySelective(updateObj); + } + + + @Override @Cacheable(value = "classCache", key = "'getEffectiveClassCache'") public List<GoodsClass> getEffectiveClassCache() { return goodsClassMapper.getEffectiveClass(); -- Gitblit v1.8.0