You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.7 KiB
Java
58 lines
1.7 KiB
Java
package com.supervision.nebula.controller;
|
|
|
|
|
|
import com.supervision.nebula.dto.ImportBean;
|
|
import com.supervision.nebula.entity.GraphFile;
|
|
import com.supervision.nebula.service.GraphFileService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import java.io.IOException;
|
|
|
|
/**
|
|
* (GraphFile)表控制层
|
|
*
|
|
* @author makejava
|
|
* @since 2022-08-23 09:09:26
|
|
*/
|
|
@RestController
|
|
@Tag(name = "文件控制器")
|
|
@RequestMapping("graphFile")
|
|
public class GraphFileController {
|
|
|
|
@Resource
|
|
private GraphFileService graphFileService;
|
|
|
|
/**
|
|
* 文件上传
|
|
*
|
|
* @param file 文件
|
|
* @return 文件实例对象
|
|
*/
|
|
|
|
@Operation(summary = "文件上传--可以不做,这里为了预览数据")
|
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
public GraphFile uploadFile(@RequestParam("file") MultipartFile file) {
|
|
return this.graphFileService.uploadFile(file);
|
|
}
|
|
|
|
@Operation(summary = "文件导入--执行nebula import插件")
|
|
@PostMapping("/import")
|
|
public Boolean importFile(@RequestBody ImportBean importBean) throws IOException {
|
|
return this.graphFileService.importFile(importBean);
|
|
}
|
|
|
|
@Operation(summary = "模板下载,可以填充数据")
|
|
@GetMapping("/template")
|
|
public void template(@RequestParam String space, HttpServletResponse response) {
|
|
graphFileService.template(space, response);
|
|
}
|
|
|
|
}
|
|
|