
package com.tmerclub.cloud.order.mapper;

import com.tmerclub.cloud.api.order.bo.EsOrderInvoiceBO;
import com.tmerclub.cloud.order.model.OrderInvoice;
import com.tmerclub.cloud.order.vo.OrderInvoiceVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author Pineapple
 * @date 2021/8/2 8:54
 */
public interface OrderInvoiceMapper {

    /**
     * 根据id获取
     *
     * @param orderInvoiceId id
     * @return
     */
    OrderInvoice getByOrderInvoiceId(@Param("orderInvoiceId") Long orderInvoiceId);

    /**
     * 保存
     *
     * @param orderInvoice
     */
    void save(@Param("orderInvoice") OrderInvoice orderInvoice);

    /**
     * 批量保存
     *
     * @param orderInvoices
     */
    void saveBatch(@Param("orderInvoices") List<OrderInvoice> orderInvoices);

    /**
     * 更新
     *
     * @param orderInvoice
     */
    void update(@Param("orderInvoice") OrderInvoice orderInvoice);

    /**
     * 根据id删除
     *
     * @param orderInvoiceId
     */
    void deleteById(@Param("orderInvoiceId") Long orderInvoiceId);

    /**
     * 根据订单发票id获取，app端使用
     *
     * @param orderInvoiceId 订单发票id
     * @param lang           语言
     * @return 信息
     */
    OrderInvoiceVO getById(@Param("orderInvoiceId") Long orderInvoiceId, @Param("lang") Integer lang);

    /**
     * 该订单是否已经开具发票
     *
     * @param orderId
     * @return
     */
    int isUpload(@Param("orderId") Long orderId,
                 @Param("shopId") Long shopId,
                 @Param("supplierId") Long supplierId);

    /**
     * 根据订单id获取发票id
     *
     * @param orderId 订单id
     * @return
     */
    Long getByOrderId(@Param("orderId") Long orderId,
                      @Param("shopId") Long shopId,
                      @Param("supplierId") Long supplierId);

    /**
     * 根据订单ids获取发票信息
     *
     * @param orderIds 订单ids
     * @return
     */
    List<OrderInvoice> listByOrderIds(@Param("orderIds") List<Long> orderIds);

    /**
     * 批量删除
     *
     * @param orderIds 被取消的订单id
     */
    void deleteBatch(@Param("orderIds") List<Long> orderIds);

    /**
     * 获取订单发票数据
     *
     * @param orderInvoiceId
     * @return
     */
    EsOrderInvoiceBO getEsOrderInvoice(@Param("orderInvoiceId") Long orderInvoiceId);

    /**
     * 根据订单id获取es发票更新数据
     *
     * @param orderId
     * @return
     */
    List<EsOrderInvoiceBO> listEsOrderInvoiceByOrderId(@Param("orderId") Long orderId);
}
