-- Automatisch generierte SQL-Statements für Node Predecessor Chains
-- Generiert aus: node.xlsx
-- Format: Mehrere Chains pro Node möglich (mit ; getrennt)

-- Predecessor Chain 1: AB (Chain 1 von 2)
-- Predecessors: WH_ULHA
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'AB')
);

SET @chain_id_1 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ULHA'),
    @chain_id_1,
    1
);

-- Predecessor Chain 2: AB (Chain 2 von 2)
-- Predecessors: WH_STO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'AB')
);

SET @chain_id_2 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO'),
    @chain_id_2,
    1
);


-- Predecessor Chain 3: HH (Chain 1 von 1)
-- Predecessors: WH_HH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'HH')
);

SET @chain_id_3 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_HH'),
    @chain_id_3,
    1
);


-- Predecessor Chain 4: FGG (Chain 1 von 2)
-- Predecessors: WH_STO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FGG')
);

SET @chain_id_4 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO'),
    @chain_id_4,
    1
);

-- Predecessor Chain 5: FGG (Chain 2 von 2)
-- Predecessors: BEZEE
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FGG')
);

SET @chain_id_5 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'BEZEE'),
    @chain_id_5,
    1
);


-- Predecessor Chain 6: KWS (Chain 1 von 2)
-- Predecessors: WH_STO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'KWS')
);

SET @chain_id_6 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO'),
    @chain_id_6,
    1
);

-- Predecessor Chain 7: KWS (Chain 2 von 2)
-- Predecessors: BEZEE
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'KWS')
);

SET @chain_id_7 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'BEZEE'),
    @chain_id_7,
    1
);


-- Predecessor Chain 8: EGD (Chain 1 von 2)
-- Predecessors: WH_HH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'EGD')
);

SET @chain_id_8 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_HH'),
    @chain_id_8,
    1
);

-- Predecessor Chain 9: EGD (Chain 2 von 2)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'EGD')
);

SET @chain_id_9 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_9,
    1
);


-- Predecessor Chain 10: CTT (Chain 1 von 2)
-- Predecessors: WH_BAT3
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CTT')
);

SET @chain_id_10 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BAT3'),
    @chain_id_10,
    1
);

-- Predecessor Chain 11: CTT (Chain 2 von 2)
-- Predecessors: WH_JEAN
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CTT')
);

SET @chain_id_11 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_JEAN'),
    @chain_id_11,
    1
);


-- Predecessor Chain 12: LZZ (Chain 1 von 1)
-- Predecessors: WH_ROLO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'LZZ')
);

SET @chain_id_12 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ROLO'),
    @chain_id_12,
    1
);


-- Predecessor Chain 13: STR (Chain 1 von 1)
-- Predecessors: WH_ZBU
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'STR')
);

SET @chain_id_13 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ZBU'),
    @chain_id_13,
    1
);


-- Predecessor Chain 14: VOP (Chain 1 von 1)
-- Predecessors: WH_BUD
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'VOP')
);

SET @chain_id_14 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BUD'),
    @chain_id_14,
    1
);


-- Predecessor Chain 15: KOL (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'KOL')
);

SET @chain_id_15 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_15,
    1
);


-- Predecessor Chain 16: LIPO (Chain 1 von 1)
-- Predecessors: WH_BUD
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'LIPO')
);

SET @chain_id_16 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BUD'),
    @chain_id_16,
    1
);


-- Predecessor Chain 17: WH_ZBU (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ZBU')
);

SET @chain_id_17 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_17,
    1
);


-- Predecessor Chain 18: WH_STO (Chain 1 von 1)
-- Predecessors: BEZEE
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO')
);

SET @chain_id_18 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'BEZEE'),
    @chain_id_18,
    1
);


-- Predecessor Chain 19: WH_HH (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_HH')
);

SET @chain_id_19 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_19,
    1
);


-- Predecessor Chain 20: CNSHA (Chain 1 von 6)
-- Predecessors: Shanghai
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

SET @chain_id_20 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Shanghai'),
    @chain_id_20,
    1
);

-- Predecessor Chain 21: CNSHA (Chain 2 von 6)
-- Predecessors: Hangzhou
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

SET @chain_id_21 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Hangzhou'),
    @chain_id_21,
    1
);

-- Predecessor Chain 22: CNSHA (Chain 3 von 6)
-- Predecessors: Yangzhong
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

SET @chain_id_22 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Yangzhong'),
    @chain_id_22,
    1
);

-- Predecessor Chain 23: CNSHA (Chain 4 von 6)
-- Predecessors: Taicang
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

SET @chain_id_23 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Taicang'),
    @chain_id_23,
    1
);

-- Predecessor Chain 24: CNSHA (Chain 5 von 6)
-- Predecessors: Jingjiang
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

SET @chain_id_24 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Jingjiang'),
    @chain_id_24,
    1
);

-- Predecessor Chain 25: CNSHA (Chain 6 von 6)
-- Predecessors: JJ
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

SET @chain_id_25 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'JJ'),
    @chain_id_25,
    1
);


-- Predecessor Chain 26: CNTAO (Chain 1 von 2)
-- Predecessors: Qingdao
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNTAO')
);

SET @chain_id_26 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Qingdao'),
    @chain_id_26,
    1
);

-- Predecessor Chain 27: CNTAO (Chain 2 von 2)
-- Predecessors: Linfen
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNTAO')
);

SET @chain_id_27 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Linfen'),
    @chain_id_27,
    1
);


-- Predecessor Chain 28: CNXMN (Chain 1 von 2)
-- Predecessors: Fuqing
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNXMN')
);

SET @chain_id_28 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Fuqing'),
    @chain_id_28,
    1
);

-- Predecessor Chain 29: CNXMN (Chain 2 von 2)
-- Predecessors: LX
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNXMN')
);

SET @chain_id_29 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'LX'),
    @chain_id_29,
    1
);


-- Predecessor Chain 30: INNSA (Chain 1 von 2)
-- Predecessors: Pune
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'INNSA')
);

SET @chain_id_30 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Pune'),
    @chain_id_30,
    1
);

-- Predecessor Chain 31: INNSA (Chain 2 von 2)
-- Predecessors: Aurangabad
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'INNSA')
);

SET @chain_id_31 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Aurangabad'),
    @chain_id_31,
    1
);


-- Predecessor Chain 32: INMAA (Chain 1 von 1)
-- Predecessors: Bangalore
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'INMAA')
);

SET @chain_id_32 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Bangalore'),
    @chain_id_32,
    1
);


-- Predecessor Chain 33: CNSZX (Chain 1 von 1)
-- Predecessors: Shenzhen
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSZX')
);

SET @chain_id_33 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Shenzhen'),
    @chain_id_33,
    1
);


-- Predecessor Chain 34: WH_BAT3 (Chain 1 von 1)
-- Predecessors: FRLEH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BAT3')
);

SET @chain_id_34 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FRLEH'),
    @chain_id_34,
    1
);


-- Predecessor Chain 35: WH_JEAN (Chain 1 von 1)
-- Predecessors: FRLEH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_JEAN')
);

SET @chain_id_35 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FRLEH'),
    @chain_id_35,
    1
);


-- Predecessor Chain 36: WH_ROLO (Chain 1 von 1)
-- Predecessors: ITGOA
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ROLO')
);

SET @chain_id_36 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'ITGOA'),
    @chain_id_36,
    1
);


-- Predecessor Chain 37: WH_BUD (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BUD')
);

SET @chain_id_37 = LAST_INSERT_ID();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_37,
    1
);

