From 916f8851ccddff8ff764d950667b5fa86f77d7b2 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 24 四月 2020 18:16:50 +0800 Subject: [PATCH] 后台状态切换 --- fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java index de3ff95..8d09e1c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java @@ -136,7 +136,29 @@ } - + @Override + public void switchState(Long id) throws BanLiShopGoodsSetException { + if (id == null) { + throw new BanLiShopGoodsSetException(1, "璇蜂紶閫掓纭弬鏁�"); + } + BanLiShopGoodsSets resultObj = banLiShopGoodsSetsMapper.selectByPrimaryKey(id); + if (resultObj == null) { + throw new BanLiShopGoodsSetException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�"); + } + + Integer state = resultObj.getState(); + if (state == null || state == 0) { + state = 1; + } else { + state = 0; + } + + BanLiShopGoodsSets updateObj = new BanLiShopGoodsSets(); + updateObj.setId(id); + updateObj.setState(state); + banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(updateObj); + } + @Override public void updateSelectiveByPrimaryKey(BanLiShopGoodsSets set) { if (set.getId() == null) -- Gitblit v1.8.0