package com.gz.controller.system;

import com.gz.core.exception.BusinessException;
import com.gz.dto.system.FileDTO;
import com.gz.service.system.FileService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author LiuchangLan
 * @date 2021/2/28 13:39
 */
@RestController
@RequestMapping("system/file")
public class FileController {

    @Resource
    private FileService fileService;

    @PostMapping("upload")
    public FileDTO upload(@RequestBody MultipartFile file) throws IOException, BusinessException {
        return fileService.upload(file);
    }
}
