huliguo
2025-04-10 905077448a20fe1f06c9303152e83a6c9463541c
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -14,6 +14,7 @@
import com.ruoyi.order.model.Order;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.mapper.GoodsEvaluateMapper;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.vo.GoodsEvaluateVO;
@@ -43,6 +44,8 @@
    @Resource
    private GoodsEvaluateService goodsEvaluateService;
    @Resource
    private GoodsEvaluateMapper goodsEvaluateMapper;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private GoodsService goodsService;
@@ -52,7 +55,19 @@
    private OrderClient orderClient;
    /**
     * 通过用户id和商品id查询评价id
     */
    @GetMapping("/getEvaluateIdByUserIdAndGoodId")
    public R<Long> getEvaluateIdByUserIdAndGoodId(@RequestParam("goodId") Integer goodId, @RequestParam("userId") Long userId) {
        GoodsEvaluate evaluate = goodsEvaluateMapper.selectOne(new LambdaQueryWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getGoodsId, goodId).eq(GoodsEvaluate::getAppUserId, userId));
        if (evaluate != null) {
            return R.ok(evaluate.getId());
        }
        return R.ok(null);
    }
    @GetMapping("/goodsList")
    @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
@@ -187,7 +202,7 @@
     * 评论详情
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理"})
    @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理","门店后台-订单-查看用户评价详情"})
    public R<GoodsEvaluate> getDetail(@PathVariable("id") Long id){
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
        buildDetail(goodsEvaluate);