浏览代码

bugfix: 优化代码逻辑

zhangchen 1 月之前
父节点
当前提交
8f7fd6d40c

+ 12 - 1
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

@@ -315,7 +315,18 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
         boolean flag = FunctionMagic.isListFlag(MIDs, UIDs);
         IPage<LifeUserViolation> iPage = new Page<>(page, size);
         QueryWrapper<LifeUserViolation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq(StringUtils.isNotEmpty(processingStatus), PROCESSING_STATUS, processingStatus).and(flag, wrapper -> wrapper.nested(wq -> wq.eq(REPORTING_USER_TYPE, "1").in(!MIDs.isEmpty(), REPORTING_USER_ID, MIDs)).or(wq -> wq.eq(REPORTING_USER_TYPE, "2").in(!UIDs.isEmpty(), REPORTING_USER_ID, UIDs))).orderByDesc("updated_time");
+        // 处理状态筛选
+        queryWrapper.eq(StringUtils.isNotEmpty(processingStatus), PROCESSING_STATUS, processingStatus);
+        // 举报人筛选(根据昵称或手机号)
+        if (flag) {
+            queryWrapper.and(wrapper -> wrapper
+                    .nested(wq -> wq.eq(REPORTING_USER_TYPE, "1")
+                            .in(!MIDs.isEmpty(), REPORTING_USER_ID, MIDs))
+                    .or(wq -> wq.eq(REPORTING_USER_TYPE, "2")
+                            .in(!UIDs.isEmpty(), REPORTING_USER_ID, UIDs)));
+        }
+        // 按更新时间倒序
+        queryWrapper.orderByDesc("updated_time");
         String commonReportContextType = "1,2,3";
         List<String> commonReportContextTypeList = Arrays.asList(commonReportContextType.split(","));
         queryWrapper.lambda().in(LifeUserViolation::getReportContextType, commonReportContextTypeList);