xiaoyong931011
2023-10-17 e792d8a4c61b9797b9e91ce7106af1e0d3480162
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -335,13 +335,13 @@
        MallGoods mallGoods = mallGoodsMapper.selectById(mallGoodsUpdateDto.getId());
        // 若原来不为多规格或编辑后也不为多规格,则清空样式和规格
        if (mallGoods.getIsSku() == 2 || mallGoodsUpdateDto.getIsSku() == 2) {
        if (2 == mallGoodsUpdateDto.getIsSku()|| 2 == (mallGoods.getIsSku() == null ? 1 : mallGoods.getIsSku())) {
            mallGoodsSkuMapper.deleteByGoodsId(mallGoods.getId());
            mallGoodsStyleMapper.deleteByGoodsId(mallGoods.getId());
        }
        BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods);
        if (mallGoods.getHasCarriage() == 2) {
        if (2 == mallGoods.getHasCarriage()) {
            mallGoods.setCarriage(BigDecimal.ZERO);
        }
@@ -473,5 +473,27 @@
        return mallGoodsMapper.getAllGoodsTree();
    }
    @Override
    public FebsResponse goodsHot(Long id) {
        MallGoods mallGoods = mallGoodsMapper.selectById(id);
        if (ObjectUtil.isEmpty(mallGoods)) {
            return new FebsResponse().fail().message("商品不存在,请刷新当前页面");
        }
        mallGoods.setIsHot(MallGoods.ISHOT_STATE_YES);
        mallGoodsMapper.updateById(mallGoods);
        return new FebsResponse().success();
    }
    @Override
    public FebsResponse goodsNotHot(Long id) {
        MallGoods mallGoods = mallGoodsMapper.selectById(id);
        if (ObjectUtil.isEmpty(mallGoods)) {
            return new FebsResponse().fail().message("商品不存在,请刷新当前页面");
        }
        mallGoods.setIsHot(MallGoods.ISHOT_STATE_NO);
        mallGoodsMapper.updateById(mallGoods);
        return new FebsResponse().success();
    }
}