From 50898a908596dac25cbe8f4d0c402d54290ed81d Mon Sep 17 00:00:00 2001 From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com> Date: 星期四, 29 八月 2024 14:30:53 +0800 Subject: [PATCH] 积分商品 1 --- src/main/java/com/mzl/flower/web/point/PointGoodsController.java | 71 +++++++++++++++++++++++++++++++++++ src/main/java/com/mzl/flower/constant/Constants.java | 15 +++++++ 2 files changed, 86 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/mzl/flower/constant/Constants.java b/src/main/java/com/mzl/flower/constant/Constants.java index d231a55..130e745 100644 --- a/src/main/java/com/mzl/flower/constant/Constants.java +++ b/src/main/java/com/mzl/flower/constant/Constants.java @@ -430,6 +430,21 @@ } } + public enum POINT_GOODS_STATUS { + A("上架"), + I("下架"); + + POINT_GOODS_STATUS(String desc) { + this.desc = desc; + } + + private String desc; + + public String getDesc() { + return desc; + } + } + public enum POINT_GOOD_STATUS { up("上架"), off("下架"); diff --git a/src/main/java/com/mzl/flower/web/point/PointGoodsController.java b/src/main/java/com/mzl/flower/web/point/PointGoodsController.java new file mode 100644 index 0000000..858b61b --- /dev/null +++ b/src/main/java/com/mzl/flower/web/point/PointGoodsController.java @@ -0,0 +1,71 @@ +package com.mzl.flower.web.point; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mzl.flower.base.BaseController; +import com.mzl.flower.base.R; +import com.mzl.flower.base.ReturnDataDTO; +import com.mzl.flower.constant.Constants; +import com.mzl.flower.dto.request.point.PointGoodsCreateDTO; +import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; +import com.mzl.flower.dto.request.point.PointGoodsUpdateDTO; +import com.mzl.flower.dto.response.point.PointGoodsDTO; +import com.mzl.flower.dto.response.point.PointGoodsListDTO; +import com.mzl.flower.service.point.PointGoodsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/point/goods") +@Api(value = "积分商品管理-运营端", tags = "积分商品管理-运营端") +@Validated +@Slf4j +public class PointGoodsController extends BaseController { + + @Autowired + private PointGoodsService pointGoodsService; + + @PostMapping("/list/new") + @ApiOperation(value = "新增商品") + public ResponseEntity<ReturnDataDTO> addPointGoods(@RequestBody PointGoodsCreateDTO dto) { + return returnData(R.SUCCESS.getCode(), pointGoodsService.addPointGoods(dto)); + } + + @PostMapping("/list/edit") + @ApiOperation(value = "编辑商品") + public ResponseEntity<ReturnDataDTO> updatePointGoods(@RequestBody PointGoodsUpdateDTO dto) { + return returnData(R.SUCCESS.getCode(), pointGoodsService.updatePointGoods(dto)); + } + + @GetMapping("/list") + @ApiOperation(value = "商品列表") + public ResponseEntity<ReturnDataDTO<Page<PointGoodsListDTO>>> selectGoodsList(Page page, PointGoodsQueryDTO dto){ + return returnData(R.SUCCESS.getCode(), pointGoodsService.selectGoodsList(page, dto)); + } + + @GetMapping("/list/view") + @ApiOperation(value = "商品详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") + }) + public ResponseEntity<ReturnDataDTO<PointGoodsDTO>> getGoodsInfo(Long id) { + return returnData(R.SUCCESS.getCode(), pointGoodsService.getGoodsInfo(id)); + } + + @GetMapping("/list/delete") + @ApiOperation(value = "商品删除") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") + }) + public ResponseEntity<ReturnDataDTO<?>> deletePointGoods(Long id) { + pointGoodsService.deletePointGoods(id); + return returnData(R.SUCCESS.getCode(), null); + } + +} -- Gitblit v1.9.3