|
|
|
@ -59,8 +59,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
|
|
|
|
|
"d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " +
|
|
|
|
|
"e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, " +
|
|
|
|
|
"d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t " +
|
|
|
|
|
"WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?";
|
|
|
|
|
"d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE " +
|
|
|
|
|
"FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt " +
|
|
|
|
|
"WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID";
|
|
|
|
|
|
|
|
|
|
//Add the query for device-type
|
|
|
|
|
if (deviceType != null && !deviceType.isEmpty()) {
|
|
|
|
@ -75,7 +76,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
|
|
|
|
|
//Add query for last updated timestamp
|
|
|
|
|
if (since != null) {
|
|
|
|
|
sql = sql + " AND d.LAST_UPDATED_TIMESTAMP > ?";
|
|
|
|
|
sql = sql + " AND dt.UPDATE_TIMESTAMP > ?";
|
|
|
|
|
isSinceProvided = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -109,7 +110,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
stmt.setString(paramIdx++, request.getDeviceName() + "%");
|
|
|
|
|
}
|
|
|
|
|
if (isSinceProvided) {
|
|
|
|
|
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));
|
|
|
|
|
stmt.setLong(paramIdx++, since.getTime());
|
|
|
|
|
}
|
|
|
|
|
stmt.setInt(paramIdx++, tenantId);
|
|
|
|
|
if (isOwnershipProvided) {
|
|
|
|
|