提交 | 用户 | 时间
|
9d7e02
|
1 |
package com.iailab.module.data.channel.opcda.controller; |
潘 |
2 |
|
aecc49
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
L |
4 |
import com.iailab.framework.common.pojo.PageResult; |
|
5 |
import com.iailab.framework.common.util.object.BeanUtils; |
9d7e02
|
6 |
import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity; |
潘 |
7 |
import com.iailab.module.data.channel.opcda.service.ChannelOPCDADeviceService; |
aecc49
|
8 |
import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
L |
9 |
import com.iailab.module.data.channel.opcda.vo.OpcDaDeviceRespVO; |
9d7e02
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
潘 |
11 |
import org.springframework.web.bind.annotation.*; |
|
12 |
|
aecc49
|
13 |
import javax.validation.Valid; |
9d7e02
|
14 |
import java.util.Date; |
潘 |
15 |
import java.util.UUID; |
aecc49
|
16 |
|
L |
17 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
9d7e02
|
18 |
|
潘 |
19 |
/** |
|
20 |
* 操作opc ua配置 |
aecc49
|
21 |
* @author lirm |
L |
22 |
* @Description |
|
23 |
* @createTime 2024年08月26日 |
9d7e02
|
24 |
*/ |
潘 |
25 |
@RestController |
aecc49
|
26 |
@RequestMapping("/data/channel/opcda/device") |
9d7e02
|
27 |
public class ChannelOPCDADeviceController { |
潘 |
28 |
@Autowired |
|
29 |
private ChannelOPCDADeviceService channelOPCDADeviceService; |
|
30 |
|
aecc49
|
31 |
@GetMapping("page") |
L |
32 |
public CommonResult<PageResult<OpcDaDeviceRespVO>> list(@Valid OpcDaDevicePageReqVO reqVO) { |
|
33 |
PageResult<ChannelOPCDADeviceEntity> page = channelOPCDADeviceService.queryPage(reqVO); |
|
34 |
return success(BeanUtils.toBean(page, OpcDaDeviceRespVO.class)); |
9d7e02
|
35 |
} |
潘 |
36 |
|
|
37 |
@GetMapping("/info/{id}") |
aecc49
|
38 |
public CommonResult<ChannelOPCDADeviceEntity> info(@PathVariable("id") String id) { |
9d7e02
|
39 |
ChannelOPCDADeviceEntity info = channelOPCDADeviceService.info(id); |
aecc49
|
40 |
return success(info); |
9d7e02
|
41 |
} |
潘 |
42 |
|
|
43 |
@PostMapping("/add") |
aecc49
|
44 |
public CommonResult<Boolean> add(@RequestBody ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
9d7e02
|
45 |
String id = UUID.randomUUID().toString(); |
潘 |
46 |
channelOPCDADeviceEntity.setId(id); |
|
47 |
channelOPCDADeviceEntity.setCreateTime(new Date()); |
|
48 |
channelOPCDADeviceService.add(channelOPCDADeviceEntity); |
aecc49
|
49 |
return success(true); |
9d7e02
|
50 |
} |
潘 |
51 |
|
aecc49
|
52 |
@PutMapping("/update") |
L |
53 |
public CommonResult<Boolean> update(@RequestBody ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
9d7e02
|
54 |
channelOPCDADeviceEntity.setUpdateTime(new Date()); |
潘 |
55 |
channelOPCDADeviceService.update(channelOPCDADeviceEntity); |
aecc49
|
56 |
return success(true); |
9d7e02
|
57 |
} |
潘 |
58 |
|
aecc49
|
59 |
@DeleteMapping("/delete") |
L |
60 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
9d7e02
|
61 |
channelOPCDADeviceService.delete(id); |
aecc49
|
62 |
return success(true); |
9d7e02
|
63 |
} |
潘 |
64 |
} |