package com.gree.mall.manager.commonmapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gree.mall.manager.bean.settle.repair.*;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface DailyMapper {
    /**
     * 扣回的
     * @param importBatchNo
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    void bindWorkerNumber2(@Param("companyWechatId") String companyWechatId, @Param("importBatchNo") String importBatchNo);

    /**
     * 汇总结算-绑定师傅编号
     * @param importBatchNo
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    void bindWorkerNumber(@Param("companyWechatId") String companyWechatId, @Param("importBatchNo") String importBatchNo);
    /**
     * 汇总结算-查询重复的
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<String> queryDistinctOrderNo(@Param("companyWechatId") String companyWechatId);

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailyTotalCostBean> queryDailyTotalCost(
            @Param("companyWechatId") String companyWechatId,
            @Param("importBatchNo") String importBatchNo,
            @Param("status") List<Integer> status,
            @Param("needSummaryStatus") List<String> needSummaryStatus
    );

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailyIncrDecrCostCountBean> queryIncrDecrByBatch(
            @Param("companyWechatId") String companyWechatId,
            @Param("importBatchNo") String importBatchNo,
            @Param("status") Integer status
    );

    @MapKey(value = "summaryNumber")
    List<Map<String,Object>>  querySummaryNumber(
            @Param("companyWechatId") String companyWechatId,
            @Param("summaryBatchNo") String summaryBatchNo
    );

    @MapKey(value = "summaryNumber")
    List<Map<String,Object>>  querySummaryMonthNumber(
            @Param("companyWechatId") String companyWechatId,
            @Param("summaryBatchNo") String summaryBatchNo
    );

    List<DailyWokerBankCardMonthBean> queryIssueSalaryMonthBankCardInfo(
            @Param("summaryBatchNo") String summaryBatchNo,
            @Param("summaryNumber") String summaryNumber,
            @Param("status") Integer status,
            @Param("companyWechatId") String companyWechatId);

    List<DailyWorkerBankCardBean> queryIssueSalaryAndBankCardInfo(
            @Param("summaryBatchNo") String summaryBatchNo,
            @Param("summaryNumber") String summaryNumber,
            @Param("status") Integer status,
            @Param("companyWechatId") String companyWechatId
    );

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailySummaryDataBean> summaryDayList(@Param("summaryBatchNo") String summaryBatchNo,
                                              @Param("companyWechatIds") List<String> companyWechatIds,
                                              @Param("adminWebsitIds") List<String> adminWebsitIds);

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    IPage<DailySummaryDataBean> cwSummaryList(Page page,
                                              @Param("summaryBatchNo") String summaryBatchNo,
                                              @Param("summaryStartTime") String summaryStartTime,
                                              @Param("summaryEndTime") String summaryEndTime,
                                              @Param("issueStartTime") String issueStartTime,
                                              @Param("issueEndTime") String issueEndTime,
                                              @Param("status") Integer status,
                                              @Param("companyWechatIds") List<String> companyWechatIds,
                                              @Param("adminWebsitIds") List<String> adminWebsitIds);

    IPage<DailyWorkerIssueSalaryBean> workerDetailList(Page page,
                                                       @Param("issueSalaryId") String issueSalaryId,
                                                       @Param("companyWechatIds") List<String> companyWechatIds,
                                                       @Param("adminWebsitIds") List<String> adminWebsitIds);

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    IPage<DailyNotMonthSummaryCountBean> cwSummaryMonthList(
            IPage page,
            @Param("summaryBatchNo") String summaryBatchNo,
            @Param("summaryStartTime") String summaryStartTime,
            @Param("summaryEndTime") String summaryEndTime,
            @Param("issueStartTime") String issueStartTime,
            @Param("issueEndTime") String issueEndTime,
            @Param("status") Integer status,
            @Param("companyWechatIds") List<String> companyWechatIds,
            @Param("adminWebsitIds") List<String> adminWebsitIds
    );

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailyNotMonthSummaryCountBean> monthlySummaryList(
            @Param("summaryBatchNo") String summaryBatchNo,
            @Param("companyWechatIds") List<String> companyWechatIds,
            @Param("adminWebsitIds") List<String> adminWebsitIds
    );

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailyNotMonthSummaryCountBean> monthlyWebsiteList(
            @Param("summaryBatchNo") String summaryBatchNo,
            @Param("companyWechatIds") List<String> companyWechatIds,
            @Param("adminWebsitIds") List<String> adminWebsitIds
    );

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailyWorkerIssueSalaryBean> monthlyDetailList(
            IPage page,
            @Param("summaryMonthBatchNo") String summaryMonthBatchNo,
            @Param("summaryNumber") String summaryNumber,
            @Param("serviceNumber") String serviceNumber,
            @Param("companyWechatIds") List<String> companyWechatIds,
            @Param("adminWebsitIds") List<String> adminWebsitIds
    );

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    List<DailyMonthTotalBean> queryMonthTotalCost(@Param("companyWechatId") String companyWechatId);

    /**
     * 查询月度汇总数据
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    DailyNotMonthSummaryCountBean queryNotMonthSummaryData(@Param("companyWechatId") String companyWechatId);
}
