event속성들 snp_data 적재 -> new_snp 적재

This commit is contained in:
Kim JiMyeung 2025-12-23 14:33:53 +09:00
부모 1124c2e84a
커밋 a7cf1647f8

파일 보기

@ -3,7 +3,7 @@ package com.snp.batch.jobs.event.batch.repository;
public class EventSql { public class EventSql {
public static String getEventDetailUpdateSql(){ public static String getEventDetailUpdateSql(){
return """ return """
INSERT INTO snp_data.event_detail ( INSERT INTO new_snp.event_detail (
event_id, incident_id, ihslrorimoshipno, published_date, event_start_date, event_end_date, event_id, incident_id, ihslrorimoshipno, published_date, event_start_date, event_end_date,
attempted_boarding, cargo_loading_status_code, casualty_action, attempted_boarding, cargo_loading_status_code, casualty_action,
casualty_zone, casualty_zone_code, component2, country_code, casualty_zone, casualty_zone_code, component2, country_code,
@ -64,14 +64,13 @@ public class EventSql {
vessel_gt = EXCLUDED.vessel_gt, vessel_gt = EXCLUDED.vessel_gt,
vessel_name = EXCLUDED.vessel_name, vessel_name = EXCLUDED.vessel_name,
vessel_type = EXCLUDED.vessel_type, vessel_type = EXCLUDED.vessel_type,
vessel_type_decode = EXCLUDED.vessel_type_decode, vessel_type_decode = EXCLUDED.vessel_type_decode
batch_flag = 'N';
"""; """;
} }
public static String getEventCargoSql(){ public static String getEventCargoSql(){
return """ return """
INSERT INTO snp_data.event_cargo ( INSERT INTO new_snp.event_cargo (
event_id, "sequence", ihslrorimoshipno, "type", quantity, event_id, "sequence", ihslrorimoshipno, "type", quantity,
unit_short, unit, cargo_damage, dangerous, "text" unit_short, unit, cargo_damage, dangerous, "text"
) )
@ -86,14 +85,13 @@ public class EventSql {
unit = EXCLUDED.unit, unit = EXCLUDED.unit,
cargo_damage = EXCLUDED.cargo_damage, cargo_damage = EXCLUDED.cargo_damage,
dangerous = EXCLUDED.dangerous, dangerous = EXCLUDED.dangerous,
"text" = EXCLUDED."text", "text" = EXCLUDED."text"
batch_flag = 'N';
"""; """;
} }
public static String getEventRelationshipSql(){ public static String getEventRelationshipSql(){
return """ return """
INSERT INTO snp_data.event_relationship ( INSERT INTO new_snp.event_relationship (
incident_id, event_id, relationship_type, relationship_type_code, incident_id, event_id, relationship_type, relationship_type_code,
event_id_2, event_type, event_type_code event_id_2, event_type, event_type_code
) )
@ -104,14 +102,13 @@ public class EventSql {
ON CONFLICT (incident_id, event_id, event_id_2, event_type_code, relationship_type_code) ON CONFLICT (incident_id, event_id, event_id_2, event_type_code, relationship_type_code)
DO UPDATE SET DO UPDATE SET
relationship_type = EXCLUDED.relationship_type, relationship_type = EXCLUDED.relationship_type,
event_type = EXCLUDED.event_type, event_type = EXCLUDED.event_type
batch_flag = 'N';
"""; """;
} }
public static String getEventHumanCasualtySql(){ public static String getEventHumanCasualtySql(){
return """ return """
INSERT INTO snp_data.event_humancasualty ( INSERT INTO new_snp.event_humancasualty (
event_id, "scope", "type", qualifier, "count" event_id, "scope", "type", qualifier, "count"
) )
VALUES ( VALUES (
@ -119,8 +116,7 @@ public class EventSql {
) )
ON CONFLICT (event_id, "scope", "type", qualifier) ON CONFLICT (event_id, "scope", "type", qualifier)
DO UPDATE SET DO UPDATE SET
"count" = EXCLUDED."count", "count" = EXCLUDED."count"
batch_flag = 'N';
"""; """;
} }
} }