package com.zfire.mall.manager.commonmapper;


import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zfire.mall.manager.bean.sale.*;
import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author chang
 */
@Mapper
public interface SaleOrderMapper {


    @SqlParser(filter = true)
    IPage<SaleOrderBean> list(IPage page,
                              @Param("categoryId") String categoryId,
                              @Param("invoiceStartTime") String invoiceStartTime,
                              @Param("invoiceEndTime") String invoiceEndTime,
                              @Param("createBy") String createBy,
                              @Param("syncStatus") Integer syncStatus,
                              @Param("printStartTime") String printStartTime,
                              @Param("printEndTime") String printEndTime,
                              @Param("printTimeDesc") String printTimeDesc,
                              @Param("approvalStartTime") String approvalStartTime,
                              @Param("approvalEndTime") String approvalEndTime,
                              @Param("mainOrderId") String mainOrderId,
                              @Param("id") List<String> id,
                              @Param("correspondName") String correspondName,
                              @Param("materialNumber") String materialNumber,
                              @Param("orderNo") List<String> orderNo,
                              @Param("customerName")String customerName,
                              @Param("correspondId")List<String> correspondId,
                              @Param("specification")String specification,
                              @Param("materialName")String materialName,
                              @Param("customerNumber")String customerNumber,
                              @Param("examineStatus")String examineStatus,
                              @Param("startTime")String startTime,
                              @Param("endTime")String endTime,
                              @Param("customerId") String customerId,
                              @Param("serviceIds") List<String> serviceIds,
                              @Param("adminUserId") List<String> adminUserId,
                              @Param("k3CategoryIds") List<String> k3CategoryIds);

    @SqlParser(filter = true)
    SaleOrderBody detail(String id);


    @SqlParser(filter = true)
    IPage<SaleOrderBean> listSaleOrder(IPage page,
                                       @Param("id") String id,
                                       @Param("mainOrderId") String mainOrderId,
                                       @Param("correspondName") String correspondName,
                                       @Param("materialNumber") String materialNumber,
                                       @Param("orderNo") String orderNo,
                                       @Param("customerName")String customerName,
                                       @Param("correspondId")String correspondId,
                                       @Param("specification")String specification,
                                       @Param("materialName")String materialName,
                                       @Param("customerNumber")String customerNumber,
                                       @Param("startTime")String startTime,
                                       @Param("endTime")String endTime,
                                       @Param("customerId") String customerId,
                                       @Param("serviceIds") List<String> serviceIds,
                                       @Param("k3CategoryIds") List<String> k3CategoryIds);


    IPage<StorageFeeBean> listStorageFee(IPage page,
                                         @Param("categoryNum")List<String> categoryNum,
                                         @Param("approvalStartTime")String approvalStartTime,
                                         @Param("approvalEndTime")String approvalEndTime,
                                         @Param("saleExamineStatus")String saleExamineStatus,
                                         @Param("saleStartTime")String saleStartTime,
                                         @Param("saleEndTime")String saleEndTime,
                                         @Param("invoiceStartTime")String invoiceStartTime,
                                         @Param("invoiceEndTime")String invoiceEndTime,
                                         @Param("mainOrderId")String mainOrderId,
                                         @Param("id") List<String> id,
                                         @Param("materialNumber")String materialNumber,
                                         @Param("orderNo") List<String> orderNo,
                                         @Param("customerName")String customerName,
                                         @Param("correspondId")List<String> correspondId,
                                         @Param("specification")String specification,
                                         @Param("materialName") String materialName,
                                         @Param("customerNumber") String customerNumber,
                                         @Param("startTime") String startTime,
                                         @Param("endTime") String endTime,
                                         @Param("serviceIds") List<String> serviceIds,
                                         @Param("adminUserId") String adminUserId,
                                         @Param("k3CategoryIds") List<String> k3CategoryIds
                                         );

    @SqlParser(filter = true)
    void updateInvoice(String id);


    Integer listCount(
            @Param("categoryId") String categoryId,
            @Param("invoiceStartTime") String invoiceStartTime,
            @Param("invoiceEndTime") String invoiceEndTime,
            @Param("createBy") String createBy,
                              @Param("syncStatus") Integer syncStatus,
                              @Param("printStartTime") String printStartTime,
                              @Param("printEndTime") String printEndTime,
                              @Param("printTimeDesc") String printTimeDesc,
                              @Param("approvalStartTime") String approvalStartTime,
                              @Param("approvalEndTime") String approvalEndTime,
                              @Param("mainOrderId") String mainOrderId,
                              @Param("id") List<String> id,
                              @Param("correspondName") String correspondName,
                              @Param("materialNumber") String materialNumber,
                              @Param("orderNo") List<String> orderNo,
                              @Param("customerName")String customerName,
                              @Param("correspondId")List<String> correspondId,
                              @Param("specification")String specification,
                              @Param("materialName")String materialName,
                              @Param("customerNumber")String customerNumber,
                              @Param("examineStatus")String examineStatus,
                              @Param("startTime")String startTime,
                              @Param("endTime")String endTime,
                              @Param("customerId") String customerId,
                              @Param("serviceIds") List<String> serviceIds,
                              @Param("adminUserId") List<String> adminUserId,
                              @Param("k3CategoryIds") List<String> k3CategoryIds);


    void insertCode(String batch);

    @SqlParser(filter = true)
    IPage<CodeManagerBean> listCode(IPage page,
                                    @Param("ex") ZfireParamBean zfireParam);

    @SqlParser(filter = true)
    IPage<StorageFeeBeanVO> listStorageFeeV2(Page page, @Param("ex")  ZfireParamBean zfireParamBean
            , @Param("serviceIds")  List<String> serviceIds
            , @Param("adminUserId") String adminUserId
            , @Param("k3CategoryIds") List<String> k3CategoryIds);

    @SqlParser(filter = true)
    IPage<SaleOrderVO> listV2(Page page, @Param("ex")ZfireParamBean zfireParamBean,
                              @Param("customerId") String customerId,
                              @Param("serviceIds")  List<String> serviceIds,
                              @Param("adminUserId") List<String> adminUserId,
                              @Param("k3CategoryIds") List<String> k3CategoryIds);

    @SqlParser(filter = true)
    Integer listCountV2( @Param("ex")ZfireParamBean zfireParamBean,
                         @Param("customerId") String customerId,
                         @Param("serviceIds")  List<String> serviceIds,
                         @Param("adminUserId") List<String> adminUserId,
                         @Param("k3CategoryIds") List<String> k3CategoryIds);

    @SqlParser(filter = true)
    IPage<SaleOrderVOV> listV3(Page page, @Param("ex")ZfireParamBean zfireParamBean,
                              @Param("customerId") String customerId,
                              @Param("serviceIds")  List<String> serviceIds,
                              @Param("adminUserId") List<String> adminUserId,
                              @Param("k3CategoryIds") List<String> k3CategoryIds);

    @SqlParser(filter = true)
    Integer listStorageFeeCount(
                                @Param("categoryNum")List<String> categoryNum,
                                @Param("approvalStartTime")String approvalStartTime,
                                @Param("approvalEndTime")String approvalEndTime,
                                @Param("saleExamineStatus")String saleExamineStatus,
                                @Param("saleStartTime")String saleStartTime,
                                @Param("saleEndTime")String saleEndTime,
                                @Param("invoiceStartTime")String invoiceStartTime,
                                @Param("invoiceEndTime")String invoiceEndTime,
                                @Param("mainOrderId")String mainOrderId,
                                @Param("id") List<String> id,
                                @Param("materialNumber")String materialNumber,
                                @Param("orderNo") List<String> orderNo,
                                @Param("customerName")String customerName,
                                @Param("correspondId")List<String> correspondId,
                                @Param("specification")String specification,
                                @Param("materialName") String materialName,
                                @Param("customerNumber") String customerNumber,
                                @Param("startTime") String startTime,
                                @Param("endTime") String endTime,
                                @Param("serviceIds") List<String> serviceIds,
                                @Param("adminUserId") String adminUserId,
                                @Param("k3CategoryIds") List<String> k3CategoryIds
                                );

}
