From 2a2f435d52d358cba6e239e29b586777678c2baf Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 14 一月 2025 14:22:25 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 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 89470c5..61cc917 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
@@ -8,6 +8,7 @@
 import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.order.feignClient.OrderClient;
 import com.ruoyi.order.model.Order;
@@ -56,10 +57,12 @@
 
     @GetMapping("/goodsList")
     @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
-    public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){
-        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0)
-                .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "").orderByDesc(GoodsEvaluate::getCreateTime).list();
-        for (GoodsEvaluate goodsEvaluate : list) {
+    public R<PageInfo<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId, Integer pageNum, Integer pageSize){
+        PageInfo<GoodsEvaluate> pageInfo = new PageInfo<>(pageNum, pageSize);
+        PageInfo<GoodsEvaluate> page = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0)
+                .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "")
+                .orderByDesc(GoodsEvaluate::getCreateTime).page(pageInfo);
+        for (GoodsEvaluate goodsEvaluate : page.getRecords()) {
             AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
             if(null != appUserById){
                 goodsEvaluate.setUserName(appUserById.getName());
@@ -67,7 +70,7 @@
                 goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
             }
         }
-        return R.ok(list);
+        return R.ok(page);
     }
 
     /**

--
Gitblit v1.7.1