From 2e8ead8f2472a7c2cf212ebcf57f4abddb5e28bf Mon Sep 17 00:00:00 2001 From: sathira Date: Tue, 5 Nov 2024 22:27:35 +0530 Subject: [PATCH] Add sql statement to filter devices according to last update time stamp in descending order --- .../device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index 7159c3d33c..e28f9a169b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -181,6 +181,8 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { sql += " GROUP BY e.ID "; } sql += ") "; + sql += " ORDER BY d1.LAST_UPDATED_TIMESTAMP DESC "; // <-- New order clause + sql += " LIMIT ? OFFSET ?"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { -- 2.36.3