From 940dd1b292db4c5cc2df2f137fa46c37f2159898 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 05 十二月 2024 18:06:01 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java index 2b55eaf..0f3f1b2 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java @@ -1,8 +1,21 @@ package com.ruoyi.other.controller; +import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.model.AppUser; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.other.api.domain.Goods; +import com.ruoyi.other.api.domain.GoodsEvaluate; +import com.ruoyi.other.service.GoodsEvaluateService; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -15,6 +28,22 @@ @RestController @RequestMapping("/goods-evaluate") public class GoodsEvaluateController { + @Resource + private GoodsEvaluateService goodsEvaluateService; + @Resource + private AppUserClient appUserClient; + + @GetMapping("/goodsList") + @ApiOperation(value = "商品评价", tags = {"小程序-商品评价"}) + public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){ + List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list(); + for (GoodsEvaluate goodsEvaluate : list) { + AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); + goodsEvaluate.setUserName(appUserById.getName()); + goodsEvaluate.setAvatar(appUserById.getAvatar()); + } + return R.ok(list); + } } -- Gitblit v1.7.1