package com.erp.waybill.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.erp.waybill.entity.LogisticsTrace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 物流轨迹明细 Mapper
 */
@Mapper
public interface LogisticsTraceRepository extends BaseMapper<LogisticsTrace> {

    @Select("SELECT * FROM logistics_traces WHERE waybill_no = #{waybillNo} ORDER BY trace_time ASC")
    List<LogisticsTrace> findByWaybillNo(@Param("waybillNo") String waybillNo);

    @Select("SELECT * FROM logistics_traces WHERE waybill_no = #{waybillNo} AND carrier = #{carrier} ORDER BY trace_time ASC")
    List<LogisticsTrace> findByWaybillNoAndCarrier(@Param("waybillNo") String waybillNo, @Param("carrier") String carrier);
}
