huliguo
2025-04-11 f103ac7bc4f2fbb20a0f2dd3ed97b0ac7fc5f46d
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -10,6 +10,7 @@
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.redis.annotation.DistributedLock;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.dto.AddGoodsDTO;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.vo.GoodsVO;
import io.swagger.annotations.*;
@@ -33,16 +34,20 @@
    @Resource
    private GoodsService goodsService;
    /**
     * 添加商品
     */
    @PostMapping("/addGoods")
    @ApiOperation(value = "发布商品", tags = {"管理后台-商品管理"})
    public R<Void> addGoods(@RequestBody Goods goods) {
        if(goods.getPurchaseLimit()==null){
       /* if(goods.getPurchaseLimit()==null){
            goods.setPurchaseLimit(-1);
        }
        goodsService.addGoods(goods);
        goodsService.addGoods(goods);*/
        return R.ok();
    }
@@ -85,7 +90,7 @@
    @PutMapping("/manageGoodsUpdate")
    @ApiOperation(value = "商品修改", tags = {"管理后台-商品管理"})
    public R<Void> manageGoodsUpdate(@RequestBody Goods goods){
        if(goods.getPurchaseLimit()==null){
    /*    if(goods.getPurchaseLimit()==null){
            goods.setPurchaseLimit(-1);
        }
        goodsService.updateManageGoods(goods);
@@ -98,7 +103,7 @@
            goodsLambdaUpdateWrapper.set(Goods::getDistributionMode,null);
            goodsLambdaUpdateWrapper.eq(Goods::getId, goods.getId());
            goodsService.update(goodsLambdaUpdateWrapper);
        }
        }*/
        return R.ok();
    }
@@ -180,14 +185,13 @@
    /**
     * 根据类型(1=服务商品,2=单品商品)获取商品数据
     * @param type
     * 获取商品数据
     * @return
     */
    @ResponseBody
    @PostMapping("/getGoodsByType")
    public R<List<Goods>> getGoodsByType(@RequestParam("type") Integer type){
        List<Goods> list = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getType, type).eq(Goods::getDelFlag, 0).eq(Goods::getStatus, 2));
    public R<List<Goods>> getGoodsByType(){
        List<Goods> list = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag, 0).eq(Goods::getStatus, 2));
        return R.ok(list);
    }