founded_steamid.addAll(jdbcTemplate_ro.query("SELECT `steam_id` FROM `"+stringServerEntry.getValue().getDb()+"`."+"`user_connections` WHERE `connect_ip` in (SELECT `connect_ip` FROM `"+stringServerEntry.getValue().getDb()+"`."+"`user_connections` WHERE `steam_id` LIKE ? AND `connect_ip` NOT LIKE '10.%' GROUP BY `connect_ip` ORDER BY `id` DESC) GROUP BY `steam_id`",
//SELECT `steam_id` FROM `tf2.facti13.five`.`user_connections` WHERE `connect_ip` in (SELECT `connect_ip` FROM `tf2.facti13.five`.`user_connections` WHERE `steam_id` LIKE 'STEAM_0:0:63666481' AND `connect_ip` NOT LIKE '10.%' GROUP BY `connect_ip` ORDER BY `id` DESC) GROUP BY `steam_id`;
Stringsql="SELECT `steam_id` FROM `"+stringServerEntry.getValue().getDb()+"`."+"`user_connections` WHERE `connect_ip` in (SELECT `connect_ip` FROM `"+stringServerEntry.getValue().getDb()+"`."+"`user_connections` WHERE `steam_id` LIKE ? AND `connect_ip` NOT LIKE '10.%' GROUP BY `connect_ip` ORDER BY `id` DESC) GROUP BY `steam_id`";
returnjdbcTemplate_ro.query("SELECT `discord_id`, UNIX_TIMESTAMP(`timestamp`) as utime, `active` FROM `steam2discord` WHERE `steam_id` LIKE ? GROUP BY `discord_id`",
//SELECT CONCAT(SUBSTRING_INDEX(connect_ip,'.', 1),'.',SUBSTRING_INDEX(SUBSTRING_INDEX(connect_ip,'.', 2),'.',-1),'.',SUBSTRING_INDEX(SUBSTRING_INDEX(connect_ip,'.', 3),'.',-1),'.','%') FROM `all_users_con_2` WHERE `steam_id` LIKE 'STEAM_0:1:768781968';
List<DonateStatistic>donateStatistics=jdbcTemplate.query("SELECT `givemethod`,COUNT(*) as count,`reserved`, `amount` FROM `gived_vip` WHERE `givemethod` IN (0,1,2) AND `timestamp` > CAST(DATE_FORMAT(NOW() ,?) as DATE) GROUP BY `givemethod`, `amount`",
returnjdbcTemplate.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",
returnjdbcTemplate.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",
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 u.server_id like ? GROUP BY u.`weapon_index` DESC ORDER BY `c` DESC LIMIT ? OFFSET ?",
/*Longcount=(Long)createNativeQuery("SELECT COUNT(`weapon_index`) FROM `user_killfeed` WHERE `attacker_id` = ? AND server_id like ? GROUP BY `weapon_index`")
.setParameter(1,steamID.account_id)
@ -115,21 +84,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.`attacker_id` = ? AND u.`attacker_id` != u.`victim_id` AND u.`server_id` like ? ORDER BY u.`id` DESC LIMIT ? OFFSET ?",
Longcount=jdbcTemplate.query("SELECT COUNT(*) as c FROM `user_killfeed` WHERE `attacker_id` = ? AND `attacker_id` != `victim_id` AND `server_id` like ?",
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 ?",
Longcount=jdbcTemplate.query("SELECT COUNT(*) as c FROM `user_killfeed` WHERE `victim_id` = ? AND `attacker_id` != `victim_id` AND `server_id` like ?",
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<Message>result=jdbcTemplate.query("SELECT `account_id`,`utime`,`message`,`server_id` FROM `user_messages` WHERE `server_id` like ? AND `message` LIKE ? ORDER BY `user_messages`.`id` DESC LIMIT ? OFFSET ?",
List<Message>result=jdbcTemplate.query("SELECT `account_id`,`utime`,`message`,`server_id` FROM `user_messages` WHERE `account_id` = ? AND `server_id` like ? AND `message` LIKE ? ORDER BY `user_messages`.`id` DESC LIMIT ? OFFSET ?",
returnjdbcTemplate.query("SELECT `player_name` FROM `"+db+"`.`user_connections` WHERE `account_id` = ? ORDER BY `user_connections`.`id` DESC LIMIT 1;",
returnjdbcTemplate.query("SELECT id, flags, immunity, status, amount, UNIX_TIMESTAMP(`reg_date`) as utime as u_timestamp FROM sm_admins WHERE `identity` LIKE ?",
returnjdbcTemplate.query("select timestamp from `"+db+"`.`user_connections` WHERE map LIKE ? and connection_type LIKE ? AND account_id = ? ORDER BY `user_connections`.`id` DESC LIMIT 1",
returnjdbcTemplate.query("select sum(connect_duration) as total from `"+db+"`.`user_connections` WHERE map LIKE ? and connection_type LIKE ? AND account_id = ?",
steamID=jdbcTemplate.query("SELECT account_id FROM `"+stringServerEntry.getValue().getDb()+"`.`user_connections` WHERE player_name LIKE ? ORDER BY `id` DESC LIMIT 1",
@ -150,12 +128,7 @@ public class UsertimeService {
returnjdbcTemplate.query("SELECT * FROM `"+db+"`.`user_connections` WHERE account_id = ? AND connection_type LIKE ? ORDER BY `"+db+"`.`user_connections`.`id` DESC LIMIT ? OFFSET ?",
returnjdbcTemplate.query("SELECT `discord_id` FROM `sm_admins` INNER JOIN `steam2discord` ON `sm_admins`.`status` LIKE ? AND (`sm_admins`.`comment` LIKE ? OR `sm_admins`.`comment` LIKE ?) AND `sm_admins`.`identity` = `steam2discord`.`steam_id`",
returnjdbcTemplate.query("SELECT `discord_id` FROM `sm_admins` INNER JOIN `steam2discord` ON `sm_admins`.`status` LIKE ? AND `sm_admins`.`comment` LIKE ? AND `sm_admins`.`identity` = `steam2discord`.`steam_id`",
// Транзакция, проверка и удаление випок подшедших к концу
publicintremoveEndedVIPs(){
List<SteamID>steamid2remove=jdbcTemplate.query("SELECT `identity` FROM `sm_admins` WHERE NOT UNIX_TIMESTAMP(`reg_date`) LIKE 0 AND `amount` NOT LIKE 0 AND `status` LIKE ? AND ((unix_timestamp(now()) - UNIX_TIMESTAMP(`reg_date`)) > `amount`)",
intremoved_vips=jdbcTemplate.update("DELETE FROM `sm_admins` WHERE NOT UNIX_TIMESTAMP(`reg_date`) LIKE 0 AND `amount` NOT LIKE 0 AND `status` LIKE ? AND ((unix_timestamp(now()) - UNIX_TIMESTAMP(`reg_date`)) > `amount`)",
longban_count=jdbcTemplate.query("SELECT COUNT(*) as count FROM `light_bans` WHERE active = 1",(rs,n)->rs.getLong("count")).stream().findFirst().orElse(0L);
@ -56,12 +56,7 @@ public class VipCountUpdater extends BaseUpdater{
publicbooleanUpdateVIPCount(){
logger.info("Update current active VIP profiles");
Longcount=jdbcTemplate.query("SELECT COUNT(*) as count FROM `sm_admins` WHERE `status` LIKE 'VIP' AND (`comment` LIKE 'Donate.User' OR `comment` LIKE 'f13bot.User')",