| | |
| | | |
| | | package org.springblade.mdm.gkw.programnode.controller; |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.mdm.gkw.programnode.entity.MachineFile; |
| | | import org.springblade.mdm.gkw.programnode.service.MachineFileService; |
| | | import org.springblade.mdm.gkw.programnode.service.ProgramNodeService; |
| | | import org.springblade.mdm.gkw.programnode.vo.MachineFileQueryVO; |
| | | import org.springblade.mdm.gkw.programnode.vo.ProgramNodeVO; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 公开网程序节点 |
| | |
| | | |
| | | IPage<MachineFile> pageData = machineFileService.lambdaQuery() |
| | | .eq(MachineFile::getMachineCode,query.getMachineCode()) |
| | | .eq(MachineFile::getDirType,query.getDirType()).page(Condition.getPage(query)); |
| | | .eq(MachineFile::getDirType,query.getDirType()) |
| | | .ne(MachineFile::getStatus,MachineFile.STATUS_REMOVED).like(StringUtils.isNotBlank(query.getName()),MachineFile::getName,query.getName()) |
| | | .page(Condition.getPage(query)); |
| | | return R.data(pageData); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/file-content") |
| | | @Operation(summary = "获取机床目录文件内容", description = "工控网目录文件列表") |
| | | public R<String> machineFileContent(Long id) { |
| | | 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.saveFileContent(id,content); |
| | | } catch (IOException e) { |
| | | log.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.success(); |
| | | } |
| | | |
| | | } |