| | |
| | | import cc.mrbird.febs.mall.dto.AddMallGoodsDto; |
| | | import cc.mrbird.febs.mall.dto.AddMallGoodsSkuDto; |
| | | import cc.mrbird.febs.mall.dto.UpMallGoodsDto; |
| | | import cc.mrbird.febs.mall.entity.MallGoods; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsSku; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsStyle; |
| | | import cc.mrbird.febs.mall.mapper.MallGoodsCategoryMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallGoodsMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallGoodsSkuMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallGoodsStyleMapper; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsService; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsDetailVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsSkuDetailVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsVo; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | private final MallGoodsMapper mallGoodsMapper; |
| | | private final MallGoodsSkuMapper mallGoodsSkuMapper; |
| | | private final MallGoodsStyleMapper mallGoodsStyleMapper; |
| | | private final MallGoodsImagesMapper mallGoodsImagesMapper; |
| | | |
| | | @Override |
| | | public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | |
| | | mallGoods.setCategoryId(addMallGoodsDto.getCategoryId()); |
| | | mallGoods.setPresentPrice(addMallGoodsDto.getPresentPrice()); |
| | | mallGoods.setIsHot(addMallGoodsDto.getIsHot()); |
| | | mallGoods.setIsSale(2); |
| | | mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED); |
| | | mallGoodsMapper.insert(mallGoods); |
| | | |
| | | String thumbs = addMallGoodsDto.getThumbs(); |
| | | if(StrUtil.isNotEmpty(thumbs)){ |
| | | List<String> imgs = StrUtil.splitTrim(thumbs, ","); |
| | | if(CollUtil.isNotEmpty(imgs)){ |
| | | int i = 1; |
| | | for(String img : imgs){ |
| | | MallGoodsImages mallGoodsImages = new MallGoodsImages(); |
| | | mallGoodsImages.setGoodsId(mallGoods.getId()); |
| | | mallGoodsImages.setImageUrl(img); |
| | | mallGoodsImages.setSeq(i); |
| | | mallGoodsImagesMapper.insert(mallGoodsImages); |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | List<AddMallGoodsSkuDto> addMallGoodsSkuDtos = addMallGoodsDto.getAddMallGoodsSkuDtos(); |
| | | if(CollUtil.isNotEmpty(addMallGoodsSkuDtos)){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse upMallGoods(UpMallGoodsDto upMallGoodsDto) { |
| | | Long id = upMallGoodsDto.getId(); |
| | | public FebsResponse upMallGoods(Long id) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallGoods)){ |
| | | return new FebsResponse().fail().message("商品不存在,请刷新当前页面"); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse downMallGoods(UpMallGoodsDto upMallGoodsDto) { |
| | | Long id = upMallGoodsDto.getId(); |
| | | public FebsResponse downMallGoods(Long id) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallGoods)){ |
| | | return new FebsResponse().fail().message("商品不存在,请刷新当前页面"); |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse delMallGoods(Long id) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallGoods)){ |
| | | return new FebsResponse().fail().message("商品不存在,请刷新当前页面"); |
| | | } |
| | | Integer isSale = mallGoods.getIsSale(); |
| | | if(MallGoods.ISSALE_STATUS_DISABLED != isSale){ |
| | | return new FebsResponse().fail().message("请先下架该商品"); |
| | | } |
| | | |
| | | mallGoodsStyleMapper.deleteByGoodsId(id); |
| | | mallGoodsSkuMapper.deleteByGoodsId(id); |
| | | mallGoodsMapper.deleteById(mallGoods); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public AdminMailGoodsDetailVo getMallGoodsInfoById(long id) { |
| | | AdminMailGoodsDetailVo adminMailGoodsDetailVo = mallGoodsMapper.selectMallGoodsInfoById(id); |
| | | List<AdminMailGoodsSkuDetailVo> adminMailGoodsSkuDetailVos = mallGoodsSkuMapper.selectByGoodId(id); |
| | | adminMailGoodsDetailVo.setMailGoodsSkuDetailVo(adminMailGoodsSkuDetailVos); |
| | | return adminMailGoodsDetailVo; |
| | | } |
| | | |
| | | |
| | | } |