| | |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaTagRespVO; |
| | | import com.iailab.module.data.common.exception.RRException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | public class ChannelOPCDATagController { |
| | | @Autowired |
| | | private ChannelOPCDATagService channelOPCDATagService; |
| | | |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')") |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcDaTagRespVO>> list(@Valid OpcDaTagPageReqVO reqVO) { |
| | | PageResult<ChannelOPCDATagEntity> page = channelOPCDATagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcDaTagRespVO.class)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')") |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<ChannelOPCDATagEntity> info(@PathVariable("id") String id) { |
| | | ChannelOPCDATagEntity info = channelOPCDATagService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:create')") |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> create(@RequestBody ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelOPCDATagEntity.setId(id); |
| | | channelOPCDATagEntity.setCreateTime(new Date()); |
| | |
| | | return success(true); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:update')") |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | channelOPCDATagEntity.setUpdateTime(new Date()); |
| | |
| | | return success(true); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:delete')") |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelOPCDATagService.delete(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PostMapping("/import/{serverId}") |
| | | public CommonResult<String> importTag(@PathVariable("serverId") String serverId, @RequestParam("file") MultipartFile file) { |
| | | try { |