From 08be42b2df021a35385432b35ca9abad9036b696 Mon Sep 17 00:00:00 2001 From: gsd Date: Sun, 22 Sep 2024 21:49:55 +0300 Subject: [PATCH] posgres support 8 --- src/main/java/app/services/db/KillfeedService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/app/services/db/KillfeedService.java b/src/main/java/app/services/db/KillfeedService.java index fb97463..cc4384d 100644 --- a/src/main/java/app/services/db/KillfeedService.java +++ b/src/main/java/app/services/db/KillfeedService.java @@ -42,7 +42,7 @@ public class KillfeedService { } public List getTopKills(String server_id) { - return jdbcTemplate.query("SELECT attacker_id, count(*) as c, server_id FROM user_killfeed WHERE victim_id != attacker_id AND attacker_id != 0 AND server_id LIKE ? GROUP BY attacker_id ORDER BY c DESC LIMIT 10", + return jdbcTemplate.query("SELECT attacker_id, count(*) as c, server_id FROM user_killfeed WHERE victim_id != attacker_id AND attacker_id != 0 AND server_id LIKE ? GROUP BY attacker_id, server_id ORDER BY c DESC LIMIT 10", new Object[]{server_id == null || server_id.isEmpty() ? "%" : server_id}, (rs, n) -> new TopInFeed(rs).setNicknames(nicknameService)); } @@ -55,7 +55,7 @@ public class KillfeedService { } public List getTopDeads(String server_id) { - return jdbcTemplate.query("SELECT victim_id, count(id) as c, server_id FROM user_killfeed WHERE victim_id != attacker_id AND victim_id != 0 AND server_id LIKE ? GROUP BY victim_id ORDER BY c DESC LIMIT 10", + return jdbcTemplate.query("SELECT victim_id, count(id) as c, server_id FROM user_killfeed WHERE victim_id != attacker_id AND victim_id != 0 AND server_id LIKE ? GROUP BY victim_id, server_id ORDER BY c DESC LIMIT 10", new Object[]{ server_id == null || server_id.isEmpty() ? "%" : server_id}, (rs, n) -> new TopInFeed(rs).setNicknames(nicknameService)); } @@ -75,7 +75,7 @@ public class KillfeedService { } public Map getPopulateWeapons(SteamID steamID, String server_id, int offset, int limit) { - List result = jdbcTemplate.query("SELECT COUNT(u.weapon_index) as c, i.name, u.server_id, u.weapon_classname FROM user_killfeed as u INNER JOIN tf2idb.tf2idb_item as i ON u.weapon_index = i.id WHERE u.attacker_id = ? AND attacker_id != victim_id AND u.server_id like ? GROUP BY u.weapon_index ORDER BY c DESC LIMIT ? OFFSET ?", + List result = jdbcTemplate.query("SELECT COUNT(u.weapon_index) as c, i.name, u.server_id, u.weapon_classname FROM user_killfeed as u INNER JOIN tf2idb.tf2idb_item as i ON u.weapon_index = i.id WHERE u.attacker_id = ? AND attacker_id != victim_id AND u.server_id like ? GROUP BY u.weapon_index, i.name, u.server_id, u.weapon_classname ORDER BY c DESC LIMIT ? OFFSET ?", new Object[]{ steamID.account_id, server_id==null||server_id.isEmpty()?"%":server_id, limit, offset }, (rs, n) -> new HypeWeapons(rs));