From ba94ceae1315174798ae1967ef62268c6d16cd5b Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期一, 06 十月 2025 22:07:06 +0800
Subject: [PATCH] feat: 评审与活动相关改动 - backend(GraphQL): Activity schema 增加 updateActivityState(id, state);实现 resolver/service 仅更新 state=2 作为逻辑删除 - backend(GraphQL): region.graphqls 新增 Query leafRegions - backend(GraphQL): player.graphqls 的 projectReviewApplications 增加可选参数 regionId - backend(Service): listProjectReviewApplications 绑定 regionId 参数,修复 QueryParameterException - frontend(web): 新增 api/activity.js 的 updateActivityState 并接入 activity-list 删除逻辑 - frontend(web): review-list.vue 权限仅校验登录,移除角色限制;查询参数修正为 name/regionId - frontend(web): 删除未引用的 ActivityList.vue - frontend(web): projectReviewNew.js GraphQL 查询增加 name 参数

---
 backend/src/main/java/com/rongyichuang/player/service/PlayerApplicationService.java |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/backend/src/main/java/com/rongyichuang/player/service/PlayerApplicationService.java b/backend/src/main/java/com/rongyichuang/player/service/PlayerApplicationService.java
index 03f19a7..442d5ec 100644
--- a/backend/src/main/java/com/rongyichuang/player/service/PlayerApplicationService.java
+++ b/backend/src/main/java/com/rongyichuang/player/service/PlayerApplicationService.java
@@ -23,11 +23,18 @@
     @SuppressWarnings("unchecked")
     public PageResponse<ActivityPlayerApplicationResponse> listApplications(String name, Long activityId, Integer state, Integer page, Integer size) {
         String baseSql =
-            "SELECT ap.id, CONCAT(p.name, '锛�', ap.project_name, '锛�') AS player_name, parent.name AS activity_name, ap.project_name AS project_name, p.phone AS phone, ap.create_time AS apply_time, ap.state AS state " +
+            "SELECT ap.id, p.name AS player_name, parent.name AS activity_name, ap.project_name AS project_name, p.phone AS phone, ap.create_time AS apply_time, ap.state AS state, " +
+            "COALESCE(rating_stats.rating_count, 0) AS rating_count, rating_stats.average_score " +
             "FROM t_activity_player ap " +
             "JOIN t_player p ON p.id = ap.player_id " +
             "JOIN t_activity stage ON stage.id = ap.stage_id " +
-            "JOIN t_activity parent ON parent.id = stage.pid ";
+            "JOIN t_activity parent ON parent.id = stage.pid " +
+            "LEFT JOIN (" +
+            "  SELECT activity_player_id, COUNT(*) AS rating_count, AVG(total_score) AS average_score " +
+            "  FROM t_activity_player_rating " +
+            "  WHERE state = 1 " +
+            "  GROUP BY activity_player_id" +
+            ") rating_stats ON rating_stats.activity_player_id = ap.id ";
         
         StringBuilder whereClause = new StringBuilder();
         boolean hasCondition = false;
@@ -76,6 +83,9 @@
         if (activityId != null) {
             q.setParameter("activityId", activityId);
         }
+        if (regionId != null) {
+            q.setParameter("regionId", regionId);
+        }
         if (state != null) {
             q.setParameter("state", state);
         }
@@ -119,7 +129,7 @@
      * 涓巐istApplications鐨勫尯鍒細涓嶈繃婊ゅ璧涘拰鍐宠禌闃舵
      */
     @SuppressWarnings("unchecked")
-    public PageResponse<ActivityPlayerApplicationResponse> listProjectReviewApplications(String name, Long activityId, Integer state, Integer page, Integer size) {
+    public PageResponse<ActivityPlayerApplicationResponse> listProjectReviewApplications(String name, Long activityId, Long regionId, Integer state, Integer page, Integer size) {
         String baseSql =
             "SELECT ap.id, CONCAT(p.name, '锛�', ap.project_name, '锛�') AS player_name, stage.name AS activity_name, ap.project_name AS project_name, p.phone AS phone, ap.create_time AS apply_time, ap.state AS state, " +
             "COALESCE(rating_stats.rating_count, 0) AS rating_count, rating_stats.average_score " +
@@ -152,6 +162,14 @@
             }
             // 鐩存帴鏌ヨ鎸囧畾闃舵ID鐨勬姤鍚嶉」鐩�
             whereClause.append("ap.stage_id = :activityId");
+            hasCondition = true;
+        }
+
+        if (regionId != null) {
+            if (hasCondition) {
+                whereClause.append(" AND ");
+            }
+            whereClause.append("ap.region_id = :regionId");
             hasCondition = true;
         }
         
@@ -190,6 +208,9 @@
         if (activityId != null) {
             q.setParameter("activityId", activityId);
         }
+        if (regionId != null) {
+            q.setParameter("regionId", regionId);
+        }
         if (state != null) {
             q.setParameter("state", state);
         }

--
Gitblit v1.8.0