package com.qmth.themis.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.themis.business.entity.TBAttachment;
import com.qmth.themis.business.enums.UploadFileEnum;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @Description: 附件 服务类
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020-04-17
 */
public interface TBAttachmentService extends IService<TBAttachment> {

    /**
     * 保存附件
     *
     * @param file
     * @param md5
     * @param path
     * @param map
     * @param orgId
     * @param userId
     * @return
     * @throws IOException
     */
    TBAttachment saveAttachment(MultipartFile file, String md5, String path, Map<String, Object> map,
            UploadFileEnum type, Long orgId, Long userId) throws IOException;

    /**
     * 保存附件
     *
     * @param path
     * @param map
     * @param orgId
     * @param userId
     * @return
     * @throws IOException
     */
    TBAttachment saveAttachment(String path, Map<String, Object> map, UploadFileEnum type, Long orgId, Long userId)
            throws IOException;

    /**
     * 删除附件
     *
     * @param map
     * @param tbAttachment
     */
    void deleteAttachment(Map<String, Object> map, UploadFileEnum type, TBAttachment tbAttachment);

    /**
     * 批量删除附件
     *
     * @param map
     * @param list
     */
    void batchDeleteAttachment(Map<String, Object> map, UploadFileEnum type, List<Map> list);

    TBAttachment saveAttachment(File file, String md5, String path, Map<String, Object> map, UploadFileEnum type,
            Long orgId, Long userId) throws IOException;
}