package com.sunxung.factoring.mapper.purchcontractmanagement;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractBasicInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description : 采购合同Mapper
 * @Author : JiaYf
 * @Date: 2021-09-14 14:36
 */
@Mapper
public interface PurchContractBasicInfoMapper extends BaseMapper<PurchContractBasicInfo> {


    /**
     * 获取最新的采购合同详情信息
     *
     * @param purchContractManageId
     * @return
     */
    PurchContractBasicInfo getLatestBasicInfo(@Param("purchContractManageId")Long purchContractManageId, @Param("conclusion") String conclusion);

    /**
     * 获取采购合同详情信息
     *JiaYf
     * @param id
     * @return
     */
    PurchContractBasicInfo getDetail(Long id);

    /**
     * 查询附件ID
     *
     * @param purchContractId 采购合同ID
     * @return List<Long> 附件ID集合
     */
    List<Long> findFileIdByPurchContractId(@Param("purchContractId") Long purchContractId);

    /**
     * 删除附件中间表
     *
     * @param purchContractId 采购合同ID
     * @param fileId 附件的ID
     * @return int 受影响的记录数
     */
    int deleteFileRef(@Param("purchContractId") Long purchContractId, @Param("fileId") Long fileId);

    /**
     * 新增合同附件中间表
     *
     * @param purchContractId 采购合同ID
     * @param fileId 附件的ID
     */
    void addFileRef(@Param("purchContractId") Long purchContractId, @Param("fileId") Long fileId);

}
