save
This commit is contained in:
parent
27c43a9eba
commit
363fa8f35c
3 changed files with 80 additions and 53 deletions
|
|
@ -1,28 +1,30 @@
|
|||
<Requests>
|
||||
<!-- 002_2-ervu_subpoena_registry_delete_all_with_recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
BEGIN
|
||||
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 subpoena_history where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments});
|
||||
DELETE FROM subpoena_appearance where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments});
|
||||
DELETE FROM subpoena_send_info where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments});
|
||||
|
||||
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 recruit_id in ${endpointArguments} ${extraConditions})));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments})));
|
||||
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 recruit_id in ${endpointArguments} ${extraConditions})));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments})));
|
||||
|
||||
DELETE FROM restriction_document_item_history WHERE recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM restriction_document_item_history WHERE recruit_id in ${endpointArguments};
|
||||
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 recruit_id in ${endpointArguments} ${extraConditions}));
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments}));
|
||||
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 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};
|
||||
select id FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments}));
|
||||
DELETE FROM restriction_document where subpoena_id in (select id FROM subpoena where recruit_id in ${endpointArguments});
|
||||
DELETE FROM subpoena where recruit_id in ${endpointArguments};
|
||||
DELETE FROM recruits WHERE id in ${endpointArguments};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
|
|
@ -39,20 +41,19 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- last sql from 002_2-ervu_subpoena_registry_delete_all_with_recruit -->
|
||||
|
||||
<!-- 005-ervu_decision_document-delete-recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
BEGIN
|
||||
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};
|
||||
DELETE FROM recruits WHERE id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM decision where recruit_id in ${endpointArguments};
|
||||
DELETE FROM foreign_decision where recruit_id in ${endpointArguments};
|
||||
DELETE FROM infringement where recruit_id in ${endpointArguments};
|
||||
DELETE FROM system_document where attachment_id in (SELECT id FROM attachment where recruit_id in ${endpointArguments}) ;
|
||||
DELETE FROM attachment where recruit_id in ${endpointArguments};
|
||||
DELETE FROM recruit where id in ${endpointArguments};
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- 004-ervu_journal-delete-recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
|
|
@ -93,7 +95,7 @@
|
|||
DELETE FROM object_history WHERE object_id = ANY (recruitIds);
|
||||
DELETE FROM object_versions WHERE object_id = ANY (recruitIds);
|
||||
END
|
||||
$$;
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
<SqlConnectionParams>
|
||||
|
|
@ -108,13 +110,18 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- 008-ervu_geps_notifications-delete-recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
var1 uuid[] := '{
|
||||
${endpointArguments}
|
||||
}';
|
||||
BEGIN
|
||||
DELETE FROM notifications where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM notifications where recruit_id = any (var1);
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
|
|
@ -131,17 +138,22 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- 007_2-ervu_incidents-delete-all_of_recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
var1 uuid[] := '{
|
||||
${endpointArguments}
|
||||
}';
|
||||
BEGIN
|
||||
DELETE
|
||||
FROM incident_history
|
||||
where incident_id in (select id from incident where recruit_id in ${endpointArguments} ${extraConditions});
|
||||
DELETE FROM incident where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM recruits where id in ${endpointArguments} ${extraConditions};
|
||||
where incident_id in (select id from incident where recruit_id = any (var1));
|
||||
DELETE FROM incident where recruit_id = any (var1);
|
||||
DELETE FROM recruits where id = any (var1);
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
|
|
@ -158,26 +170,33 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- 001-ervu_person_registry-delete-recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
var1 uuid[] := '{
|
||||
${endpointArguments}
|
||||
}';
|
||||
BEGIN
|
||||
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};
|
||||
DELETE FROM recruits_info where recruit_id = any (var1);
|
||||
-- DELETE FROM recruit_archive where recruit_id = any (var1);
|
||||
DELETE FROM recruit_xml_data where recruit_id = any (var1);
|
||||
DELETE FROM recruits_history where recruit_id = any (var1);
|
||||
DELETE FROM application where recruit_id = any (var1);
|
||||
DELETE FROM department_history where recruit_id = any (var1);
|
||||
DELETE FROM documents where recruit_id = any (var1);
|
||||
DELETE FROM decision where recruit_id = any (var1);
|
||||
DELETE FROM personal_documents where recruit_id = any (var1);
|
||||
DELETE FROM recruit_private_file where recruit_id = any (var1);
|
||||
DELETE FROM system_documents where recruit_id = any (var1);
|
||||
DELETE FROM system_document_dto where recruit_id = any (var1);
|
||||
DELETE FROM subpoena_dto where recruit_id = any (var1);
|
||||
DELETE FROM attachments where recruit_id = any (var1);
|
||||
DELETE FROM summoned_list where recruit_id = any (var1);
|
||||
DELETE FROM recruits where id = any (var1);
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
|
|
@ -194,15 +213,19 @@
|
|||
</SqlConnectionParams>
|
||||
</SqlRequest>
|
||||
|
||||
<!-- last sql from 001-ervu_person_registry-delete-recruit -->
|
||||
<!-- 009_1-ervu_appeal_document-delete-appeal-with-recruit -->
|
||||
<SqlRequest>
|
||||
<RequestURL>
|
||||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DELETE FROM appeal_document where recruit_id in ${endpointArguments} ${extraConditions};
|
||||
DELETE FROM recruits where id in ${endpointArguments} ${extraConditions};
|
||||
DECLARE
|
||||
var1 uuid[] := '{
|
||||
${endpointArguments}
|
||||
}';
|
||||
BEGIN
|
||||
DELETE FROM appeal_document where recruit_id = any (var1);
|
||||
DELETE FROM recruit where id = any (var1);
|
||||
END
|
||||
$$;
|
||||
]]>
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
<![CDATA[
|
||||
DO
|
||||
$$
|
||||
begin
|
||||
update recruits
|
||||
set current_recruitment_id = jsonb_extract_path_text(extra_info,'blocked','cur')::uuid
|
||||
,target_recruitment_id = jsonb_extract_path_text(extra_info,'blocked','trg')::uuid
|
||||
,department_id_old = jsonb_extract_path_text(extra_info,'blocked','dio')::uuid
|
||||
,system_pgs_status = '1.2'
|
||||
,conscription = null
|
||||
,extra_info = extra_info - ('blocked')
|
||||
where id in ${endpointArguments} ${extraConditions};
|
||||
end
|
||||
begin
|
||||
update recruits
|
||||
set current_recruitment_id = jsonb_extract_path_text(extra_info,'blocked','cur')::uuid
|
||||
,target_recruitment_id = jsonb_extract_path_text(extra_info,'blocked','trg')::uuid
|
||||
,department_id_old = jsonb_extract_path_text(extra_info,'blocked','dio')::uuid
|
||||
,system_pgs_status = '1.2'
|
||||
,conscription = null
|
||||
,extra_info = extra_info - ('blocked')
|
||||
where id in ${endpointArguments};
|
||||
end
|
||||
$$;
|
||||
]]>
|
||||
</RequestURL>
|
||||
|
|
|
|||
|
|
@ -149,12 +149,16 @@ public class RequestService {
|
|||
|
||||
private Map<String, Object> buildSqlQuery(SqlRequest request, List<String> ids) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
String endpointArguments = "(" + ids.stream()
|
||||
String endpointArguments = ids.stream()
|
||||
.map(id -> "'" + id.trim() + "'")
|
||||
.collect(Collectors.joining(", ")) + ")";
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
String requestURL = request.getRequestURL();
|
||||
|
||||
if (!requestURL.contains("uuid[]")) {
|
||||
endpointArguments = "(" + endpointArguments + ")";
|
||||
}
|
||||
|
||||
if (request.getRequestArguments() != null && !request.getRequestArguments().isEmpty()) {
|
||||
for (RequestArgument argument : request.getRequestArguments()) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue