package com.lutao.cloud.oil.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lutao.cloud.common.core.util.MessageInfo;
import com.lutao.cloud.oil.pojo.entity.UploadFile;
import com.lutao.cloud.oil.pojo.param.FileParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

public interface UploadFileService extends IService<UploadFile> {

    /**
     * 上传文件
     * @param file
     * @return
     */
    MessageInfo uploadFile(MultipartFile file);

    /**
     * 读取文件
     * @param bucket 桶名称
     * @param fileName 文件名称
     * @param response 输出流
     */
    void getFile(String bucket, String fileName, HttpServletResponse response);

    /**
     * 删除文件
     * @param id
     * @return
     */
    Boolean deleteFile(Long id);


    MessageInfo<IPage<UploadFile>> filePage(Page page, FileParam param);
}
