Improve device name search

license
Shamalka Navod 2 years ago committed by Pahansith Gunathilake
parent 94ac25deab
commit 3384b597f9

@ -1086,7 +1086,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
stmt.setInt(paramIdx++, groupId); stmt.setInt(paramIdx++, groupId);
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
if (isSinceProvided) { if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));
@ -1362,7 +1362,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
stmt.setString(paramIdx++, request.getDeviceType()); stmt.setString(paramIdx++, request.getDeviceType());
} }
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, request.getDeviceName() + "%"); stmt.setString(paramIdx++, "%" + request.getDeviceName() + "%");
} }
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {

@ -152,7 +152,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setString(paramIdx++, deviceType); stmt.setString(paramIdx++, deviceType);
} }
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {
@ -521,7 +521,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setInt(paramIdx++, groupId); stmt.setInt(paramIdx++, groupId);
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
if (isSinceProvided) { if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));

@ -152,7 +152,7 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setString(paramIdx++, deviceType); stmt.setString(paramIdx++, deviceType);
} }
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {
@ -501,7 +501,7 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setInt(paramIdx++, groupId); stmt.setInt(paramIdx++, groupId);
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
if (isSinceProvided) { if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));

@ -143,7 +143,7 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setString(paramIdx++, deviceType); stmt.setString(paramIdx++, deviceType);
} }
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {
@ -480,7 +480,7 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setInt(paramIdx++, groupId); stmt.setInt(paramIdx++, groupId);
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
if (isSinceProvided) { if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));

@ -153,7 +153,7 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setString(paramIdx++, deviceType); stmt.setString(paramIdx++, deviceType);
} }
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {
@ -500,7 +500,7 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setInt(paramIdx++, groupId); stmt.setInt(paramIdx++, groupId);
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, deviceName + "%"); stmt.setString(paramIdx++, "%" + deviceName + "%");
} }
if (isSinceProvided) { if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));

Loading…
Cancel
Save