package com.baiyue.lastleg.appointmentplanning; import org.apache.ibatis.annotations.*; import java.time.LocalDateTime; import java.util.List; @Mapper public interface AppointmentImpactRelationMapper { record Cargo(String customerId,Long orderId,String inboundCode,String customerName,Integer packages,String destination) { } record Appointment(String appointmentNo,String status,String destination,LocalDateTime confirmedAt,String timezone) { } @Select("SELECT customer_id,id AS order_id,inbound_code,customer_name,package_count AS packages,fba_warehouse_code AS destination FROM ll_order WHERE source_container_booking_id=#{id} AND order_type='FIRST_LEG' AND current_status NOT IN ('CANCELLED','COMPLETED') ORDER BY id LIMIT 1001") List cargo(String id); @Select(""" SELECT DISTINCT a.appointment_no,a.appointment_status AS status,a.fba_warehouse_code AS destination,a.appointment_at AS confirmed_at,a.timezone FROM ll_order o JOIN ll_inbound_fba_appointment_item i ON i.order_id=o.id AND i.customer_id=o.customer_id AND i.active=1 JOIN ll_inbound_fba_appointment a ON a.id=i.appointment_id WHERE o.source_container_booking_id=#{id} AND o.order_type='FIRST_LEG' AND o.current_status NOT IN ('CANCELLED','COMPLETED') AND a.appointment_status NOT IN ('CANCELLED','FAILED') ORDER BY a.appointment_no LIMIT 1001 """) List appointments(String id); @Select(""" SELECT DISTINCT i.customer_id,d.dispatch_no FROM ll_order o JOIN ll_dispatch_item i ON i.order_id=o.id AND i.customer_id=o.customer_id JOIN ll_dispatch_order d ON d.id=i.dispatch_order_id WHERE o.source_container_booking_id=#{id} AND o.order_type='FIRST_LEG' AND o.current_status NOT IN ('CANCELLED','COMPLETED') AND d.status='ACTIVE' AND d.stage<>'DELIVERED' ORDER BY d.dispatch_no LIMIT 1001 """) List dispatches(String id); }