huliguo
2025-04-17 19df67e19f23cd2a04d1c7f355e1e656f4140af4
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -56,12 +56,12 @@
    /**
     * 通过用户id和商品id查询评价id
     * 通过订单id查询评价id
     */
    @GetMapping("/getEvaluateIdByUserIdAndGoodId")
    public R<Long> getEvaluateIdByUserIdAndGoodId(@RequestParam("goodId") Integer goodId, @RequestParam("userId") Long userId) {
    @GetMapping("/getEvaluateIdByOrderId")
    public R<Long> getEvaluateIdByOrderId( @RequestParam("orderId") Long orderId) {
        GoodsEvaluate evaluate = goodsEvaluateMapper.selectOne(new LambdaQueryWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getGoodsId, goodId).eq(GoodsEvaluate::getAppUserId, userId));
                .eq(GoodsEvaluate::getOrderId, orderId).eq(GoodsEvaluate::getDelFlag,0).eq(GoodsEvaluate::getStatus,2));
        if (evaluate != null) {
            return R.ok(evaluate.getId());
        }
@@ -92,9 +92,9 @@
     */
    @PostMapping("/addGoodsEvaluate")
    @ApiOperation(value = "发布商品评价", tags = {"小程序-个人中心-我的订单"})
    public R<Void> addGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){
        goodsEvaluateService.addGoodsEvaluate(goodsEvaluate);
        return R.ok();
    public R addGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){
        return goodsEvaluateService.addGoodsEvaluate(goodsEvaluate);
    }
    /**
@@ -107,6 +107,9 @@
                .eq(GoodsEvaluate::getStatus, 2)
                .eq(GoodsEvaluate::getDelFlag, 0)
                .eq(GoodsEvaluate::getOrderId, orderId));
        if(evaluate==null){
            return R.fail("未评价");
        }
        Goods goods = goodsService.getById(evaluate.getGoodsId());
        evaluate.setGoodsName(goods.getName());
        evaluate.setGoodsImg(goods.getHomePagePicture());
@@ -195,6 +198,7 @@
        Goods goods = goodsService.getById(item.getGoodsId());
        if(null != goods){
            item.setGoodsName(goods.getName());
            item.setGoodsImg(goods.getHomePagePicture());
        }
    }
@@ -205,6 +209,9 @@
    @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理","门店后台-订单-查看用户评价详情"})
    public R<GoodsEvaluate> getDetail(@PathVariable("id") Long id){
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
        if (null==goodsEvaluate){
            return R.fail("未找到该评论");
        }
        buildDetail(goodsEvaluate);
        return R.ok(goodsEvaluate);
    }