Add fix for serial number search

apim420
commit e2a21c292b

@ -97,7 +97,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
"WHERE DEVICE_TYPE_ID = t.ID " +
"AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND i.VALUE_FIELD LIKE ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true;
} else {
@ -141,7 +141,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIdx = 1;
if (isSerialProvided) {
stmt.setString(paramIdx++, serial);
stmt.setString(paramIdx++, "%" + serial + "%");
}
stmt.setInt(paramIdx++, tenantId);
if (isSinceProvided) {

@ -98,7 +98,7 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl {
"WHERE DEVICE_TYPE_ID = t.ID " +
"AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND i.VALUE_FIELD LIKE ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true;
} else {
@ -142,7 +142,7 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIdx = 1;
if (isSerialProvided) {
stmt.setString(paramIdx++, serial);
stmt.setString(paramIdx++, "%" + serial + "%");
}
stmt.setInt(paramIdx++, tenantId);
if (isSinceProvided) {

@ -97,7 +97,7 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
"WHERE DEVICE_TYPE_ID = t.ID " +
"AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND i.VALUE_FIELD LIKE ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true;
} else {
@ -136,7 +136,7 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIdx = 1;
if (isSerialProvided) {
stmt.setString(paramIdx++, serial);
stmt.setString(paramIdx++, "%" + serial + "%");
}
stmt.setInt(paramIdx++, tenantId);
if (isDeviceTypeProvided) {

@ -99,7 +99,7 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl {
"WHERE DEVICE_TYPE_ID = t.ID " +
"AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND i.VALUE_FIELD LIKE ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true;
} else {
@ -143,7 +143,7 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIdx = 1;
if (isSerialProvided) {
stmt.setString(paramIdx++, serial);
stmt.setString(paramIdx++, "%" + serial + "%");
}
stmt.setInt(paramIdx++, tenantId);
if (isSinceProvided) {

Loading…
Cancel
Save