From 51c0049fb70c85bf515dc0fecd96bf13ca23aa28 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 24 四月 2020 18:37:35 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java | 35 +++++++++++++++++++++++++++-------- 1 files changed, 27 insertions(+), 8 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java index 7c66830..f47eea4 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java @@ -316,27 +316,46 @@ */ @Override public int removePicture(GoodsSubClass record) throws Exception { - - String fileUrl = record.getPicture(); - int result = -2; - boolean deleteFile = true; - + String fileUrl = record.getPicture(); if (StringUtil.isNullOrEmpty(fileUrl)) { return result; } - deleteFile = COSManager.getInstance().deleteFile(fileUrl); - + boolean deleteFile = COSManager.getInstance().deleteFile(fileUrl);; if (deleteFile) { record.setPicture(null); // 鏇存柊鏁版嵁搴� result = goodsSubClassMapper.updateByPrimaryKey(record); } - return result; } + + @Override + public void switchState(Long id) throws GoodsSubClassException { + if (id == null) { + throw new GoodsSubClassException(1, "璇蜂紶閫掓纭弬鏁�"); + } + GoodsSubClass resultObj = goodsSubClassMapper.selectByPrimaryKey(id); + if (resultObj == null) { + throw new GoodsSubClassException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�"); + } + + Integer state = resultObj.getState(); + if (state == null || state == 0) { + state = 1; + } else { + state = 0; + } + + GoodsSubClass updateObj = new GoodsSubClass(); + updateObj.setId(id); + updateObj.setState(state); + goodsSubClassMapper.updateByPrimaryKeySelective(updateObj); + } + + @Override public List<GoodsSubClass> queryByRootId(Long rootId, Integer state) throws Exception { return goodsSubClassMapper.queryByRootId(rootId, state, null); -- Gitblit v1.8.0