|
|
@ -1184,6 +1184,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
String name = request.getDeviceName();
|
|
|
|
String name = request.getDeviceName();
|
|
|
|
String user = request.getOwner();
|
|
|
|
String user = request.getOwner();
|
|
|
|
String ownership = request.getOwnership();
|
|
|
|
String ownership = request.getOwnership();
|
|
|
|
|
|
|
|
String serial = request.getSerialNumber();
|
|
|
|
String query = null;
|
|
|
|
String query = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<Device> devices = new ArrayList<>();
|
|
|
|
List<Device> devices = new ArrayList<>();
|
|
|
@ -1197,6 +1198,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
boolean isDeviceNameProvided = false;
|
|
|
|
boolean isDeviceNameProvided = false;
|
|
|
|
boolean isOwnerProvided = false;
|
|
|
|
boolean isOwnerProvided = false;
|
|
|
|
boolean isOwnershipProvided = false;
|
|
|
|
boolean isOwnershipProvided = false;
|
|
|
|
|
|
|
|
boolean isSerialProvided = false;
|
|
|
|
|
|
|
|
|
|
|
|
StringJoiner joiner = new StringJoiner(",",
|
|
|
|
StringJoiner joiner = new StringJoiner(",",
|
|
|
|
"SELECT "
|
|
|
|
"SELECT "
|
|
|
@ -1219,6 +1221,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
+ "DM_DEVICE.TENANT_ID = e.TENANT_ID "
|
|
|
|
+ "DM_DEVICE.TENANT_ID = e.TENANT_ID "
|
|
|
|
+ "INNER JOIN (SELECT ID, NAME FROM DM_DEVICE_TYPE) AS device_types ON "
|
|
|
|
+ "INNER JOIN (SELECT ID, NAME FROM DM_DEVICE_TYPE) AS device_types ON "
|
|
|
|
+ "device_types.ID = DM_DEVICE.DEVICE_TYPE_ID "
|
|
|
|
+ "device_types.ID = DM_DEVICE.DEVICE_TYPE_ID "
|
|
|
|
|
|
|
|
+ "INNER JOIN DM_DEVICE_INFO i ON "
|
|
|
|
|
|
|
|
+ "DM_DEVICE.ID = i.DEVICE_ID "
|
|
|
|
|
|
|
|
+ "AND i.KEY_FIELD = 'serial' "
|
|
|
|
+ "WHERE DM_DEVICE.ID IN (",
|
|
|
|
+ "WHERE DM_DEVICE.ID IN (",
|
|
|
|
") AND DM_DEVICE.TENANT_ID = ? AND e.STATUS != ?");
|
|
|
|
") AND DM_DEVICE.TENANT_ID = ? AND e.STATUS != ?");
|
|
|
|
|
|
|
|
|
|
|
@ -1233,6 +1238,10 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
query += " AND e.OWNERSHIP = ?";
|
|
|
|
query += " AND e.OWNERSHIP = ?";
|
|
|
|
isOwnershipProvided = true;
|
|
|
|
isOwnershipProvided = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (serial != null && !serial.isEmpty()) {
|
|
|
|
|
|
|
|
query += " AND i.VALUE_FIELD LIKE ?" ;
|
|
|
|
|
|
|
|
isSerialProvided = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (user != null && !user.isEmpty()) {
|
|
|
|
if (user != null && !user.isEmpty()) {
|
|
|
|
query += " AND e.OWNER = ?";
|
|
|
|
query += " AND e.OWNER = ?";
|
|
|
|
isOwnerProvided = true;
|
|
|
|
isOwnerProvided = true;
|
|
|
@ -1257,6 +1266,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
if (isOwnershipProvided) {
|
|
|
|
if (isOwnershipProvided) {
|
|
|
|
ps.setString(index++, ownership);
|
|
|
|
ps.setString(index++, ownership);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isSerialProvided) {
|
|
|
|
|
|
|
|
ps.setString(index++, "%" + serial + "%");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (isOwnerProvided) {
|
|
|
|
if (isOwnerProvided) {
|
|
|
|
ps.setString(index++, user);
|
|
|
|
ps.setString(index++, user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|