Jay
2024-11-25 ee9f604388a3e77d3f4654e326f3976552e7f532
提交 | 用户 | 时间
a6de49 1 package com.iailab.module.data.channel.kio.controller.admin;
H 2
3 import com.iailab.framework.common.pojo.CommonResult;
aecc49 4 import com.iailab.framework.common.pojo.PageResult;
L 5 import com.iailab.framework.common.util.object.BeanUtils;
a6de49 6 import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO;
aecc49 7 import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity;
L 8 import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService;
9 import com.iailab.module.data.channel.kio.vo.KioDevicePageReqVO;
10 import com.iailab.module.data.channel.kio.vo.KioDeviceRespVO;
a6de49 11 import io.swagger.v3.oas.annotations.Operation;
H 12 import io.swagger.v3.oas.annotations.tags.Tag;
a477ef 13 import org.springframework.security.access.prepost.PreAuthorize;
a6de49 14 import org.springframework.web.bind.annotation.*;
H 15
aecc49 16 import javax.annotation.Resource;
L 17 import javax.validation.Valid;
18 import java.util.Date;
a6de49 19 import java.util.UUID;
H 20
21 import static com.iailab.framework.common.pojo.CommonResult.success;
22
23 /**
aecc49 24  * @author lirm
a6de49 25  * @Description
aecc49 26  * @createTime 2024年08月26日
a6de49 27  */
H 28 @RestController
29 @RequestMapping("/data/channel/kio/device")
30 @Tag(name = "KIO")
31 public class ChannelKioDeviceController {
32
33     @Resource
34     private ChannelKioDeviceService channelKioDeviceService;
35
a477ef 36     @PreAuthorize("@ss.hasPermission('data:channel-kio:query')")
a6de49 37     @GetMapping("page")
aecc49 38     public CommonResult<PageResult<KioDeviceRespVO>> list(@Valid KioDevicePageReqVO reqVO) {
L 39         PageResult<ChannelKioDeviceEntity> page = channelKioDeviceService.queryPage(reqVO);
40         return success(BeanUtils.toBean(page, KioDeviceRespVO.class));
a6de49 41     }
H 42
a477ef 43     @PreAuthorize("@ss.hasPermission('data:channel-kio:query')")
aecc49 44     @GetMapping("/info/{id}")
a6de49 45     @Operation(summary = "信息")
aecc49 46     public CommonResult<ChannelKioDeviceEntity> info(@PathVariable("id") String id) {
L 47         ChannelKioDeviceEntity info = channelKioDeviceService.info(id);
48         return success(info);
a6de49 49     }
H 50
a477ef 51     @PreAuthorize("@ss.hasPermission('data:channel-kio:create')")
aecc49 52     @PostMapping("/add")
a477ef 53     public CommonResult<Boolean> create(@RequestBody ChannelKioDeviceEntity channelKioDeviceEntity) {
a6de49 54         String id = UUID.randomUUID().toString();
aecc49 55         channelKioDeviceEntity.setId(id);
L 56         channelKioDeviceEntity.setCreateTime(new Date());
57         channelKioDeviceService.add(channelKioDeviceEntity);
58         return success(true);
a6de49 59     }
H 60
a477ef 61     @PreAuthorize("@ss.hasPermission('data:channel-kio:update')")
aecc49 62     @PutMapping("/update")
L 63     public CommonResult<Boolean> update(@RequestBody ChannelKioDeviceEntity channelKioDeviceEntity) {
64         channelKioDeviceEntity.setUpdateTime(new Date());
65         channelKioDeviceService.update(channelKioDeviceEntity);
66         return success(true);
a6de49 67     }
H 68
a477ef 69     @PreAuthorize("@ss.hasPermission('data:channel-kio:delete')")
aecc49 70     @DeleteMapping("/delete")
L 71     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
72         channelKioDeviceService.delete(id);
73         return success(true);
a6de49 74     }
H 75 }