| | |
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsImgService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void switchState(Long id) throws BanLiShopGoodsException {
|
| | | if (id == null) {
|
| | | throw new BanLiShopGoodsException(1, "请传递正确参数");
|
| | | }
|
| | | BanLiShopGoods resultObj = banLiShopGoodsMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new BanLiShopGoodsException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Integer state = resultObj.getState();
|
| | | if (state == null || state == 0) {
|
| | | state = 1;
|
| | | } else {
|
| | | state = 0;
|
| | | }
|
| | | |
| | | BanLiShopGoods updateObj = new BanLiShopGoods();
|
| | | updateObj.setId(id);
|
| | | updateObj.setState(state);
|
| | | banLiShopGoodsMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 上传图片
|
| | |
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 文件路径
|
| | | String filePath="/img/BanLiShopGoods/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String filePath=FilePathEnum.banLiShopGoods.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | return fileLink;
|
| | |
| | | deleteByPrimaryKey(id);
|
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Transactional
|
| | | @Override
|