package com.jeeplus.test.cw.projectRecords.mapper;

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.sys.service.dto.UserDTO;
import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectClientInfoDTO;
import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
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
     */
    IPage<CwProjectRecordsDTO> findList(Page<CwProjectRecordsDTO> page,@Param("currentUser") UserDTO currentUser,@Param("isBmzr") String isBmzr, @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);
}
