From d01f05e51f02d7b0505d2b11cab5e28c51c886c2 Mon Sep 17 00:00:00 2001 From: Vinojini Paramasivam Date: Wed, 22 Apr 2020 05:18:07 +0000 Subject: [PATCH] Generate ungrouped device report to a specific device type --- .../device/mgt/core/dao/impl/AbstractGroupDAOImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index 1060e30c3d..efb485065c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -837,7 +837,9 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { "ENROLMENT.STATUS " + "FROM DM_DEVICE AS DEVICE, DM_DEVICE_TYPE AS DEVICE_TYPE, DM_ENROLMENT " + "AS ENROLMENT " + - "WHERE DEVICE.ID NOT IN " + + "WHERE DEVICE_TYPE.NAME = ? AND DEVICE" + + ".ID " + + "NOT IN " + "(SELECT DEVICE_ID " + "FROM DM_DEVICE_GROUP_MAP " + "WHERE GROUP_ID IN (SELECT ID FROM DM_GROUP WHERE GROUP_NAME NOT IN (", @@ -846,6 +848,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { groupNames.stream().map(e -> "?").forEach(sql::add); try (PreparedStatement stmt = connection.prepareStatement(String.valueOf(sql))) { int index = 1; + stmt.setString(index++, paginationRequest.getDeviceType()); for (String groupName : groupNames) { stmt.setString(index++, groupName); }