package com.qmth.teachcloud.common.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.teachcloud.common.entity.BasicAttachment;
import com.qmth.teachcloud.common.enums.UploadFileEnum;
import org.springframework.web.multipart.MultipartFile;

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

/**
 * <p>
 * 所有附件记录表 服务类
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
public interface BasicAttachmentService extends IService<BasicAttachment> {

    /**
     * 保存html文件
     *
     * @param rootPath    文件路径
     * @param fileName    文件名
     * @param htmlContent 文件内容
     * @return
     */
    public File saveAttachmentHtml(String rootPath, String fileName, String htmlContent);

    /**
     * 保存附件
     *
     * @param dirName
     * @param userId
     * @return
     * @throws IOException
     */
    public BasicAttachment saveAttachmentPdf(String dirName, Long userId) throws IOException;

    /**
     * 删除附件
     *
     * @param tbAttachment
     */
    public void deleteAttachment(BasicAttachment tbAttachment);

    /**
     * 批量删除附件
     *
     * @param basicAttachmentList
     */
    public void batchDeleteAttachment(List<BasicAttachment> basicAttachmentList);

    BasicAttachment saveAttachment(MultipartFile file, String requestMd5, UploadFileEnum file1);
}
