Codex Assistant
1 天以前 58d9f460b2f8c34430285115e2557d18333c5cab
backend/src/main/java/com/rongyichuang/player/service/PlayerApplicationService.java
@@ -23,10 +23,11 @@
    @SuppressWarnings("unchecked")
    public PageResponse<ActivityPlayerApplicationResponse> listApplications(String name, Long activityId, Integer state, Integer page, Integer size) {
        String baseSql =
            "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, " +
            "SELECT ap.id, p.name AS player_name, parent.name AS activity_name, ap.project_name AS project_name, u.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_user u ON u.id = p.user_id " +
            "JOIN t_activity stage ON stage.id = ap.stage_id " +
            "JOIN t_activity parent ON parent.id = stage.pid " +
            "LEFT JOIN (" +
@@ -83,6 +84,7 @@
        if (activityId != null) {
            q.setParameter("activityId", activityId);
        }
        if (state != null) {
            q.setParameter("state", state);
        }
@@ -126,12 +128,13 @@
     * 与listApplications的区别:不过滤复赛和决赛阶段
     */
    @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, " +
            "SELECT ap.id, CONCAT(p.name, '(', ap.project_name, ')') AS player_name, stage.name AS activity_name, ap.project_name AS project_name, u.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_user u ON u.id = p.user_id " +
            "JOIN t_activity stage ON stage.id = ap.stage_id " +
            "LEFT JOIN (" +
            "  SELECT activity_player_id, COUNT(*) AS rating_count, AVG(total_score) AS average_score " +
@@ -159,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;
        }
        
@@ -197,6 +208,9 @@
        if (activityId != null) {
            q.setParameter("activityId", activityId);
        }
        if (regionId != null) {
            q.setParameter("regionId", regionId);
        }
        if (state != null) {
            q.setParameter("state", state);
        }