|
|
@ -285,32 +285,37 @@ public class ApplicationDAOImpl implements ApplicationDAO {
|
|
|
|
"MEMORY_USAGE, " +
|
|
|
|
"MEMORY_USAGE, " +
|
|
|
|
"IS_ACTIVE, " +
|
|
|
|
"IS_ACTIVE, " +
|
|
|
|
"TENANT_ID " +
|
|
|
|
"TENANT_ID " +
|
|
|
|
"FROM DM_APPLICATION " +
|
|
|
|
"FROM DM_APPLICATION " +
|
|
|
|
"WHERE NOT EXISTS " +
|
|
|
|
"WHERE PLATFORM = ? AND " +
|
|
|
|
"(SELECT " +
|
|
|
|
"TENANT_ID = ? AND " +
|
|
|
|
"ID " +
|
|
|
|
"NOT EXISTS (SELECT ID " +
|
|
|
|
"FROM DM_APPLICATION A " +
|
|
|
|
"FROM DM_APPLICATION A " +
|
|
|
|
"WHERE A.NAME = DM_APPLICATION.NAME " +
|
|
|
|
"WHERE A.NAME = DM_APPLICATION.NAME " +
|
|
|
|
"AND A.ID < DM_APPLICATION.ID) " +
|
|
|
|
"AND A.ID < DM_APPLICATION.ID AND " +
|
|
|
|
"AND PLATFORM = ? " +
|
|
|
|
"PLATFORM = ? AND TENANT_ID = ?) ";
|
|
|
|
"AND TENANT_ID = ? ";
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String filter = request.getFilter();
|
|
|
|
String filter = request.getFilter();
|
|
|
|
if (filter != null) {
|
|
|
|
if (filter != null) {
|
|
|
|
sql = sql + "AND NAME LIKE ? ";
|
|
|
|
sql = sql + "AND NAME LIKE ? ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql = sql + "LIMIT ? OFFSET ?";
|
|
|
|
if (request != null && request.getRowCount() != -1) {
|
|
|
|
|
|
|
|
sql = sql + "LIMIT ? OFFSET ?";
|
|
|
|
|
|
|
|
}
|
|
|
|
Connection conn = this.getConnection();
|
|
|
|
Connection conn = this.getConnection();
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
int paramIdx = 1;
|
|
|
|
int paramIdx = 1;
|
|
|
|
stmt.setString(paramIdx++, request.getDeviceType());
|
|
|
|
stmt.setString(paramIdx++, request.getDeviceType());
|
|
|
|
stmt.setInt(paramIdx++, tenantId);
|
|
|
|
stmt.setInt(paramIdx++, tenantId);
|
|
|
|
|
|
|
|
stmt.setString(paramIdx++, request.getDeviceType());
|
|
|
|
|
|
|
|
stmt.setInt(paramIdx++, tenantId);
|
|
|
|
if (filter != null){
|
|
|
|
if (filter != null){
|
|
|
|
stmt.setString(paramIdx++, filter);
|
|
|
|
stmt.setString(paramIdx++, filter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stmt.setInt(paramIdx++, request.getRowCount());
|
|
|
|
if (request != null && request.getRowCount() != -1) {
|
|
|
|
stmt.setInt(paramIdx, request.getStartIndex());
|
|
|
|
stmt.setInt(paramIdx++, request.getRowCount());
|
|
|
|
|
|
|
|
stmt.setInt(paramIdx, request.getStartIndex());
|
|
|
|
|
|
|
|
}
|
|
|
|
try (ResultSet rs = stmt.executeQuery()) {
|
|
|
|
try (ResultSet rs = stmt.executeQuery()) {
|
|
|
|
while (rs.next()) {
|
|
|
|
while (rs.next()) {
|
|
|
|
application = loadApplication(rs);
|
|
|
|
application = loadApplication(rs);
|
|
|
|