package com.hzya.frame.sys.file.upload.service;

import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sys.file.upload.entity.FileResultEntity;
import com.hzya.frame.sys.file.upload.entity.FileUploadDto;
import com.hzya.frame.sys.file.upload.entity.FileUploadEntity;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @description: 系统文件上传  service
 * @tableName: sys_file
 * @entityName: FileUploadEntity
 * @author: gjh
 * @history: 1.0
 */
public interface IFileUploadService extends IBaseService<FileUploadEntity, Long> {
    /**
     * 文件上传方法
     *
     * @param files
     * @param entity
     * @return
     * @throws IOException
     */
    FileUploadEntity fileUpload(MultipartFile files, FileUploadDto entity) throws Exception;

    FileUploadEntity pluginfileUpload(MultipartFile files, FileUploadDto entity,String pluginPackageName) throws Exception;
    /**
     * 文件上传方法
     *
     * @param files
     * @param entity
     * @return
     * @throws IOException
     */
    FileResultEntity fileUpload(MultipartFile files, FileResultEntity entity) throws Exception;

    /***
     * 根据传入的业务信息 把附件复制到相关业务信息下面
     * @param entity
     * @return
     */
    FileResultEntity copyFileToBusiness(FileResultEntity entity) throws Exception;

    /***
     * 根据fileSaveName删除附件
     * @param businessType  删除类型   1，业务删除（业务删除时候，需要把文件备份一份到指定的文件夹），2，非业务删除（直接删除文件）
     * @param fileSaveName  附件的唯一名称
     * @return
     */
    boolean deleteFileByFileSaveName(Long businessFileId, String businessType, String fileSaveName) throws Exception;
}
