package com.xhpc.user.mapper;

import com.xhpc.user.domain.InvoicedOrdersRequest;
import com.xhpc.order.domain.XhpcHistoryOrder;
import org.apache.ibatis.annotations.Param;

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

/**
 * 专门用于发票服务的XhpcHistoryOrderMapper
 *
 * @author WH
 * @date 2021/12/24 14:20
 * @since version-1.0
 */
public interface XhpcHistoryOrderMapper {

    /**
     * 根据用户id，用户类型，要查询的当前时间的年月日，查询该用户3个月内可以开发票的历史订单
     *
     * @param invoicedOrdersRequest 查询条件
     * @param lockOrderNumberList   过滤条件
     * @return 历史订单记录集合
     * @author WH
     * @date 2021/12/24 14:41
     * @since version-1.0
     */
    List<Map<String, Object>> findByCondition(@Param("invoicedOrdersRequest") InvoicedOrdersRequest invoicedOrdersRequest, @Param("lockOrderNumberList") List<Integer> lockOrderNumberList);

    /**
     * 查询用户指定时间，所有可以开发票的历史订单数量
     *
     * @param invoicedOrdersRequest 查询条件
     * @param lockOrderNumberList   过滤条件
     * @return 历史订单数量
     * @author WH
     * @date 2021/12/24 16:40
     * @since version-1.0
     */
    Long findAllOrdersByCondition(@Param("invoicedOrdersRequest") InvoicedOrdersRequest invoicedOrdersRequest, @Param("lockOrderNumberList") List<Integer> lockOrderNumberList);

    /**
     * 查询指定id的历史订单
     *
     * @param historyOrderIds 历史订单id集合
     * @return 历史订单
     * @author WH
     * @date 2021/12/28 17:47
     * @since version-1.0
     */
    List<XhpcHistoryOrder> findById(List<Integer> historyOrderIds);


    List<Map<String, Object>> countOperatorOnHistoryOrderIds(@Param("historyOrderIds")List<Integer> historyOrderIds);

    List<Map<String, Object>> findHistoryOrderIds(@Param("historyOrderIds")List<Integer> historyOrderIds,@Param("operatorId")String operatorId);


}
