|
|
@ -37,11 +37,11 @@ public class KillfeedService { |
|
|
|
public Long getKills(SteamID steamID, String server_id, Long utime) { |
|
|
|
return jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND attacker_id = ? AND attacker_id != victim_id AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND attacker_id = ? AND attacker_id != victim_id AND (? = 0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
utime==null?0:utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id==null||server_id.isEmpty()?null:server_id, |
|
|
|
server_id==null||server_id.isEmpty()?0:1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id }, |
|
|
|
(rs, n) -> rs.getLong("c")) |
|
|
|
.stream().findFirst().orElse(0L); |
|
|
@ -50,11 +50,11 @@ public class KillfeedService { |
|
|
|
public List<TopInFeed> 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 (? is null or server_id LIKE ?) " + |
|
|
|
"WHERE victim_id != attacker_id AND attacker_id != 0 AND (? =0 or server_id LIKE ?) " + |
|
|
|
"GROUP BY attacker_id, server_id " + |
|
|
|
"ORDER BY c DESC LIMIT 10", |
|
|
|
new Object[]{ |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id == null || server_id.isEmpty() ? "%" : server_id}, |
|
|
|
(rs, n) -> new TopInFeed(rs).setNicknames(nicknameService)); |
|
|
|
} |
|
|
@ -62,11 +62,11 @@ public class KillfeedService { |
|
|
|
public Long getDeads(SteamID steamID, String server_id, Long utime) { |
|
|
|
return jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND victim_id = ? AND attacker_id != victim_id AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND victim_id = ? AND attacker_id != victim_id AND (? =0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
utime==null?0:utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id }, |
|
|
|
(rs, n) -> rs.getLong("c")) |
|
|
|
.stream().findFirst().orElse(0L); |
|
|
@ -75,11 +75,11 @@ public class KillfeedService { |
|
|
|
public List<TopInFeed> 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 (? is null or server_id LIKE ?) " + |
|
|
|
"WHERE victim_id != attacker_id AND victim_id != 0 AND (? =0 or server_id LIKE ?) " + |
|
|
|
"GROUP BY victim_id, server_id " + |
|
|
|
"ORDER BY c DESC LIMIT 10", |
|
|
|
new Object[]{ |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id == null || server_id.isEmpty() ? "%" : server_id}, |
|
|
|
(rs, n) -> new TopInFeed(rs).setNicknames(nicknameService)); |
|
|
|
} |
|
|
@ -87,11 +87,11 @@ public class KillfeedService { |
|
|
|
public Long getSuicides(SteamID steamID, String server_id, Long utime) { |
|
|
|
return jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND victim_id = ? AND attacker_id = victim_id AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND victim_id = ? AND attacker_id = victim_id AND (? =0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
utime==null?0:utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id }, |
|
|
|
(rs, n) -> rs.getLong("c")) |
|
|
|
.stream().findFirst().orElse(0L); |
|
|
@ -100,11 +100,11 @@ public class KillfeedService { |
|
|
|
public Long getAssists(SteamID steamID, String server_id, Long utime) { |
|
|
|
return jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND assister_id = ? AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND assister_id = ? AND (? =0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
utime==null?0:utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id}, |
|
|
|
(rs, n) -> rs.getLong("c")) |
|
|
|
.stream().findFirst().orElse(0L); |
|
|
@ -114,12 +114,12 @@ public class KillfeedService { |
|
|
|
List<HypeWeapons> 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 (? is null or u.server_id like ?) " + |
|
|
|
"WHERE u.attacker_id = ? AND attacker_id != victim_id AND (? =0 or 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() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id, |
|
|
|
limit, |
|
|
|
offset }, |
|
|
@ -143,12 +143,12 @@ public class KillfeedService { |
|
|
|
List<KillsInFeed> result = jdbcTemplate.query("SELECT -1, u.victim_id, u.assister_id, u.utime, 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.utime > ? AND u.attacker_id = ? AND u.attacker_id != u.victim_id AND (? is null or u.server_id like ?) " + |
|
|
|
"WHERE u.utime > ? AND u.attacker_id = ? AND u.attacker_id != u.victim_id AND (? =0 or u.server_id like ?) " + |
|
|
|
"ORDER BY u.id DESC LIMIT ? OFFSET ?", |
|
|
|
new Object[]{ |
|
|
|
current_utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id == null || server_id.isEmpty() ? "%" : server_id, |
|
|
|
limit, |
|
|
|
offset}, |
|
|
@ -156,11 +156,11 @@ public class KillfeedService { |
|
|
|
|
|
|
|
Long count = jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND attacker_id = ? AND attacker_id != victim_id AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND attacker_id = ? AND attacker_id != victim_id AND (? =0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
current_utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id }, |
|
|
|
(rs, n) -> rs.getLong("c")) |
|
|
|
.stream().findFirst().orElse(0L); |
|
|
@ -179,12 +179,12 @@ public class KillfeedService { |
|
|
|
List<KillsInFeed> result = jdbcTemplate.query("SELECT u.attacker_id, -1, u.assister_id, u.utime, 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.utime > ? AND u.victim_id = ? AND u.attacker_id != u.victim_id AND (? is null or u.server_id like ?) " + |
|
|
|
"WHERE u.utime > ? AND u.victim_id = ? AND u.attacker_id != u.victim_id AND (? =0 or u.server_id like ?) " + |
|
|
|
"ORDER BY u.id DESC LIMIT ? OFFSET ?", |
|
|
|
new Object[]{ |
|
|
|
current_utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id == null || server_id.isEmpty() ? "%" : server_id, |
|
|
|
limit, |
|
|
|
offset}, |
|
|
@ -192,11 +192,11 @@ public class KillfeedService { |
|
|
|
|
|
|
|
Long count = jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND victim_id = ? AND attacker_id != victim_id AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND victim_id = ? AND attacker_id != victim_id AND (? =0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
current_utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id }, |
|
|
|
(rs, n) -> rs.getLong("c")).stream().findFirst().orElse(0L); |
|
|
|
|
|
|
@ -214,12 +214,12 @@ public class KillfeedService { |
|
|
|
List<KillsInFeed> result = jdbcTemplate.query("SELECT u.attacker_id, u.victim_id, -1, u.utime, 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.utime > ? AND u.assister_id = ? AND (? is null or u.server_id like ?) " + |
|
|
|
"WHERE u.utime > ? AND u.assister_id = ? AND (? =0 or u.server_id like ?) " + |
|
|
|
"ORDER BY u.id DESC LIMIT ? OFFSET ?", |
|
|
|
new Object[]{ |
|
|
|
current_utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id == null || server_id.isEmpty() ? "%" : server_id, |
|
|
|
limit, |
|
|
|
offset}, |
|
|
@ -227,11 +227,11 @@ public class KillfeedService { |
|
|
|
|
|
|
|
Long count = jdbcTemplate.query("SELECT COUNT(*) as c " + |
|
|
|
"FROM user_killfeed " + |
|
|
|
"WHERE utime > ? AND assister_id = ? AND (? is null or server_id like ?)", |
|
|
|
"WHERE utime > ? AND assister_id = ? AND (? =0 or server_id like ?)", |
|
|
|
new Object[]{ |
|
|
|
current_utime, |
|
|
|
steamID.account_id, |
|
|
|
server_id == null || server_id.isEmpty() ? null : server_id, |
|
|
|
server_id == null || server_id.isEmpty() ? 0 : 1, |
|
|
|
server_id==null||server_id.isEmpty()?"%":server_id }, |
|
|
|
(rs, n) -> rs.getLong("c")) |
|
|
|
.stream().findFirst().orElse(0L); |
|
|
|