Pu Zhibing
2025-01-14 60e22397096522ae48bc3af1f756c705f94d2d27
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -48,6 +48,9 @@
    @PostMapping("/addGoods")
    @ApiOperation(value = "发布商品", tags = {"管理后台-商品管理"})
    public R<Void> addGoods(@RequestBody Goods goods) {
        if(goods.getPurchaseLimit()==null){
            goods.setPurchaseLimit(-1);
        }
        goodsService.addGoods(goods);
        return R.ok();
    }
@@ -78,6 +81,9 @@
    @PutMapping("/manageGoodsUpdate")
    @ApiOperation(value = "商品修改", tags = {"管理后台-商品管理"})
    public R<Void> manageGoodsUpdate(@RequestBody Goods goods){
        if(goods.getPurchaseLimit()==null){
            goods.setPurchaseLimit(-1);
        }
        goodsService.updateManageGoods(goods);
        if (goods.getType()==2){
            goods.setAppointStore(2);
@@ -234,5 +240,16 @@
        goodsService.updateById(goods);
        return R.ok();
    }
    /**
     * 获取所有商品
     * @return
     */
    @PostMapping("/getAllGoods")
    public R<List<Goods>> getAllGoods(){
        List<Goods> list = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag, 0).eq(Goods::getStatus, 2));
        return R.ok(list);
    }
}