admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
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();