package com.jeeplus.finance.reimbursementApproval.approvalInfo.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.finance.reimbursementApproval.approvalInfo.domain.*;
import com.jeeplus.finance.reimbursementApproval.approvalInfo.service.dto.CwReimbursementAmountInfoDTO;
import com.jeeplus.finance.reimbursementApproval.approvalInfo.service.dto.ReportNoDto;
import com.jeeplus.finance.reimbursementApproval.approvalInfo.service.dto.RetureListDto;
import com.jeeplus.finance.reimbursementApproval.approvalInfo.service.dto.TreeUserDto;
//import com.jeeplus.pubmodules.oss.service.dto.WorkAttachmentDto;
import com.jeeplus.sys.domain.WorkAttachmentInfo;
import com.jeeplus.sys.service.dto.UserDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 王强
 * @create: 2022-11-24 16:09
 **/
//@InterceptorIgnore(tenantLine = "true")
public interface CwReimbursementInfoMapper extends BaseMapper<CwReimbursementInfo> {

    IPage<ProgramProjectListInfo> findProjectList(Page<ProgramProjectListInfo> page, @Param(Constants.WRAPPER) QueryWrapper<ProgramProjectListInfo> wrapper);

    String selectInvoiceFlag(@Param("id") String id);

    IPage<RetureListDto> findList (Page<RetureListDto> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("officeIds")String officeIds);


    List<WorkAttachmentInfo> findFiles(@Param("id") String id);

    void updateStatusById(@Param("id") String id, @Param("type") String type);

    List<TreeUserDto> findOfficeList();

    List<TreeUserDto> findUserList(@Param("name") String name);

    List<TreeUserDto> findOfficeListByTenantId(@Param("tenantId") String tenantId,@Param("companyId") String companyId);

    List<TreeUserDto> findUserListByTenantId(@Param("name") String name,@Param("tenantId") String tenantId,@Param("companyId") String companyId);

    List<RetureListDto> findExportList (@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

    IPage<RetureListDto> relationReimbursementList (Page<RetureListDto> page, @Param("id") String id);

    IPage<ReportNoDto> getReportNoList(Page<ReportNoDto> page, @Param(Constants.WRAPPER) QueryWrapper<ReportNoDto> queryWrapper);

    List<CwReimbursementDetailInfoContract> getContractDetailList(@Param("id") String id);

    List<CwReimbursementDetailInfoReport> getReportDetailList(@Param("id") String id);

    List<CwReimbursementDetailInfoOther> getOtherDetailList(@Param("id") String id);

    List<CwReimbursementDetailInfoProcured> getProcuredDetailList(@Param("id") String id);

    List<HumanReimbursementDetailInfoProcured> getHumanProcuredDetailList(@Param("id") String id);

    List<CwReimbursementDetailInfo> getDetailList(@Param("id") String id);

    /**
     * 根据发票号查询是否已经或正在报销
     * @param invoiceNumber
     * @return
     */
    Integer getEffectiveDataByInvoiceNumber(@Param("invoiceNumber") String invoiceNumber, @Param("id") String id);

    List<String> getEffectiveDataByNumbers(@Param("invoiceNumber") List<String> invoiceNumber, @Param("id") String id);
    //根据发票号查询是否已经报销
    List<String> getEffectiveDataByNumbers2(@Param("invoiceNumber") List<String> invoiceNumber, @Param("id")String id);


    Integer deleteByIdAndNumber(@Param("invoiceNumber") String invoiceNumber, @Param("id") String id);

    @InterceptorIgnore(tenantLine = "true")
    List<CwReimbursementAmountInfoDTO> getInvoiceReimbursementAmountList(@Param("idList") List<String> idList);

    CwReimbursementInfo getById( @Param("id") String id);
    @InterceptorIgnore(tenantLine = "true")
    String findUserById(@Param("projectUser") String projectUser);
    @InterceptorIgnore(tenantLine = "true")
    List<String> findUserByIds(@Param("idList")List<String> idList);
    @InterceptorIgnore(tenantLine = "true")
    String findOfficeById(@Param("projectOffice")String projectOffice);
    @InterceptorIgnore(tenantLine = "true")
    List<String> findOfficeByIds(@Param("idList")List<String> idList);
    void updatePaymentById(@Param("id") String id,@Param("paymentStatus") String paymentStatus);

    List<String> getReimbursementIdList(String type);


    void updateCwReimbursementAmountInfo(@Param("number") String number,@Param("buyerName") String buyerName,@Param("type") String type);

    @InterceptorIgnore(tenantLine = "true")
    List<WorkAttachmentInfo> findReimFiles(@Param("infoId") String infoId,@Param("attachmentFlag") String attachmentFlag);
    @InterceptorIgnore(tenantLine = "true")
    IPage<RetureListDto> computerList (Page<RetureListDto> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("officeIds")String officeIds);

    //根据流程id获取报销创建人id
    String getReimbursementCreateUserIdByProcessInstanceId(@Param("id") String id);

}
