Add fix for serial number search

fixes components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java
app-icon-change
osh 2 years ago
parent 7688aa375d
commit 7d6cfaa3b1

@ -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