liriming
2024-08-27 c7f70933adf89a163d0049c907492a6df60cb45f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.iailab.module.data.channel.kio.controller.admin;
 
import com.iailab.framework.common.pojo.CommonResult;
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.framework.common.util.object.BeanUtils;
import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity;
import com.iailab.module.data.channel.kio.service.ChannelKioTagService;
import com.iailab.module.data.channel.kio.vo.KioTagPageReqVO;
import com.iailab.module.data.channel.kio.vo.KioTagRespVO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Date;
import java.util.UUID;
 
import static com.iailab.framework.common.pojo.CommonResult.success;
 
/**
 
 */
@RestController
@RequestMapping("/data/channel/kio/tag")
public class ChannelKioTagController {
    @Resource
    private ChannelKioTagService channelKioTagService;
 
    /**
     * 分页查询tag
     * */
    @GetMapping("page")
    public CommonResult<PageResult<KioTagRespVO>> page(@Valid KioTagPageReqVO reqVO){
        PageResult<ChannelKioTagEntity> page = channelKioTagService.queryPage(reqVO);
        return success(BeanUtils.toBean(page, KioTagRespVO.class));
    }
 
    @GetMapping("/info/{id}")
    @Operation(summary = "信息")
    public CommonResult<ChannelKioTagEntity> info(@PathVariable("id") String id) {
        ChannelKioTagEntity info = channelKioTagService.info(id);
        return success(info);
    }
 
    @PostMapping("/add")
    public CommonResult<Boolean> add(@RequestBody ChannelKioTagEntity channelKioTagEntity) {
        String id = UUID.randomUUID().toString();
        channelKioTagEntity.setId(id);
        channelKioTagEntity.setCreateTime(new Date());
        channelKioTagService.add(channelKioTagEntity);
        return success(true);
    }
 
    @PutMapping("/update")
    public CommonResult<Boolean> update(@RequestBody ChannelKioTagEntity channelKioTagEntity) {
        channelKioTagEntity.setUpdateTime(new Date());
        channelKioTagService.update(channelKioTagEntity);
        return success(true);
    }
 
    @DeleteMapping("/delete")
    public CommonResult<Boolean> delete(@RequestParam("id") String id) {
        channelKioTagService.delete(id);
        return success(true);
    }
 
}