Browse Source

jdbc migrate clean up fix4

master
gsd 1 year ago
parent
commit
ffe99842b0
  1. 26
      src/main/java/app/services/db/KillfeedService.java
  2. 2
      src/main/java/app/services/db/UsertimeService.java

26
src/main/java/app/services/db/KillfeedService.java

@ -82,7 +82,7 @@ public class KillfeedService {
}
public Map getKills(SteamID steamID, String server_id, int offset, int limit) {
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.`attacker_id` = ? AND u.`attacker_id` != u.`victim_id` AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
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.`attacker_id` = ? AND u.`attacker_id` != u.`victim_id` AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
new Object[]{steamID.account_id, server_id == null || server_id.isEmpty() ? "%" : server_id, limit, offset},
(rs, n) -> new KillsInFeed(rs).setNicknames(nicknameService));
@ -95,7 +95,7 @@ public class KillfeedService {
}
public Map getDeads(SteamID steamID, String server_id, int offset, int limit) {
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.`victim_id` = ? AND u.`attacker_id` != u.`victim_id` AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
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.`victim_id` = ? AND u.`attacker_id` != u.`victim_id` AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
new Object[]{steamID.account_id, server_id == null || server_id.isEmpty() ? "%" : server_id, limit, offset},
(rs, n) -> new KillsInFeed(rs).setNicknames(nicknameService));
@ -107,7 +107,7 @@ public class KillfeedService {
}
public Map getAssists(SteamID steamID, String server_id, int offset, int limit) {
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.`assister_id` = ? AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
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.`assister_id` = ? AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
new Object[]{steamID.account_id, server_id == null || server_id.isEmpty() ? "%" : server_id, limit, offset},
(rs, n) -> new KillsInFeed(rs).setNicknames(nicknameService));
@ -131,9 +131,9 @@ public class KillfeedService {
}
HypeWeapons(ResultSet rs) throws SQLException {
count = rs.getLong(0);
name = rs.getString(1);
server_id = rs.getString(2);
count = rs.getLong(1);
name = rs.getString(2);
server_id = rs.getString(3);
}
}
@ -205,13 +205,13 @@ public class KillfeedService {
}
KillsInFeed(ResultSet rs) throws SQLException {
assister_id = rs.getInt(0);
victim_id = rs.getInt(1);
assister_id = rs.getInt(2);
utime = rs.getLong(3);
weapon_name = rs.getString(4);
server_id = rs.getString(5);
weapon_classname = rs.getString(6);
assister_id = rs.getInt(1);
victim_id = rs.getInt(2);
assister_id = rs.getInt(3);
utime = rs.getLong(4);
weapon_name = rs.getString(5);
server_id = rs.getString(6);
weapon_classname = rs.getString(7);
}
public KillsInFeed setNicknames(NicknameService nicknameService) {

2
src/main/java/app/services/db/UsertimeService.java

@ -137,7 +137,7 @@ public class UsertimeService {
if (db == null) return 0L;
return jdbcTemplate.query("SELECT count(id) FROM `"+db+"`.`user_connections` WHERE account_id = ? AND connection_type LIKE ?",
new Object[]{ steamID.account_id, "disconnect" },
(rs, n) -> rs.getLong(0))
(rs, n) -> rs.getLong(1))
.stream().findFirst().orElse(0L);
}
}

Loading…
Cancel
Save