| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @GetMapping("/file-content") |
| | | @Operation(summary = "获取机床目录文件内容", description = "工控网目录文件列表") |
| | | public R<String> machineFileContent(Long id) { |
| | | return R.data("临时内容"); |
| | | String content = machineFileService.getMachineFileContent(id); |
| | | return R.data(content); |
| | | } |
| | | |
| | | @PostMapping("/file-save") |
| | | @Operation(summary = "保存机床文件", description = "保存机床文件到磁盘") |
| | | public R<Void> machineFileSave(Long id,String content) { |
| | | try { |
| | | machineFileService.saveFileConent(id,content); |
| | | } catch (IOException e) { |
| | | log.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.success(); |
| | | } |
| | | |