1
phpcjl
2024-12-16 9814a8fa6387ac048423e489597f2d56ece54fd6
1
2个文件已修改
16 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/CouponInfo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/CouponInfo.java
@@ -142,6 +142,10 @@
    @TableField(exist = false)
    private List<String> goodsNameList;
    @TableField(exist = false)
    private List<Goods> goods;
    public String getIdStr(){
        return String.valueOf(id);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -12,7 +12,9 @@
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.CouponInfo;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.service.CouponInfoService;
import com.ruoyi.other.service.GoodsService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -21,6 +23,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.time.LocalDateTime;
@@ -45,6 +48,8 @@
    private AppUserClient appUserClient;
    @Resource
    private UserCouponClient userCouponClient;
    @Resource
    private GoodsService goodsService;
    @GetMapping("/list")
    @ApiOperation(value = "优惠劵管理-列表", tags = {"管理后台-活动管理"})
@@ -65,6 +70,13 @@
    @ApiOperation(value = "优惠劵管理-详情", tags = {"管理后台-活动管理"})
    public R<CouponInfo> detail(@RequestParam("id") Integer id) {
        CouponInfo byId = couponInfoService.getById(id);
        byId.setGoodsNameList(JSON.parseArray(byId.getGoodsNameJson(), String.class));
        String forGoodIds = byId.getForGoodIds();
        if (StringUtils.isNotEmpty(forGoodIds)){
            List<Goods> goods = goodsService.listByIds(Arrays.asList(forGoodIds.split(",")));
            byId.setGoods(goods);
        }
        return R.ok(byId);
    }