| | |
| | | import com.iailab.module.data.channel.modbus.service.ChannelModbusDeviceService; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusDeviceRespVO; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.UUID; |
| | |
| | | * |
| | | * @param reqVO |
| | | */ |
| | | @PreAuthorize("@ss.hasPermission('data:channel-modbus:query')") |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<ModBusDeviceRespVO>> list(@Valid ModBusDevicePageReqVO reqVO) { |
| | | public CommonResult<PageResult<ModBusDeviceRespVO>> list(@Validated ModBusDevicePageReqVO reqVO) { |
| | | PageResult<ChannelModBusDeviceEntity> page = channelModbusDeviceService.queryPage(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, ModBusDeviceRespVO.class)); |
| | |
| | | * |
| | | * @param id |
| | | */ |
| | | @PreAuthorize("@ss.hasPermission('data:channel-modbus:query')") |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<ChannelModBusDeviceEntity> info(@PathVariable("id") String id) { |
| | | ChannelModBusDeviceEntity info = channelModbusDeviceService.info(id); |
| | |
| | | * |
| | | * @param channelModBusDeviceEntity |
| | | */ |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity) { |
| | | @PreAuthorize("@ss.hasPermission('data:channel-modbus:create')") |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> create(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelModBusDeviceEntity.setId(id); |
| | | channelModbusDeviceService.add(channelModBusDeviceEntity); |
| | |
| | | * |
| | | * @param channelModBusDeviceEntity |
| | | */ |
| | | @PreAuthorize("@ss.hasPermission('data:channel-modbus:update')") |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity) { |
| | | channelModbusDeviceService.update(channelModBusDeviceEntity); |
| | |
| | | * |
| | | * @param id |
| | | */ |
| | | @PreAuthorize("@ss.hasPermission('data:channel-modbus:delete')") |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelModbusDeviceService.delete(id); |