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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.test.cw.contractRegistration.domain.ContractFile;
import com.jeeplus.test.cw.contractRegistration.domain.ContractInfo;
import com.jeeplus.test.cw.contractRegistration.domain.ContractParticipant;
import com.jeeplus.test.oss.domain.WorkAttachment;
import com.jeeplus.test.workContract.domain.WorkContractInfo;
import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 王强
 * @create: 2022-11-08 10:47
 **/
public interface ContractInfoMapper extends BaseMapper<ContractInfo> {

    ContractInfo getInfoById(String id);

    ContractFile getById(String id);

    List<WorkAttachmentDto> findDtos(@Param("id") String id);

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

    ContractInfo findById (@Param("id") String id);

    ContractInfo findFileInfoById (@Param("id") String id);

    ContractInfo findByContractId (@Param("id") String id);

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

    void updatefiledTypeById(@Param("id") String id, @Param("status")String status);

    void updatefiledPaperTypeById(@Param("id") String id, @Param("status")String status);

    List<WorkAttachment> findList(@Param("id") String id);

    Integer findIsExit(@Param("id") String id, @Param("name")String name);

    /**
     * 修改合同实际金额
     * @param id
     * @param actualContractAmount
     * @param contractApprovalType
     */
    void updateInfo(@Param("id") String id,
                    @Param("actualContractAmount") Double actualContractAmount,
                    @Param("contractApprovalType") String contractApprovalType,
                    @Param("filedType") String filedType);

    List<String> findChildIds(String department);

    List<ContractInfo> getByClientId(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

    // 没有使用客户id作为参数，而是直接查询，是因为 合同与客户的关联表 中没有 客户id 的字段，只有客户编号的字段
    List<String> getClientListByClientNo(@Param("no") String no);

    void updateBorrowTypeById(@Param("id") String id, @Param("status")String status);

    /**
     * 修改纸质归档状态
     * @param id
     * @param filedPaperType
     */
    void updatePaperInfo(@Param("id") String id,
                         @Param("actualContractAmount") Double actualContractAmount,
                         @Param("contractApprovalType") String contractApprovalType,
                         @Param("filedPaperType") String filedPaperType);

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

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

    String isUseByInvoice(@Param("id") String id);
}
