|
|
|
@ -54,6 +54,7 @@ public class FileController { |
|
|
|
|
file.transferTo(txtFile); |
|
|
|
|
com.bupt.note.Model.File f=new com.bupt.note.Model.File(); |
|
|
|
|
f.setFilePath(txtFile.getAbsolutePath()); |
|
|
|
|
f.setUrlPath("/txt/"+txtFile.getName()); |
|
|
|
|
fileRepository.save(f); |
|
|
|
|
return ResponseDataUtil.buildSuccess(f.getId()); |
|
|
|
|
} catch (IOException e) { |
|
|
|
@ -66,6 +67,16 @@ public class FileController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("find/{id}") |
|
|
|
|
public ResponseData get(@PathVariable Long id){ |
|
|
|
|
if(fileRepository.existsById(id)){ |
|
|
|
|
com.bupt.note.Model.File file= fileRepository.getOne(id); |
|
|
|
|
return ResponseDataUtil.buildSuccess(file.getUrlPath()); |
|
|
|
|
}else{ |
|
|
|
|
return ResponseDataUtil.buildError(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除论文文本文件 |
|
|
|
|
* @param id 文件id |
|
|
|
|