潘志宝
2024-11-15 4be7d863a161b64f8592a789d699e807545e7dc6
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUADeviceController.java
@@ -7,6 +7,7 @@
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;
@@ -27,32 +28,37 @@
    @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);