|
|
|
@ -103,8 +103,8 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
sql += "EXISTS (" +
|
|
|
|
|
"SELECT VALUE_FIELD " +
|
|
|
|
|
"FROM DM_DEVICE_INFO di " +
|
|
|
|
|
"WHERE di.DEVICE_ID = d.ID ";
|
|
|
|
|
sql += "AND di.KEY_FIELD = 'serial' " +
|
|
|
|
|
"WHERE di.DEVICE_ID = d.ID " +
|
|
|
|
|
"AND di.KEY_FIELD = 'serial' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ? ) ";
|
|
|
|
|
isSerialProvided = true;
|
|
|
|
|
}
|
|
|
|
@ -112,18 +112,18 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
if (serial != null) {
|
|
|
|
|
sql += "AND ";
|
|
|
|
|
}
|
|
|
|
|
int conditionCount = 0;
|
|
|
|
|
boolean firstCondition = true;
|
|
|
|
|
for (Map.Entry<String, String> entry : request.getCustomProperty().entrySet()) {
|
|
|
|
|
if (conditionCount > 0) {
|
|
|
|
|
if (!firstCondition) {
|
|
|
|
|
sql += "AND ";
|
|
|
|
|
}
|
|
|
|
|
sql += "EXISTS (" +
|
|
|
|
|
"SELECT VALUE_FIELD " +
|
|
|
|
|
"FROM DM_DEVICE_INFO di " +
|
|
|
|
|
"WHERE di.DEVICE_ID = d.ID ";
|
|
|
|
|
sql += "AND di.KEY_FIELD = '" + entry.getKey() + "' " +
|
|
|
|
|
"WHERE di.DEVICE_ID = d.ID " +
|
|
|
|
|
"AND di.KEY_FIELD = '" + entry.getKey() + "' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ? ) ";
|
|
|
|
|
conditionCount++;
|
|
|
|
|
firstCondition = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sql += "AND d.TENANT_ID = ? ";
|
|
|
|
@ -542,8 +542,8 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
sql += "AND EXISTS (" +
|
|
|
|
|
"SELECT VALUE_FIELD " +
|
|
|
|
|
"FROM DM_DEVICE_INFO di " +
|
|
|
|
|
"WHERE di.DEVICE_ID = d1.DEVICE_ID ";
|
|
|
|
|
sql += "AND di.KEY_FIELD = 'serial' " +
|
|
|
|
|
"WHERE di.DEVICE_ID = d1.DEVICE_ID " +
|
|
|
|
|
"AND di.KEY_FIELD = 'serial' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ?) ";
|
|
|
|
|
isSerialProvided = true;
|
|
|
|
|
}
|
|
|
|
|