Browse Source

jdbc migrate hot fix

master
gsd 1 year ago
parent
commit
38b05ddd05
  1. 6
      src/main/java/app/services/db/DiscordAuthService.java

6
src/main/java/app/services/db/DiscordAuthService.java

@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -54,8 +55,9 @@ public class DiscordAuthService {
} }
public List<String> getAccountsNotInList(List<String> discord_accounts) { public List<String> getAccountsNotInList(List<String> discord_accounts) {
return jdbcTemplate.query("SELECT `discord_id` FROM `steam2discord` WHERE `active` = 1 AND `discord_id` in ?", String inSql = String.join(",", Collections.nCopies(discord_accounts.size(), "?"));
new Object[]{ discord_accounts }, return jdbcTemplate.query("SELECT `discord_id` FROM `steam2discord` WHERE `active` = 1 AND `discord_id` in (" + inSql + ")",
new Object[]{ discord_accounts.toArray() },
new RowMapper<String>() { new RowMapper<String>() {
@Override @Override
public String mapRow(ResultSet rs, int rowNum) throws SQLException { public String mapRow(ResultSet rs, int rowNum) throws SQLException {

Loading…
Cancel
Save