-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Cleaning-Service-Dummy): add confidence criteria to cleaned gener…
…ic business partner
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
bpdm-gate/src/main/resources/db/migration/V5_0_0_5__create_site_confidence_criteria.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
WITH mapping AS ( | ||
SELECT bp.id as business_partner_id, nextVal('bpdm_sequence') as confidence_id | ||
FROM business_partners bp | ||
WHERE bp.stage = 'Output' AND bp.site_confidence_id IS NULL AND (bp.address_type = 'SITE_MAIN_ADDRESS' OR bpd.address_type = 'LEGAL_AND_SITE_MAIN_ADDRESS') | ||
), | ||
confidence AS ( | ||
INSERT INTO confidence_criteria (id, created_at, updated_at, uuid, shared_by_owner, checked_by_external_data_source, number_of_business_partners, last_confidence_check_at, next_confidence_check_at, confidence_level) | ||
SELECT mapping.confidence_id, NOW(), NOW(), gen_random_uuid(), FALSE, FALSE, 1, NOW()::timestamp, NOW()::timestamp, 0 | ||
FROM mapping | ||
) | ||
UPDATE business_partners bp | ||
SET site_confidence_id = mapping.confidence_id | ||
FROM mapping | ||
WHERE bp.id = mapping.business_partner_id; |