Formatting the SQL query.

revert-70ac1926
MalshaPiumini 4 years ago
parent 60b59f455d
commit 6f325862ec

@ -271,7 +271,7 @@ public interface DeviceManagementService {
String ownership, String ownership,
@ApiParam( @ApiParam(
name = "serialNumber", name = "serialNumber",
value = "The serialNumber of the device.", value = "The serial number of the device.",
required = false) required = false)
@QueryParam("serialNumber") @QueryParam("serialNumber")
String serialNumber, String serialNumber,

@ -206,7 +206,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
RequestValidationUtil.validateOwnershipType(ownership); RequestValidationUtil.validateOwnershipType(ownership);
request.setOwnership(ownership); request.setOwnership(ownership);
} }
if (serialNumber != null && !serialNumber.isEmpty()) { if (StringUtils.isNotBlank(serialNumber)) {
request.setSerialNumber(serialNumber); request.setSerialNumber(serialNumber);
} }
if (status != null && !status.isEmpty()) { if (status != null && !status.isEmpty()) {

@ -94,8 +94,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
if (serial != null) { if (serial != null) {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.ID= i.DEVICE_ID " + "WHERE DEVICE_TYPE_ID = t.ID " +
"AND i.KEY_FIELD='serial' AND i.VALUE_FIELD = ? AND d.TENANT_ID = ? "; "AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true; isSerialProvided = true;
} else { } else {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? ";

@ -94,8 +94,11 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl {
if (serial != null) { if (serial != null) {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.ID= i.DEVICE_ID " + "WHERE DEVICE_TYPE_ID = t.ID " +
"AND i.KEY_FIELD='serial' AND i.VALUE_FIELD = ? AND d.TENANT_ID = ? "; "AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true; isSerialProvided = true;
} else { } else {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? ";

@ -93,8 +93,11 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl {
if (serial != null) { if (serial != null) {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.ID= i.DEVICE_ID " + "WHERE DEVICE_TYPE_ID = t.ID " +
"AND i.KEY_FIELD='serial' AND i.VALUE_FIELD = ? AND d.TENANT_ID = ? "; "AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true; isSerialProvided = true;
} else { } else {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? ";

@ -95,8 +95,11 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl {
if (serial != null) { if (serial != null) {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.ID= i.DEVICE_ID " + "WHERE DEVICE_TYPE_ID = t.ID " +
"AND i.KEY_FIELD='serial' AND i.VALUE_FIELD = ? AND d.TENANT_ID = ? "; "AND d.ID= i.DEVICE_ID " +
"AND i.KEY_FIELD = 'serial' " +
"AND i.VALUE_FIELD = ? " +
"AND d.TENANT_ID = ? ";
isSerialProvided = true; isSerialProvided = true;
} else { } else {
sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? ";

Loading…
Cancel
Save