1
phpcjl
2024-12-16 bfb346cff538786c63af7602665ec90f6455f3ea
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -1,6 +1,7 @@
package com.ruoyi.other.controller;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -45,7 +46,7 @@
    @Resource
    private UserCouponClient userCouponClient;
    @PostMapping("/list")
    @GetMapping("/list")
    @ApiOperation(value = "优惠劵管理-列表", tags = {"管理后台-活动管理"})
    public R<IPage<CouponInfo>> list(@RequestParam("pageNum") Integer pageNum,
                                     @RequestParam("pageSize") Integer pageSize,
@@ -60,7 +61,7 @@
    //查看详情
    @PostMapping("/detail")
    @GetMapping("/detail")
    @ApiOperation(value = "优惠劵管理-详情", tags = {"管理后台-活动管理"})
    public R<CouponInfo> detail(@RequestParam("id") Integer id) {
        CouponInfo byId = couponInfoService.getById(id);
@@ -79,6 +80,8 @@
    @PostMapping("/edit")
    @ApiOperation(value = "优惠劵管理-编辑", tags = {"管理后台-活动管理"})
    public R<Void> edit(@RequestBody CouponInfo couponInfo) {
        List<String> goodsNameList = couponInfo.getGoodsNameList();
        couponInfo.setGoodsNames(JSON.toJSONString(goodsNameList));
        couponInfoService.updateById(couponInfo);
        return R.ok();
    }
@@ -100,6 +103,8 @@
    @ApiOperation(value = "优惠劵管理-添加", tags = {"管理后台-活动管理"})
    public R<Void> add(@RequestBody CouponInfo couponInfo) {
        couponInfo.setShelfStatus(0);
        List<String> goodsNameList = couponInfo.getGoodsNameList();
        couponInfo.setGoodsNames(JSON.toJSONString(goodsNameList));
        couponInfoService.save(couponInfo);
        return R.ok();
    }