Sort history query results by time in descending order.

Added `ORDER BY time DESC` to ensure that history query results are consistently returned with the most recent entries first. This update improves data clarity and usability for end-users.
This commit is contained in:
Teriuihi 2025-04-11 23:44:22 +02:00
parent 4b5a49b82a
commit 02c69b318a
2 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,7 @@ public interface NameHistoryMapper {
FROM ${tableName} AS punishment
INNER JOIN user_lookup ON user_lookup.uuid = punishment.uuid
WHERE ${name_column} LIKE #{partialName}
ORDER BY time DESC
LIMIT #{limit} OFFSET #{offset}
""")
List<HistoryRecord> getRecentHistory(@Param("tableName") String tableName,

View File

@ -32,6 +32,7 @@ public interface UUIDHistoryMapper {
INNER JOIN user_lookup
ON user_lookup.uuid = all_punishments.uuid
WHERE all_punishments.${uuid_column} = #{uuid}
ORDER BY time DESC
LIMIT #{limit} OFFSET #{offset}
""")
List<HistoryRecord> getRecentAllHistory(@Param("uuid") String uuid,
@ -56,6 +57,7 @@ public interface UUIDHistoryMapper {
FROM ${tableName} AS punishment
INNER JOIN user_lookup ON user_lookup.uuid = punishment.uuid
WHERE punishment.${uuid_column} = #{uuid}
ORDER BY time DESC
LIMIT #{limit} OFFSET #{offset}
""")
List<HistoryRecord> getRecentHistory(@Param("tableName") String tableName,