From 744594ef1a2f530fc3e86ea9dc48b62247f79420 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 19 五月 2020 17:13:23 +0800 Subject: [PATCH] 饿了么绘图,添加口碑 --- fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 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 cd17ff6..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 @@ -41,7 +41,7 @@ return banLiShopGoodsSetsMapper.selectByPrimaryKey(id); } - @Transactional + @Transactional(rollbackFor=Exception.class) @Override public void addSet(BanLiShopGoodsSets set) throws BanLiShopGoodsSetException, BanLiShopGoodsSetPayException { if (set.getId() == null)// 娣诲姞 @@ -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