From 0b9eab450f484c397e9515f23c9954a1fe2f5065 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 14 一月 2025 11:05:02 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 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 5217eca..89470c5 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
@@ -131,7 +131,7 @@
         List<Long> usersNameList = new ArrayList<>();
         List<Long> usersPhoneList = new ArrayList<>();
 
-        if (StringUtils.isNotEmpty(goodsEvaluate.getUserName())) {
+        if (StringUtils.isNotEmpty(goodsEvaluate.getGoodsName())) {
             goodsIds = goodsService.lambdaQuery()
                     .like(Goods::getName, goodsEvaluate.getGoodsName())
                     .list().stream().map(Goods::getId).collect(Collectors.toList());
@@ -152,7 +152,12 @@
                 return R.ok(new Page<>());
             }
         }
-        usersNameList.retainAll(usersPhoneList);
+        if (StringUtils.isNotEmpty(goodsEvaluate.getPhone())&&StringUtils.isNotEmpty(goodsEvaluate.getUserName())){
+            // 取交集
+            usersNameList.retainAll(usersPhoneList);
+        }else{
+            usersNameList.addAll(usersPhoneList);
+        }
         Page<GoodsEvaluate> page = goodsEvaluateService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<GoodsEvaluate>()
                 .in(!goodsIds.isEmpty(), GoodsEvaluate::getGoodsId, goodsIds)
                 .in(!usersNameList.isEmpty(), GoodsEvaluate::getAppUserId, usersNameList)

--
Gitblit v1.7.1