Hentua
2023-06-12 2f34848f649b7d29f7697f8fe13b5e93c543c19a
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -109,8 +109,11 @@
        //新增商品
        MallGoods mallGoods = MallGoodsConversion.INSTANCE.dtoToEntity(addMallGoodsDto);
        mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED);
        if (StrUtil.isBlank(mallGoods.getPresentPrice())) {
            mallGoods.setPresentPrice(mallGoods.getOriginalPrice());
        }
        if (mallGoods.getHasCarriage() == 2) {
        if (mallGoods.getHasCarriage() == null || mallGoods.getHasCarriage() == 2) {
            mallGoods.setCarriage(BigDecimal.ZERO);
        }
        mallGoodsMapper.insert(mallGoods);
@@ -341,7 +344,7 @@
        }
        BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods);
        if (mallGoods.getHasCarriage() == 2) {
        if (mallGoodsUpdateDto.getHasCarriage() == 2) {
            mallGoods.setCarriage(BigDecimal.ZERO);
        }
@@ -473,5 +476,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();
    }
}