From 38b05ddd05dd4bd598ebe0a6391def5008de6613 Mon Sep 17 00:00:00 2001 From: gsd Date: Wed, 21 Feb 2024 19:41:48 +0300 Subject: [PATCH] jdbc migrate hot fix --- src/main/java/app/services/db/DiscordAuthService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/app/services/db/DiscordAuthService.java b/src/main/java/app/services/db/DiscordAuthService.java index 6077bf3..6a99369 100644 --- a/src/main/java/app/services/db/DiscordAuthService.java +++ b/src/main/java/app/services/db/DiscordAuthService.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -54,8 +55,9 @@ public class DiscordAuthService { } public List getAccountsNotInList(List discord_accounts) { - return jdbcTemplate.query("SELECT `discord_id` FROM `steam2discord` WHERE `active` = 1 AND `discord_id` in ?", - new Object[]{ discord_accounts }, + String inSql = String.join(",", Collections.nCopies(discord_accounts.size(), "?")); + return jdbcTemplate.query("SELECT `discord_id` FROM `steam2discord` WHERE `active` = 1 AND `discord_id` in (" + inSql + ")", + new Object[]{ discord_accounts.toArray() }, new RowMapper() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException {