提交 6f5d93fc authored 作者: mrunyu's avatar mrunyu

不需要文件上传,删除了文件上传功能

上级 8f15d6bb
package com.jenkins.controller;
import com.jenkins.service.FileService;
import com.jenkins.vo.FileVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.nio.channels.MulticastChannel;
@CrossOrigin
@RestController
@RequestMapping("/files")
@Api(tags = "添加文件",description = "上床文件到本地")
public class FileController {
private final FileService fileService;
public FileController(FileService fileService) {
this.fileService = fileService;
}
@PostMapping
public ResponseEntity<FileVo> upload(MultipartFile file){
FileVo fileVo = fileService.upload(file);
if (fileVo == null){
return ResponseEntity.status(404).body(fileVo);
}else {
return ResponseEntity.ok(fileVo);
}
}
}
package com.jenkins.service;
import com.jenkins.vo.FileVo;
import org.springframework.web.multipart.MultipartFile;
public interface FileService {
FileVo upload(MultipartFile file);
}
package com.jenkins.service.Impl;
import com.jenkins.service.FileService;
import com.jenkins.vo.FileVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class FileServiceImpl implements FileService {
@Value("${file.localDirPath}")
private String localDirPath; //本地磁盘地址
@Override
public FileVo upload(MultipartFile file) {
String fileName = file.getOriginalFilename();
fileName = fileName.toLowerCase(); //文件名称全小写
return null;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论