lrj
1 天以前 dc643ba44fd2a426263015491268a0f0d6b4671d
backend/src/main/java/com/rongyichuang/tools/MockDataInserter.java
@@ -48,14 +48,13 @@
                    userIds.add(uid);
                }
                // 3) 插入 20 个学员(audit_state=0 未审核)
                // 3) 插入 20 个学员
                List<Long> playerIds = new ArrayList<>();
                for (int i = 1; i <= 20; i++) {
                    long pid = insertPlayer(conn,
                            "学员" + i,
                            "1380013" + String.format("%04d", i),
                            1, // role_id
                            0, // audit_state 未审核
                            1, // state=1 正常
                            userIds.get(i - 1));
                    playerIds.add(pid);
@@ -131,15 +130,14 @@
        throw new SQLException("插入用户失败");
    }
    private long insertPlayer(Connection conn, String name, String phone, long roleId, int auditState, int state, long userId) throws SQLException {
        String sql = "INSERT INTO t_player (name, phone, role_id, audit_state, state, user_id) VALUES (?, ?, ?, ?, ?, ?)";
    private long insertPlayer(Connection conn, String name, String phone, long roleId, int state, long userId) throws SQLException {
        String sql = "INSERT INTO t_player (name, phone, role_id, state, user_id) VALUES (?, ?, ?, ?, ?)";
        try (PreparedStatement ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
            ps.setString(1, name);
            ps.setString(2, phone);
            ps.setLong(3, roleId);
            ps.setInt(4, auditState);
            ps.setInt(5, state);
            ps.setLong(6, userId);
            ps.setInt(4, state);
            ps.setLong(5, userId);
            ps.executeUpdate();
            try (ResultSet keys = ps.getGeneratedKeys()) {
                if (keys.next()) return keys.getLong(1);
@@ -148,9 +146,9 @@
        throw new SQLException("插入学员失败");
    }
    // 注意:表名为 t_avtivity_player(按 db.sql 拼写)
    // 插入活动报名数据
    private long insertActivityPlayer(Connection conn, long activityId, long playerId) throws SQLException {
        String sql = "INSERT INTO t_avtivity_player (activity_id, player_id) VALUES (?, ?)";
        String sql = "INSERT INTO t_activity_player (activity_id, player_id) VALUES (?, ?)";
        try (PreparedStatement ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
            ps.setLong(1, activityId);
            ps.setLong(2, playerId);