mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request 'Fix geofence search by partial name' (#282) from prathabanKavin/device-mgt-core:searchgeofencefix into master
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/282
This commit is contained in:
commit
c50c8d5907
@ -153,7 +153,7 @@ public abstract class AbstractGeofenceDAOImpl implements GeofenceDAO {
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
stmt.setInt(index++, tenantId);
|
||||
if (isNameProvided) {
|
||||
stmt.setString(index++, request.getProperty(DeviceManagementConstants.GeoServices.FENCE_NAME).toString() + "%");
|
||||
stmt.setString(index++, "%" + request.getProperty(DeviceManagementConstants.GeoServices.FENCE_NAME).toString() + "%");
|
||||
}
|
||||
stmt.setInt(index++, request.getRowCount());
|
||||
stmt.setInt(index, request.getStartIndex());
|
||||
@ -190,7 +190,7 @@ public abstract class AbstractGeofenceDAOImpl implements GeofenceDAO {
|
||||
"WHERE FENCE_NAME LIKE ?" +
|
||||
"AND TENANT_ID = ? ";
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
stmt.setString(1, fenceName + "%");
|
||||
stmt.setString(1, "%" + fenceName + "%");
|
||||
stmt.setInt(2, tenantId);
|
||||
try (ResultSet rst = stmt.executeQuery()) {
|
||||
geofenceData = extractGeofenceData(rst);
|
||||
|
||||
@ -143,7 +143,7 @@ public class GenericGeofenceDAOImpl extends AbstractGeofenceDAOImpl {
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
stmt.setInt(index++, tenantId);
|
||||
if (isNameProvided) {
|
||||
stmt.setString(index++, request.getProperty(DeviceManagementConstants.GeoServices.FENCE_NAME).toString() + "%");
|
||||
stmt.setString(index++, request.getProperty("%" + DeviceManagementConstants.GeoServices.FENCE_NAME).toString() + "%");
|
||||
}
|
||||
stmt.setInt(index++, request.getRowCount());
|
||||
stmt.setInt(index, request.getStartIndex());
|
||||
@ -180,7 +180,7 @@ public class GenericGeofenceDAOImpl extends AbstractGeofenceDAOImpl {
|
||||
"WHERE FENCE_NAME LIKE ?" +
|
||||
"AND TENANT_ID = ? ";
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
stmt.setString(1, fenceName + "%");
|
||||
stmt.setString(1,"%" + fenceName + "%");
|
||||
stmt.setInt(2, tenantId);
|
||||
try (ResultSet rst = stmt.executeQuery()) {
|
||||
geofenceData = extractGeofenceData(rst);
|
||||
|
||||
@ -71,7 +71,7 @@ public class SQLServerGeofenceDAOImpl extends AbstractGeofenceDAOImpl {
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
stmt.setInt(index++, tenantId);
|
||||
if (isNameProvided) {
|
||||
stmt.setString(index++, request.getProperty(DeviceManagementConstants.GeoServices.FENCE_NAME).toString() + "%");
|
||||
stmt.setString(index++, "%" + request.getProperty(DeviceManagementConstants.GeoServices.FENCE_NAME).toString() + "%");
|
||||
}
|
||||
stmt.setInt(index++, request.getStartIndex());
|
||||
stmt.setInt(index, request.getRowCount());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user