| | |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUADeviceService; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDevicePageReqVO; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDeviceRespVO; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private ChannelOPCUADeviceService channelOPCUADeviceService; |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')") |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcUaDeviceRespVO>> list(@Valid OpcUaDevicePageReqVO reqVO) { |
| | | PageResult<ChannelOPCUADeviceEntity> page = channelOPCUADeviceService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcUaDeviceRespVO.class)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')") |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<ChannelOPCUADeviceEntity> info(@PathVariable("id") String id) { |
| | | ChannelOPCUADeviceEntity info = channelOPCUADeviceService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:create')") |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> create(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelOPCUADeviceEntity.setId(id); |
| | | channelOPCUADeviceService.add(channelOPCUADeviceEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:update')") |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | channelOPCUADeviceService.update(channelOPCUADeviceEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:delete')") |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelOPCUADeviceService.delete(id); |