package com.jkcredit.invoice.mapper.waybill;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
import com.jkcredit.invoice.model.vo.CompanyVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 无车运单接口
 * @author mumuxigua
 */
@Repository
public interface NoCarWaybillMapper extends BaseMapper<NoCarWayBill> {

    /**
     * 查询运单信息分页
     * @param page
     * @param noCarWayBill
     * @return
     */
    IPage<List<NoCarWayBill>> selectAllByPage(Page page, @Param("noCarWayBill") NoCarWayBill noCarWayBill);
    /**
     * 查询运单信息分页<2024
     * @param page
     * @param noCarWayBill
     * @return
     */
    IPage<List<NoCarWayBill>> selectAllByPageHis(Page page, @Param("noCarWayBill") NoCarWayBill noCarWayBill);
    /**
     * 分页查询 失败运单信息
     * @param page
     * @param noCarWayBill
     * @return
     */
    IPage<List<NoCarWayBill>> selectAllByPageException(Page page, @Param("noCarWayBill") NoCarWayBill noCarWayBill);

    /**
     * 插入 运单信息
     * @param record
     * @return
     */
    @Override
    int insert(NoCarWayBill record);

    int insertHis(NoCarWayBill record);

    /**
     * 更新运单信息
     * @param record
     * @return
     */
    int updateByPrimaryKey(NoCarWayBill record);

    /**
     * 根据运单号更新运单信息
     * @param record
     * @return
     */
    int updateByBillNum(NoCarWayBill record);
    int updateByBillNumEnd(NoCarWayBill record);
    /**
     * 根据运单号更新运单是否失败信息
     * @param record
     * @return
     */
    int updateByBillNumTimeRes(NoCarWayBill record);

    /**
     * 根据运单号查询运单信息
     * @param wayBillNum
     * @return
     */
    NoCarWayBill selectByBillNum(String wayBillNum);

    /**
     * 根据运单号查询运单信息<2024
     * @param wayBillNum
     * @return
     */
    NoCarWayBill selectByBillNumHis(String wayBillNum);

    /**
     * 根据运单号查询运单列表
     * @param wayBillNum
     * @return
     */
    List<NoCarWayBill> selectByBillNumForRe(String wayBillNum);

    /**
     * 根据运单号查询运单信息 行锁
     * @param wayBillNum
     * @return
     */
    NoCarWayBill selectByBillNumforLock(String wayBillNum);

    /**
     * 根据运单号删除运单信息
     * @param wayBillNum
     */
    void deleteNotRightWayBill(String wayBillNum);
    void deleteWayBill(String wayBillNum);
    /**
     * 根据运单号查询运单列表
     * @param noCarWayBill
     * @return
     */
    List<NoCarWayBill> selectByHisFlagAndBillStatus(NoCarWayBill noCarWayBill);

    /**
     * 根据公司信息更新运单信息
     * @param companyVo
     * @return
     */
    int upDateCompany(CompanyVo companyVo);

    /**
     * 根据公司名称查询运单列表
     * @param customerName
     * @return
     */
    List<NoCarWayBill> getNoCarNoVoiceQuery(String customerName);

    /**
     * 查询一千条运单数据
     * @param noCarWayBill
     * @return
     */
    List<NoCarWayBill> selectMigrateDatas(@Param("noCarWayBill") NoCarWayBill noCarWayBill);
}
