From 257d66798aa538f8737980f13d94c547bf0b51ea Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 15 一月 2025 15:37:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 14 +++++++++-----
1 files changed, 9 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..9a6fa18 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);
}
/**
@@ -155,6 +158,7 @@
if (StringUtils.isNotEmpty(goodsEvaluate.getPhone())&&StringUtils.isNotEmpty(goodsEvaluate.getUserName())){
// 取交集
usersNameList.retainAll(usersPhoneList);
+ if (usersNameList.isEmpty())usersNameList.add(-1L);
}else{
usersNameList.addAll(usersPhoneList);
}
--
Gitblit v1.7.1