| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | List<ComShopFlowerGoodsAttrVO> goodsAttrList = new ArrayList<>(); |
| | | List<ComShopFlowerGoodsAttrDO> goodsAttrDOS = |
| | | shopFlowerGoodsAttrDAO.selectList(new QueryWrapper<ComShopFlowerGoodsAttrDO>().eq("goods_id", goodsId)); |
| | | List<String> images = new ArrayList<>(); |
| | | // List<String> images = new ArrayList<>(); |
| | | int stock = 0; |
| | | for (ComShopFlowerGoodsAttrDO attrDO : goodsAttrDOS) { |
| | | ComShopFlowerGoodsAttrVO goodsAttrVO = new ComShopFlowerGoodsAttrVO(); |
| | | BeanUtils.copyProperties(attrDO, goodsAttrVO); |
| | | String attrPic = attrDO.getAttrPic(); |
| | | images.add(attrPic); |
| | | // images.add(attrPic); |
| | | goodsAttrList.add(goodsAttrVO); |
| | | stock = stock +attrDO.getStock(); |
| | | } |
| | |
| | | BeanUtils.copyProperties(goodsDO, shopGoods); |
| | | shopGoods.setGoodsAttrList(goodsAttrList); |
| | | shopGoods.setConvenientMerchantVO(convenientMerchantVO); |
| | | shopGoods.setImages(StringUtils.join(images,",")); |
| | | // shopGoods.setImages(StringUtils.join(images,",")); |
| | | Integer orderNum = comShopFlowerOrderGoodsDAO.selectCount(new LambdaQueryWrapper<ComShopFlowerOrderGoodsDO>().eq(ComShopFlowerOrderGoodsDO::getGoodsId, goodsId)); |
| | | shopGoods.setOrderNum(orderNum); |
| | | List<ComShopFlowerEvaluateVO> comShopFlowerEvaluateVOList = comShopFlowerEvaluateDAO.selectListLimit(goodsId); |
| | | shopGoods.setShopFlowerEvaluateVOList(comShopFlowerEvaluateVOList); |
| | | Integer evaluateNum = comShopFlowerEvaluateDAO.selectCountByGoodsId(goodsId); |
| | | shopGoods.setEvaluateNum(evaluateNum); |
| | | |
| | | List<Long> categoryIds = convenientGoodsCategoryDAO.selectCategoryIdsForGoods(goodsId); |
| | | shopGoods.setCategoryIds(categoryIds); |
| | |
| | | ComShopFlowerGoodsDO shopGoodsDO = new ComShopFlowerGoodsDO(); |
| | | BeanUtils.copyProperties(addShopFlowerGoodsVO, shopGoodsDO); |
| | | shopGoodsDO.setOriginalPrice(addShopFlowerGoodsVO.getPrice()); |
| | | if (StrUtil.isEmpty(addShopFlowerGoodsVO.getImages())){ |
| | | shopGoodsDO.setImages(""); |
| | | } |
| | | int update = this.baseMapper.update(shopGoodsDO, query); |
| | | if (update < 1) { |
| | | throw new ServiceException("修改失败"); |