Explorar el Código

fix(backend): 方案管理列表支持admin全量查看并按家庭筛选

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
E2E Test Bot hace 3 semanas
padre
commit
fe8cdf4a4f

+ 10 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/PlanReviewController.java

@@ -46,10 +46,18 @@ public class PlanReviewController {
             return Result.error("无权限");
         }
         String status = (String) body.get("status");
-        if (familyId == null) return Result.noFamily("请先创建或加入家庭");
+        Long filterFamilyId = familyId;
+        if ("admin".equals(role)) {
+            // 管理员可通过 body.familyId 指定家庭筛选;不指定则查看全部方案
+            filterFamilyId = ParamUtils.getLong(body.get("familyId"));
+        } else if (familyId == null) {
+            return Result.noFamily("请先创建或加入家庭");
+        }
         LambdaQueryWrapper<TaskPlanInstance> w = new LambdaQueryWrapper<TaskPlanInstance>()
-                .eq(TaskPlanInstance::getFamilyId, familyId)
                 .orderByDesc(TaskPlanInstance::getCreatedAt);
+        if (filterFamilyId != null) {
+            w.eq(TaskPlanInstance::getFamilyId, filterFamilyId);
+        }
         if (status != null && !status.isEmpty()) {
             w.eq(TaskPlanInstance::getStatus, status);
         }