package org.dromara.payment.invoice.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.payment.channel.domain.vo.BusChannelFlowsVo;
import org.dromara.payment.invoice.domain.MerInvoice;
import org.dromara.payment.invoice.domain.MerInvoiceBill;
import org.dromara.payment.invoice.domain.vo.MerInvoiceBillVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.payment.invoice.domain.vo.MerInvoiceVo;
import org.dromara.payment.operator.domain.vo.BusOperatorFlowsVo;
import org.dromara.payment.sys.domain.vo.SysSydFlowsVo;

import java.util.List;

/**
 * 发票明细Mapper接口
 *
 * @author LionLi
 * @date 2024-05-06
 */
public interface MerInvoiceBillMapper extends BaseMapperPlus<MerInvoiceBill, MerInvoiceBillVo> {
    Page<MerInvoiceBillVo> queryPageList(@Param("page") Page<MerInvoiceBill> page, @Param(Constants.WRAPPER) Wrapper<MerInvoiceBill> queryWrapper);

    List<MerInvoiceBillVo> queryList(@Param(Constants.WRAPPER) Wrapper<MerInvoiceBill> queryWrapper);

    /**
     * 修改代发批次开票状态
     * @param invId 发票申请id
     * @param sourceStatus 源开票状态（0:待开票 1:已开票 2:已申请开票）
     * @param targetStatus 新开票状态（0:待开票 1:已开票 2:已申请开票）
     * @return
     */
    Integer updateInvoiceStatus(@Param("invId") long invId,@Param("sourceStatus") int sourceStatus,@Param("targetStatus") int targetStatus);

    /**
     * 查询发票中冻结的服务商代发批次流水
     * @param invId 发票申请id
     * @return
     */
    List<SysSydFlowsVo> selectFrozenSydFlows(@Param("invId") long invId);

    /**
     * 查询发票中冻结的运营商代发批次流水
     * @param invId 发票申请id
     * @return
     */
    List<BusOperatorFlowsVo> selectFrozenOpFlows(@Param("invId") long invId);

    /**
     * 查询发票中冻结的代理商代发批次流水
     * @param invId 发票申请id
     * @return
     */
    List<BusChannelFlowsVo> selectFrozenChannelFlows(@Param("invId") long invId);
}
