package com.ruoyi.ccdi.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.project.domain.entity.CcdiBankStatement;
import com.ruoyi.ccdi.project.domain.dto.CcdiBankStatementQueryDTO;
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementCounterpartyVO;
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementDetailVO;
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementFilterOptionsVO;
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementListVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 银行流水Mapper接口
 *
 * @author ruoyi
 * @date 2026-03-04
 */
public interface CcdiBankStatementMapper extends BaseMapper<CcdiBankStatement> {

    /**
     * 批量插入银行流水
     *
     * @param list 银行流水列表
     * @return 插入记录数
     */
    int insertBatch(@Param("list") List<CcdiBankStatement> list);

    int deleteByProjectIdAndBatchId(@Param("projectId") Long projectId,
                                    @Param("batchId") Integer batchId);

    List<CcdiBankStatement> selectStatementsForHistoryImport(@Param("projectId") Long projectId,
                                                             @Param("batchId") Integer batchId,
                                                             @Param("startDate") String startDate,
                                                             @Param("endDate") String endDate);

    Page<CcdiBankStatementListVO> selectStatementPage(Page<CcdiBankStatementListVO> page,
                                                      @Param("query") CcdiBankStatementQueryDTO query);

    Page<CcdiBankStatementCounterpartyVO> selectCounterpartyPage(Page<CcdiBankStatementCounterpartyVO> page,
                                                                 @Param("query") CcdiBankStatementQueryDTO query);

    List<CcdiBankStatementListVO> selectStatementListForExport(@Param("query") CcdiBankStatementQueryDTO query);

    CcdiBankStatementDetailVO selectStatementDetailById(@Param("bankStatementId") Long bankStatementId);

    CcdiBankStatementFilterOptionsVO selectFilterOptions(@Param("projectId") Long projectId);

    Integer countMatchedStaffCountByProjectId(@Param("projectId") Long projectId);
}
