From aa02a165eea629fa89d1ff47531ce861cd9fa3bc Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 29 Sep 2021 10:50:56 +0800 Subject: [PATCH] fix --- src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java | 35 +++++++++++++++++++++++++++++------ 1 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java index 8e8f1d1..303bb24 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java @@ -7,6 +7,7 @@ import cc.mrbird.febs.common.entity.QueryRequest; import cc.mrbird.febs.common.utils.OssUtils; import cc.mrbird.febs.mall.dto.AddMallGoodsDto; +import cc.mrbird.febs.mall.dto.MallGoodsUpdateDto; import cc.mrbird.febs.mall.dto.UpMallGoodsDto; import cc.mrbird.febs.mall.entity.MallGoods; import cc.mrbird.febs.mall.entity.MallGoodsCategory; @@ -20,6 +21,7 @@ import sun.misc.BASE64Encoder; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -94,18 +96,39 @@ /** * 商品-上架 */ - @PostMapping("upMallGoods") + @GetMapping("upMallGoods/{id}") @ControllerEndpoint(operation = " 商品-上架", exceptionMessage = "上架失败") - public FebsResponse upMallGoods(@RequestBody @Valid UpMallGoodsDto upMallGoodsDto) { - return adminMallGoodsService.upMallGoods(upMallGoodsDto); + public FebsResponse upMallGoods(@NotNull(message = "{required}") @PathVariable Long id) { + return adminMallGoodsService.upMallGoods(id); } /** * 商品-下架 */ - @PostMapping("downMallGoods") + @GetMapping("downMallGoods/{id}") @ControllerEndpoint(operation = " 商品-下架", exceptionMessage = "下架失败") - public FebsResponse downMallGoods(@RequestBody @Valid UpMallGoodsDto upMallGoodsDto) { - return adminMallGoodsService.downMallGoods(upMallGoodsDto); + public FebsResponse downMallGoods(@NotNull(message = "{required}") @PathVariable Long id) { + return adminMallGoodsService.downMallGoods(id); } + + /** + * 商品-删除 + */ + @GetMapping("delMallGoods/{id}") + @ControllerEndpoint(operation = " 商品-删除", exceptionMessage = "删除失败") + public FebsResponse delMallGoods(@NotNull(message = "{required}") @PathVariable Long id) { + return adminMallGoodsService.delMallGoods(id); + } + + + /** + * 商品-编辑 + */ + @PostMapping("updateMallGoods") + @ControllerEndpoint(operation = "商品-编辑", exceptionMessage = "操作失败") + public FebsResponse updateMallGoods(@RequestBody @Valid MallGoodsUpdateDto mallGoodsUpdateDto) { + return adminMallGoodsService.updateMallGoods(mallGoodsUpdateDto); + } + + } -- Gitblit v1.9.1