liriming
2024-08-26 aecc4908e1f2861d2dab1929a88f9053238b2dd2
提交 | 用户 | 时间
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;
13 import org.springframework.web.bind.annotation.*;
14
aecc49 15 import javax.annotation.Resource;
L 16 import javax.validation.Valid;
17 import java.util.Date;
a6de49 18 import java.util.UUID;
H 19
20 import static com.iailab.framework.common.pojo.CommonResult.success;
21
22 /**
aecc49 23  * @author lirm
a6de49 24  * @Description
aecc49 25  * @createTime 2024年08月26日
a6de49 26  */
H 27 @RestController
28 @RequestMapping("/data/channel/kio/device")
29 @Tag(name = "KIO")
30 public class ChannelKioDeviceController {
31
32     @Resource
33     private ChannelKioDeviceService channelKioDeviceService;
34
35     @GetMapping("page")
aecc49 36     public CommonResult<PageResult<KioDeviceRespVO>> list(@Valid KioDevicePageReqVO reqVO) {
L 37         PageResult<ChannelKioDeviceEntity> page = channelKioDeviceService.queryPage(reqVO);
38         return success(BeanUtils.toBean(page, KioDeviceRespVO.class));
a6de49 39     }
H 40
aecc49 41     @GetMapping("/info/{id}")
a6de49 42     @Operation(summary = "信息")
aecc49 43     public CommonResult<ChannelKioDeviceEntity> info(@PathVariable("id") String id) {
L 44         ChannelKioDeviceEntity info = channelKioDeviceService.info(id);
45         return success(info);
a6de49 46     }
H 47
aecc49 48     @PostMapping("/add")
L 49     public CommonResult<Boolean> add(@RequestBody ChannelKioDeviceEntity channelKioDeviceEntity) {
a6de49 50         String id = UUID.randomUUID().toString();
aecc49 51         channelKioDeviceEntity.setId(id);
L 52         channelKioDeviceEntity.setCreateTime(new Date());
53         channelKioDeviceService.add(channelKioDeviceEntity);
54         return success(true);
a6de49 55     }
H 56
aecc49 57     @PutMapping("/update")
L 58     public CommonResult<Boolean> update(@RequestBody ChannelKioDeviceEntity channelKioDeviceEntity) {
59         channelKioDeviceEntity.setUpdateTime(new Date());
60         channelKioDeviceService.update(channelKioDeviceEntity);
61         return success(true);
a6de49 62     }
H 63
aecc49 64     @DeleteMapping("/delete")
L 65     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
66         channelKioDeviceService.delete(id);
67         return success(true);
a6de49 68     }
H 69 }