|
|
|
@ -100,11 +100,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
"INNER JOIN DM_DEVICE_TYPE t ON d.DEVICE_TYPE_ID = t.ID " +
|
|
|
|
|
"WHERE ";
|
|
|
|
|
if (serial != null) {
|
|
|
|
|
sql += "EXISTS ( " +
|
|
|
|
|
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 GenericDeviceDAOImpl 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() + "' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ? )";
|
|
|
|
|
conditionCount++;
|
|
|
|
|
"WHERE di.DEVICE_ID = d.ID " +
|
|
|
|
|
"AND di.KEY_FIELD = '" + entry.getKey() + "' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ? ) ";
|
|
|
|
|
firstCondition = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sql += "AND d.TENANT_ID = ? ";
|
|
|
|
@ -732,9 +732,9 @@ public class GenericDeviceDAOImpl 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' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ?)";
|
|
|
|
|
"WHERE di.DEVICE_ID = d1.DEVICE_ID " +
|
|
|
|
|
"AND di.KEY_FIELD = 'serial' " +
|
|
|
|
|
"AND di.VALUE_FIELD LIKE ?) ";
|
|
|
|
|
isSerialProvided = true;
|
|
|
|
|
}
|
|
|
|
|
if (!request.getCustomProperty().isEmpty()) {
|
|
|
|
|