save
This commit is contained in:
parent
43ccafa3e2
commit
5026c23897
6 changed files with 75 additions and 179 deletions
|
|
@ -16,16 +16,11 @@
|
|||
',"dio":'|| coalesce('"'||department_id_old::text||'"','null')||
|
||||
',"st":'|| coalesce('"'||system_pgs_status::text||'"','null')||'}')::jsonb
|
||||
)
|
||||
where ${clause};
|
||||
where id in ${endpointArguments} ${extraConditions};
|
||||
end
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -44,32 +39,27 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM subpoena_history where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena_appearance where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena_send_info where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena_history where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM subpoena_appearance where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
DELETE FROM subpoena_send_info where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
|
||||
DELETE FROM notification_item where restriction_document_item_id in (
|
||||
select id from restriction_document_item where restriction_document_create_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause})));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}))));
|
||||
DELETE FROM notification_item where restriction_document_item_id in (
|
||||
select id from restriction_document_item where restriction_document_cancel_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause})));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}))));
|
||||
|
||||
DELETE FROM restriction_document_item where restriction_document_create_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause}));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions})));
|
||||
DELETE FROM restriction_document_item where restriction_document_cancel_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause}));
|
||||
DELETE FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena where ${clause};
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions})));
|
||||
DELETE FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
DELETE FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -90,17 +80,12 @@
|
|||
BEGIN
|
||||
DELETE
|
||||
FROM incident_history
|
||||
where incident_id in (select id from incident where ${clause});
|
||||
DELETE FROM incident where ${clause};
|
||||
where incident_id in (select id from incident where recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
DELETE FROM incident where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -119,16 +104,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM notifications where ${clause};
|
||||
DELETE FROM notifications where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -147,7 +127,7 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
recruitIds uuid[] := '{${ids}}';
|
||||
recruitIds uuid[] := '{${endpointArguments}}';
|
||||
importIds uuid[] := ARRAY(SELECT import_id
|
||||
FROM import_results
|
||||
WHERE recruit_id = ANY (recruitIds));
|
||||
|
|
|
|||
|
|
@ -5,19 +5,14 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM summoned_list where ${clause};
|
||||
DELETE FROM recruit_active_list where ${clause};
|
||||
DELETE FROM documents where ${clause};
|
||||
DELETE FROM subpoena where ${clause};
|
||||
DELETE FROM summoned_list where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM recruit_active_list where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM documents where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>10.10.31.118</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -43,16 +38,11 @@
|
|||
,system_pgs_status = '1.2'
|
||||
,conscription = null
|
||||
,extra_info = extra_info - ('blocked')
|
||||
where ${clause};
|
||||
where id in ${endpointArguments} ${extraConditions};
|
||||
end
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>10.10.31.118</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
|
|||
|
|
@ -5,33 +5,28 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM subpoena_history where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena_appearance where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena_send_info where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena_history where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions});
|
||||
DELETE FROM subpoena_appearance where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions});
|
||||
DELETE FROM subpoena_send_info where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions});
|
||||
|
||||
DELETE FROM notification_item where restriction_document_item_id in (
|
||||
select id from restriction_document_item where restriction_document_create_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause})));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions})));
|
||||
DELETE FROM notification_item where restriction_document_item_id in (
|
||||
select id from restriction_document_item where restriction_document_cancel_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause})));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions})));
|
||||
|
||||
DELETE FROM restriction_document_item_history WHERE ${clause};
|
||||
DELETE FROM restriction_document_item_history WHERE recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM restriction_document_item where restriction_document_create_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause}));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
DELETE FROM restriction_document_item where restriction_document_cancel_id in (
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause}));
|
||||
DELETE FROM restriction_document where subpoena_id in (select id FROM subpoena where ${clause});
|
||||
DELETE FROM subpoena where ${clause};
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
DELETE FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions});
|
||||
DELETE FROM subpoena where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -51,16 +46,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM recruits WHERE ${clause};
|
||||
DELETE FROM recruits WHERE id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -79,21 +69,15 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM decision where ${clause};
|
||||
DELETE FROM foreign_decision where ${clause};
|
||||
DELETE FROM infringement where ${clause};
|
||||
DELETE FROM system_document where attachment_id in (SELECT id FROM attachment where ${clause}) ;
|
||||
DELETE FROM attachment where ${clause};
|
||||
DELETE FROM recruit where id = any (var1);
|
||||
DELETE FROM decision where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM foreign_decision where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM infringement where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM system_document where attachment_id in (SELECT id FROM attachment where recruit_id in ${endpointArguments} ${extraConditions}) ;
|
||||
DELETE FROM attachment where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -113,16 +97,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM recruit where ${clause};
|
||||
DELETE FROM recruit where id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -135,14 +114,13 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- FIX -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
recruitIds uuid[] := '{${ids}}';
|
||||
recruitIds uuid[] := '{${endpointArguments}}';
|
||||
importIds uuid[] := ARRAY(SELECT import_id
|
||||
FROM import_results
|
||||
WHERE recruit_id = ANY (recruitIds));
|
||||
|
|
@ -163,11 +141,6 @@
|
|||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -186,16 +159,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM notifications where ${clause};
|
||||
DELETE FROM notifications where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -216,18 +184,12 @@
|
|||
BEGIN
|
||||
DELETE
|
||||
FROM incident_history
|
||||
where incident_id in (select id from incident where ${clause});
|
||||
DELETE FROM incident where ${clause};
|
||||
DELETE FROM recruits where id = any (var1);
|
||||
where incident_id in (select id from incident where recruit_id in ${endpointArguments} ${extraConditions});
|
||||
DELETE FROM incident where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -247,16 +209,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM recruits where ${clause};
|
||||
DELETE FROM recruits where id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -275,30 +232,24 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM recruits_info where ${clause};
|
||||
DELETE FROM recruit_xml_data where ${clause};
|
||||
DELETE FROM recruits_history where ${clause};
|
||||
DELETE FROM application where ${clause};
|
||||
DELETE FROM department_history where ${clause};
|
||||
DELETE FROM documents where ${clause};
|
||||
DELETE FROM decision where ${clause};
|
||||
DELETE FROM personal_documents where ${clause};
|
||||
DELETE FROM recruit_private_file where ${clause};
|
||||
DELETE FROM system_documents where ${clause};
|
||||
DELETE FROM system_document_dto where ${clause};
|
||||
DELETE FROM subpoena_dto where ${clause};
|
||||
DELETE FROM attachments where ${clause};
|
||||
DELETE FROM summoned_list where ${clause};
|
||||
DELETE FROM recruits where id = any (var1);
|
||||
DELETE FROM recruits_info where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM recruit_xml_data where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM recruits_history where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM application where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM department_history where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM documents where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM decision where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM personal_documents where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM recruit_private_file where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM system_documents where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM system_document_dto where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM subpoena_dto where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM attachments where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM summoned_list where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -318,16 +269,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM recruits where ${clause};
|
||||
DELETE FROM recruits where id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -346,17 +292,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM appeal_document where ${clause};
|
||||
DELETE FROM recruit where id = any (var1);
|
||||
DELETE FROM appeal_document where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -376,16 +316,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM recruit where ${clause};
|
||||
DELETE FROM recruit where id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -404,16 +339,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
delete from cruit_extract where ${clause};
|
||||
delete from cruit_extract where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
@ -432,16 +362,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
delete from application_info where ${clause};
|
||||
delete from application_info where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<RequestArguments>
|
||||
<RequestArgument>
|
||||
<Id>recruit_id</Id>
|
||||
</RequestArgument>
|
||||
</RequestArguments>
|
||||
<SqlConnectionParams>
|
||||
<JdbcHost>localhost</JdbcHost>
|
||||
<JdbcPort>5432</JdbcPort>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
,system_pgs_status = '1.2'
|
||||
,conscription = null
|
||||
,extra_info = extra_info - ('blocked')
|
||||
where ${clause};
|
||||
where id in ${endpointArguments} ${extraConditions};
|
||||
end
|
||||
$$;
|
||||
]]>
|
||||
|
|
|
|||
0
сonfig-data-executor/output.log
Normal file
0
сonfig-data-executor/output.log
Normal file
|
|
@ -8,11 +8,9 @@ import java.sql.Connection;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.arangodb.ArangoCursor;
|
||||
import com.arangodb.ArangoDBException;
|
||||
|
|
@ -132,22 +130,25 @@ public class RequestService {
|
|||
}
|
||||
|
||||
private void processSqlRequests(SqlRequest request, List<String> ids) {
|
||||
String query = null;
|
||||
try (Connection connection = DatabaseConnection.getConnection(
|
||||
request.getSqlConnectionParams())) {
|
||||
String query = buildSqlQuery(request, String.join(",", ids));
|
||||
query = buildSqlQuery(request, String.join(",", ids));
|
||||
executeSqlQuery(connection, query);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
logger.error("SQL query execution failed", e);
|
||||
logger.error("SQL execution failed for query: {}", query, e);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildSqlQuery(SqlRequest request, String ids) {
|
||||
StringBuilder clauseBuilder = new StringBuilder();
|
||||
StringBuilder extraConditionsBuilder = new StringBuilder();
|
||||
String endpointArguments = " (" + Arrays.stream(ids.split(","))
|
||||
.map(id -> "'" + id.trim() + "'")
|
||||
.collect(Collectors.joining(", ")) + ")";
|
||||
|
||||
if (request.getRequestArguments() != null && !request.getRequestArguments().isEmpty()) {
|
||||
for (RequestArgument argument : request.getRequestArguments()) {
|
||||
clauseBuilder.append(argument.getId()).append(" IN (").append(ids).append(")");
|
||||
|
||||
if (argument.getSqlConnectionParams() != null) {
|
||||
try (Connection connection = DatabaseConnection.getConnection(
|
||||
|
|
@ -159,7 +160,7 @@ public class RequestService {
|
|||
String resultSet = String.join(", ", result.stream()
|
||||
.map(s -> "'" + s + "'")
|
||||
.toArray(String[]::new));
|
||||
clauseBuilder.append(" OR ")
|
||||
extraConditionsBuilder.append(" OR ")
|
||||
.append(argument.getId())
|
||||
.append(" IN (")
|
||||
.append(resultSet)
|
||||
|
|
@ -173,11 +174,11 @@ public class RequestService {
|
|||
}
|
||||
}
|
||||
|
||||
String clause = clauseBuilder.toString();
|
||||
String extraConditions = extraConditionsBuilder.toString();
|
||||
return request.getRequestURL()
|
||||
.replace("${DB}", request.getSqlConnectionParams().getJdbcDatabase())
|
||||
.replace("${clause}", clause)
|
||||
.replace("${ids}", ids);
|
||||
.replace("${DB}", request.getSqlConnectionParams().getJdbcDatabase())
|
||||
.replace("${extraConditions}", extraConditions)
|
||||
.replace("${endpointArguments}", endpointArguments);
|
||||
}
|
||||
|
||||
private void executeSqlQuery(Connection connection, String query) throws SQLException {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue