package com.jkcredit.invoice.mapper.binvoce;

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.invoice.BillInvoice;
import com.jkcredit.invoice.model.vo.CompanyVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 运单发票查询接口
 * @author mumuxigua
 */
@Repository
public interface BillInvoiceMapper extends BaseMapper<BillInvoice> {
    /**
     * 分页查询所有运单发票
     *
     * @param page
     * @param billInvoice
     * @return
     */
    IPage<List<BillInvoice>> selectAllByPage(Page page, @Param("billInvoice") BillInvoice billInvoice);

    /**
     * 分页查询所有运单发票
     *
     * @param page
     * @param billInvoice
     * @return
     */
    IPage<List<BillInvoice>> selectAllByPageHis(Page page, @Param("billInvoice") BillInvoice billInvoice);

    /**
     * 条件查询所有运单发票
     *
     * @param record
     * @return
     */
    BillInvoice selectAllByPageByBillInvoice(BillInvoice record);

    /**
     * 插入发票
     *
     * @param record
     * @return
     */
    @Override
    int insert(BillInvoice record);

    int insertHis(BillInvoice record);
    /**
     * 更新发票
     *
     * @param record
     * @return
     */
    int updateByPrimaryKey(BillInvoice record);

    /**
     * 根据发票代码更新发票
     *
     * @param record
     * @return
     */
    int updateByInvoiceNum(BillInvoice record);

    /**
     * 查询发票列表
     *
     * @param wayBillNum
     * @return
     */
    List<BillInvoice> selectByBillNum(String wayBillNum);

    /**
     * 根据运单号删除发票
     *
     * @param wayBillNum
     * @return
     */
    int deleteByBillNum(String wayBillNum);

    /**
     * 根据运单号查询发票
     *
     * @param wayBillNum
     * @return
     */
    BillInvoice selectByInvoiceNum(String wayBillNum);

    /**
     * 发票统计汇总
     *
     * @param billInvoice
     * @return
     */
    Map<String, String> findInvoiceStatics(@Param("billInvoice") BillInvoice billInvoice);

    /**
     * 根据客户名称查询所有发票
     *
     * @param customerName
     * @return
     */
    List<BillInvoice> selectNoCarNoVoiceQuery(String customerName);

    /**
     * 更新计费明细
     *
     * @param companyVo
     * @return
     */
    int upDateCompany(CompanyVo companyVo);
}
