22 lines
1.1 KiB
Java
22 lines
1.1 KiB
Java
package com.baiyue.lastleg.appointmentplanning;
|
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface AppointmentBatchPreviewMapper {
|
|
record Flags(Long orderId, boolean detained, boolean mixedDestinations, boolean activeAppointment) { }
|
|
@Select("<script>" + """
|
|
SELECT o.id AS orderId,o.detained,
|
|
EXISTS(SELECT 1 FROM ll_order_detail d WHERE d.order_id=o.id AND d.customer_id=o.customer_id
|
|
AND d.destination_warehouse_code IS NOT NULL AND d.destination_warehouse_code<>o.fba_warehouse_code) AS mixedDestinations,
|
|
EXISTS(SELECT 1 FROM ll_inbound_fba_appointment_item i JOIN ll_inbound_fba_appointment a ON a.id=i.appointment_id
|
|
WHERE i.order_id=o.id AND i.customer_id=o.customer_id AND a.appointment_status NOT IN ('CANCELLED','FAILED')) AS activeAppointment
|
|
FROM ll_order o WHERE o.id IN
|
|
<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>
|
|
""" + "</script>")
|
|
List<Flags> flags(@Param("ids") List<Long> ids);
|
|
}
|