Add todo for device count issue

pull/466/head
Rajitha Kumara 4 months ago
parent cd2ffa7cc5
commit 4fae9cf2e3

@ -3488,6 +3488,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} }
// todo: fix the join query
@Override @Override
public int getDeviceCountByDeviceIds(PaginationRequest paginationRequest, List<Integer> deviceIds, int tenantId) public int getDeviceCountByDeviceIds(PaginationRequest paginationRequest, List<Integer> deviceIds, int tenantId)
throws DeviceManagementDAOException { throws DeviceManagementDAOException {
@ -3500,8 +3501,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
boolean isDeviceNameProvided = false; boolean isDeviceNameProvided = false;
try { try {
Connection connection = getConnection(); Connection connection = getConnection();
String sql = "SELECT COUNT(DISTINCT e.DEVICE_ID) AS COUNT FROM DM_DEVICE d INNER JOIN DM_ENROLMENT e " + String sql = "SELECT COUNT(DISTINCT e.DEVICE_ID) FROM DM_ENROLMENT e " +
"WHERE d.ID = e.DEVICE_ID AND d.TENANT_ID = ? AND e.DEVICE_ID IN (" + deviceIdStringList+ ") " + "WHERE e.TENANT_ID = ? AND e.DEVICE_ID IN (" + deviceIdStringList+ ") " +
"AND e.STATUS NOT IN ('DELETED', 'REMOVED')"; "AND e.STATUS NOT IN ('DELETED', 'REMOVED')";
if (paginationRequest.getOwner() != null) { if (paginationRequest.getOwner() != null) {

Loading…
Cancel
Save