mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 08:50:51 +01:00
Merge branch 'chatlog-timestamp' into 'dev'
Fixed !146 Chatlog should be orderer by timestamp See merge request morningstar/Arcturus-Community!151
This commit is contained in:
commit
d0b673952a
@ -207,7 +207,7 @@ public class ModToolManager {
|
|||||||
public ArrayList<ModToolChatLog> getUserChatlog(int userId) {
|
public ArrayList<ModToolChatLog> getUserChatlog(int userId) {
|
||||||
ArrayList<ModToolChatLog> chatlogs = new ArrayList<>();
|
ArrayList<ModToolChatLog> chatlogs = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY timestamp DESC LIMIT 150")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY chatlogs_room.timestamp DESC LIMIT 150")) {
|
||||||
statement.setInt(1, userId);
|
statement.setInt(1, userId);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
@ -224,7 +224,7 @@ public class ModToolManager {
|
|||||||
public ArrayList<ModToolChatLog> getMessengerChatlog(int userOneId, int userTwoId) {
|
public ArrayList<ModToolChatLog> getMessengerChatlog(int userOneId, int userTwoId) {
|
||||||
ArrayList<ModToolChatLog> chatLogs = new ArrayList<>();
|
ArrayList<ModToolChatLog> chatLogs = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY timestamp DESC LIMIT 50")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY chatlogs_private.timestamp DESC LIMIT 50")) {
|
||||||
statement.setInt(1, userOneId);
|
statement.setInt(1, userOneId);
|
||||||
statement.setInt(2, userTwoId);
|
statement.setInt(2, userTwoId);
|
||||||
statement.setInt(3, userTwoId);
|
statement.setInt(3, userTwoId);
|
||||||
|
Loading…
Reference in New Issue
Block a user