package com.jeeplus.finance.projectRecords.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.projectRecords.domain.CwProjectRecords;
import com.jeeplus.finance.projectRecords.service.dto.CwProjectClientInfoDTO;
import com.jeeplus.finance.projectRecords.service.dto.CwProjectRecordsDTO;
import com.jeeplus.sys.service.dto.UserDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 财务项目登记mapper
 * @author: 徐滕
 * @version: 2022-11-10 14:56
 */
@Mapper
public interface CwProjectRecordsMapper extends BaseMapper<CwProjectRecords> {
    /**
     * 查询项目数据集合
     * @param page
     * @param queryWrapper
     * @return
     */
    // @InterceptorIgnore(tenantLine = "true")
    IPage<CwProjectRecordsDTO> findList(Page<CwProjectRecordsDTO> page, @Param(Constants.WRAPPER) QueryWrapper<CwProjectRecords> queryWrapper);
    /**
     * 查询项目数据集合,和上面findList是一样的，目的是跳过findList接口的数据规则（比如仅部门可见、仅自己可见之类的）
     */
    IPage<CwProjectRecordsDTO> findList2(Page<CwProjectRecordsDTO> page, @Param(Constants.WRAPPER) QueryWrapper<CwProjectRecords> queryWrapper);
    /**
     * 根据id查询项目详情
     * @param id
     * @return
     */
    CwProjectRecordsDTO queryById(@Param("id") String id);

    /**
     * 根据项目id删除项目相关的所有被服务单位
     * @param projectId
     * @return
     */
    Integer deleteProjectClientInfoByProjectId(@Param("projectId") String projectId);

    /**
     * 保存被服务单位信息
     * @param cwProjectClientInfoList
     * @return
     */
    Integer insertProjectClientInfoList(@Param("cwProjectClientInfoList") List<CwProjectClientInfoDTO> cwProjectClientInfoList);

    List<String> getProjectIdByClientId(@Param("id") String id);

    List<CwProjectRecordsDTO> getProjectByIdList(@Param(Constants.WRAPPER) QueryWrapper<CwProjectRecords> queryWrapper);

    List<CwProjectRecordsDTO> getByContractId(@Param(Constants.WRAPPER) QueryWrapper<CwProjectRecords> queryWrapper);

    List<String> getHaveProjectIds(@Param("currentUser") UserDTO currentUser);

    List<String> isUseByReport(String[] idArray);

    List<String> isUseByReim(String[] idArray);

    List<String> isUseByFinance(String[] idArray);

    @InterceptorIgnore(tenantLine = "true")
    void updatereportReviewById(CwProjectRecords records);

    @InterceptorIgnore(tenantLine = "true")
    List<CwProjectRecords> getListByIds(@Param("ids") List<String> ids);



    List<CwProjectRecordsDTO> getReportById(@Param("id") String id, @Param("cwProjectRecordsDTO") CwProjectRecordsDTO cwProjectRecordsDTO);

    List<CwProjectRecordsDTO> getReportByProjectId(@Param("id") String id);
}
