package com.erp.waybill.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.erp.waybill.entity.PrintLog;
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 PrintLogRepository extends BaseMapper<PrintLog> {

    @Select("SELECT * FROM print_logs WHERE order_id = #{orderId} ORDER BY created_at DESC")
    List<PrintLog> findByOrderId(@Param("orderId") Long orderId);

    @Select("SELECT * FROM print_logs WHERE old_waybill_no = #{waybillNo} ORDER BY created_at DESC")
    List<PrintLog> findByOldWaybillNo(@Param("waybillNo") String waybillNo);
}
