historique de toutes les parties
This commit is contained in:
@@ -169,6 +169,32 @@ public class GestionnaireBDD {
|
||||
return data.toArray(new Object[0][]);
|
||||
}
|
||||
|
||||
public Object[][] getHistoriqueParties() {
|
||||
String sql = "SELECT u.identifiant, p.date_partie, p.score, p.campagne_id, p.difficulte_id, p.duree " +
|
||||
"FROM parties p " +
|
||||
"JOIN utilisateurs u ON p.utilisateur_id = u.id " +
|
||||
"ORDER BY p.date_partie DESC";
|
||||
List<Object[]> data = new ArrayList<>();
|
||||
try (Statement stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(sql)) {
|
||||
while (rs.next()) {
|
||||
Object[] row = {
|
||||
rs.getString("identifiant"),
|
||||
new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm").format(rs.getTimestamp("date_partie")),
|
||||
rs.getInt("score"),
|
||||
rs.getInt("campagne_id"),
|
||||
rs.getInt("difficulte_id"),
|
||||
rs.getInt("duree")
|
||||
};
|
||||
data.add(row);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Erreur lors de la récupération de l'historique : " + e.getMessage());
|
||||
}
|
||||
return data.toArray(new Object[0][]);
|
||||
}
|
||||
|
||||
|
||||
public void fermerConnexion() {
|
||||
try {
|
||||
if (conn != null) {
|
||||
|
||||
Reference in New Issue
Block a user