package com.ruoyi.credit.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.credit.domain.ContractAttachment;

/**
 * 合同附件Mapper接口
 * 
 * @author ruoyi
 * @date 2025-12-17
 */
public interface ContractAttachmentMapper 
{
    /**
     * 查询合同附件
     * 
     * @param attachmentId 合同附件主键
     * @return 合同附件
     */
    public ContractAttachment selectContractAttachmentByAttachmentId(Long attachmentId);

    /**
     * 根据合同ID查询附件列表
     * 
     * @param contractId 合同ID
     * @return 合同附件集合
     */
    public List<ContractAttachment> selectContractAttachmentByContractId(Long contractId);

    /**
     * 查询合同附件列表
     * 
     * @param contractAttachment 合同附件
     * @return 合同附件集合
     */
    public List<ContractAttachment> selectContractAttachmentList(ContractAttachment contractAttachment);

    /**
     * 根据附件类型查询附件列表
     * 
     * @param attachmentType 附件类型
     * @return 合同附件集合
     */
    public List<ContractAttachment> selectContractAttachmentByType(String attachmentType);

    /**
     * 根据上传状态查询附件列表
     * 
     * @param uploadStatus 上传状态
     * @return 合同附件集合
     */
    public List<ContractAttachment> selectContractAttachmentByStatus(String uploadStatus);

    /**
     * 根据文件哈希查询附件
     * 
     * @param fileHash 文件哈希
     * @return 合同附件
     */
    public ContractAttachment selectContractAttachmentByFileHash(String fileHash);

    /**
     * 统计附件数量按类型分组
     * 
     * @return 统计结果
     */
    public List<java.util.Map<String, Object>> selectAttachmentCountByType();

    /**
     * 统计附件总大小
     * 
     * @return 总大小
     */
    public Long selectTotalFileSize();

    /**
     * 新增合同附件
     * 
     * @param contractAttachment 合同附件
     * @return 结果
     */
    public int insertContractAttachment(ContractAttachment contractAttachment);

    /**
     * 修改合同附件
     * 
     * @param contractAttachment 合同附件
     * @return 结果
     */
    public int updateContractAttachment(ContractAttachment contractAttachment);

    /**
     * 更新上传状态
     * 
     * @param attachmentId 附件ID
     * @param uploadStatus 上传状态
     * @return 结果
     */
    public int updateUploadStatus(@Param("attachmentId") Long attachmentId, @Param("uploadStatus") String uploadStatus);

    /**
     * 删除合同附件
     * 
     * @param attachmentId 合同附件主键
     * @return 结果
     */
    public int deleteContractAttachmentByAttachmentId(Long attachmentId);

    /**
     * 根据合同ID删除附件
     * 
     * @param contractId 合同ID
     * @return 结果
     */
    public int deleteContractAttachmentByContractId(Long contractId);

    /**
     * 批量删除合同附件
     * 
     * @param attachmentIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteContractAttachmentByAttachmentIds(Long[] attachmentIds);
}