SHA256
17 12 25
Промежуточная версия
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package shine.db.dao;
|
||||
|
||||
import shine.db.SqliteDbController;
|
||||
import shine.db.entities.ActiveSession;
|
||||
import shine.db.entities.ActiveSessionEntry;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -53,7 +53,7 @@ public final class ActiveSessionsDAO {
|
||||
/**
|
||||
* Вставка новой сессии.
|
||||
*/
|
||||
public void insert(ActiveSession session) throws SQLException {
|
||||
public void insert(ActiveSessionEntry session) throws SQLException {
|
||||
String sql = """
|
||||
INSERT INTO active_sessions (
|
||||
sessionId,
|
||||
@@ -94,7 +94,7 @@ public final class ActiveSessionsDAO {
|
||||
/**
|
||||
* Получить сессию по sessionId.
|
||||
*/
|
||||
public ActiveSession getBySessionId(String sessionId) throws SQLException {
|
||||
public ActiveSessionEntry getBySessionId(String sessionId) throws SQLException {
|
||||
String sql = """
|
||||
SELECT
|
||||
sessionId,
|
||||
@@ -128,7 +128,7 @@ public final class ActiveSessionsDAO {
|
||||
/**
|
||||
* Получить список всех активных сессий пользователя по loginId.
|
||||
*/
|
||||
public List<ActiveSession> getByLoginId(long loginId) throws SQLException {
|
||||
public List<ActiveSessionEntry> getByLoginId(long loginId) throws SQLException {
|
||||
String sql = """
|
||||
SELECT
|
||||
sessionId,
|
||||
@@ -148,7 +148,7 @@ public final class ActiveSessionsDAO {
|
||||
WHERE loginId = ?
|
||||
""";
|
||||
|
||||
List<ActiveSession> result = new ArrayList<>();
|
||||
List<ActiveSessionEntry> result = new ArrayList<>();
|
||||
|
||||
try (PreparedStatement ps = db.getConnection().prepareStatement(sql)) {
|
||||
ps.setLong(1, loginId);
|
||||
@@ -235,7 +235,7 @@ public final class ActiveSessionsDAO {
|
||||
/**
|
||||
* Маппинг ResultSet → ActiveSession (все 13 полей).
|
||||
*/
|
||||
private ActiveSession mapRow(ResultSet rs) throws SQLException {
|
||||
private ActiveSessionEntry mapRow(ResultSet rs) throws SQLException {
|
||||
String sessionId = rs.getString("sessionId");
|
||||
long loginId = rs.getLong("loginId");
|
||||
String sessionPwd = rs.getString("sessionPwd");
|
||||
@@ -250,7 +250,7 @@ public final class ActiveSessionsDAO {
|
||||
String clientInfoFromRequest = rs.getString("clientInfoFromRequest");
|
||||
String userLanguage = rs.getString("userLanguage");
|
||||
|
||||
return new ActiveSession(
|
||||
return new ActiveSessionEntry(
|
||||
sessionId,
|
||||
loginId,
|
||||
sessionPwd,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package shine.db.dao;
|
||||
|
||||
import shine.db.SqliteDbController;
|
||||
import shine.db.entities.SolanaUser;
|
||||
import shine.db.entities.SolanaUserEntry;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -36,7 +36,7 @@ public final class SolanaUsersDAO {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void insert(SolanaUser user) throws SQLException {
|
||||
public void insert(SolanaUserEntry user) throws SQLException {
|
||||
String sql = """
|
||||
INSERT INTO solana_users (login, loginId, bchId, loginKey, deviceKey, bchLimit)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
@@ -59,7 +59,7 @@ public final class SolanaUsersDAO {
|
||||
}
|
||||
}
|
||||
|
||||
public SolanaUser getByLoginId(long loginId) throws SQLException {
|
||||
public SolanaUserEntry getByLoginId(long loginId) throws SQLException {
|
||||
String sql = """
|
||||
SELECT login, loginId, bchId, loginKey, deviceKey, bchLimit
|
||||
FROM solana_users
|
||||
@@ -76,7 +76,7 @@ public final class SolanaUsersDAO {
|
||||
}
|
||||
}
|
||||
|
||||
public SolanaUser getByLogin(String login) throws SQLException {
|
||||
public SolanaUserEntry getByLogin(String login) throws SQLException {
|
||||
String sql = """
|
||||
SELECT login, loginId, bchId, loginKey, deviceKey, bchLimit
|
||||
FROM solana_users
|
||||
@@ -93,7 +93,7 @@ public final class SolanaUsersDAO {
|
||||
}
|
||||
}
|
||||
|
||||
public List<SolanaUser> searchByLoginPrefix(String prefix) throws SQLException {
|
||||
public List<SolanaUserEntry> searchByLoginPrefix(String prefix) throws SQLException {
|
||||
String sql = """
|
||||
SELECT login, loginId, bchId, loginKey, deviceKey, bchLimit
|
||||
FROM solana_users
|
||||
@@ -102,7 +102,7 @@ public final class SolanaUsersDAO {
|
||||
LIMIT 5
|
||||
""";
|
||||
|
||||
List<SolanaUser> result = new ArrayList<>();
|
||||
List<SolanaUserEntry> result = new ArrayList<>();
|
||||
|
||||
try (PreparedStatement ps = db.getConnection().prepareStatement(sql)) {
|
||||
ps.setString(1, prefix.toLowerCase() + "%");
|
||||
@@ -115,8 +115,8 @@ public final class SolanaUsersDAO {
|
||||
return result;
|
||||
}
|
||||
|
||||
private SolanaUser mapRow(ResultSet rs) throws SQLException {
|
||||
return new SolanaUser(
|
||||
private SolanaUserEntry mapRow(ResultSet rs) throws SQLException {
|
||||
return new SolanaUserEntry(
|
||||
rs.getLong("loginId"),
|
||||
rs.getString("login"),
|
||||
rs.getLong("bchId"),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package shine.db.dao;
|
||||
|
||||
import shine.db.SqliteDbController;
|
||||
import shine.db.entities.UserParam;
|
||||
import shine.db.entities.UserParamEntry;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -33,7 +33,7 @@ public final class UserParamsDAO {
|
||||
* Если запись существует -> обновляем поля.
|
||||
* Если нет -> вставляем новую запись.
|
||||
*/
|
||||
public void upsert(UserParam param) throws SQLException {
|
||||
public void upsert(UserParamEntry param) throws SQLException {
|
||||
String sql = """
|
||||
INSERT INTO users_params (
|
||||
loginId,
|
||||
@@ -68,7 +68,7 @@ public final class UserParamsDAO {
|
||||
/**
|
||||
* Получить параметр по loginId + param.
|
||||
*/
|
||||
public UserParam getByUserIdAndParam(long loginId, String paramName) throws SQLException {
|
||||
public UserParamEntry getByUserIdAndParam(long loginId, String paramName) throws SQLException {
|
||||
String sql = """
|
||||
SELECT
|
||||
loginId,
|
||||
@@ -95,7 +95,7 @@ public final class UserParamsDAO {
|
||||
/**
|
||||
* Получить все параметры пользователя.
|
||||
*/
|
||||
public List<UserParam> getByUserId(long loginId) throws SQLException {
|
||||
public List<UserParamEntry> getByUserId(long loginId) throws SQLException {
|
||||
String sql = """
|
||||
SELECT
|
||||
loginId,
|
||||
@@ -110,7 +110,7 @@ public final class UserParamsDAO {
|
||||
ORDER BY time_ms DESC
|
||||
""";
|
||||
|
||||
List<UserParam> result = new ArrayList<>();
|
||||
List<UserParamEntry> result = new ArrayList<>();
|
||||
|
||||
try (PreparedStatement ps = db.getConnection().prepareStatement(sql)) {
|
||||
ps.setLong(1, loginId);
|
||||
@@ -122,8 +122,8 @@ public final class UserParamsDAO {
|
||||
return result;
|
||||
}
|
||||
|
||||
private UserParam mapRow(ResultSet rs) throws SQLException {
|
||||
return new UserParam(
|
||||
private UserParamEntry mapRow(ResultSet rs) throws SQLException {
|
||||
return new UserParamEntry(
|
||||
rs.getLong("loginId"),
|
||||
rs.getString("param"),
|
||||
rs.getLong("bch_channel_id"),
|
||||
|
||||
Reference in New Issue
Block a user