liriming
2024-09-02 6bf63be83c6e5eeed1b5d19747f473478075c3a6
提交 | 用户 | 时间
c7f709 1 package com.iailab.module.data.channel.http.controller.admin;
L 2
3 import com.iailab.framework.common.pojo.CommonResult;
4 import com.iailab.framework.common.pojo.PageResult;
5 import com.iailab.framework.common.util.object.BeanUtils;
6 import com.iailab.module.data.channel.http.entity.HttpTagEntity;
7 import com.iailab.module.data.channel.http.service.HttpTagService;
8 import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO;
9 import com.iailab.module.data.channel.http.vo.HttpTagRespVO;
10 import org.springframework.web.bind.annotation.*;
11
12 import javax.annotation.Resource;
13 import javax.validation.Valid;
14 import java.util.List;
15 import java.util.UUID;
16
17 import static com.iailab.framework.common.pojo.CommonResult.success;
18
19
20 /**
21  * @author lirm
22  * @Description
23  * @createTime 2024年08月27日
24  */
25 @RestController
26 @RequestMapping("/data/http/tag")
27 public class HttpTagController {
28
29     @Resource
30     private HttpTagService tagService;
31
32     @GetMapping("page")
33     public CommonResult<PageResult<HttpTagRespVO>> page(@Valid HttpTagPageReqVO reqVO) {
34         PageResult<HttpTagEntity> page = tagService.queryPage(reqVO);
35         return success(BeanUtils.toBean(page, HttpTagRespVO.class));
36     }
37
38     @GetMapping("list")
39     public CommonResult<List<HttpTagEntity>> list(){
40         List<HttpTagEntity> list = tagService.list();
41         return new CommonResult<List<HttpTagEntity>>().setData(list);
42     }
43
44     @GetMapping("/info/{id}")
45     public CommonResult<HttpTagEntity> info(@PathVariable("id") String id){
46         HttpTagEntity info= tagService.info(id);
47         return success(info);
48     }
49
50     @PostMapping("/add")
51     public CommonResult<Boolean> add(@RequestBody HttpTagEntity httpTagEntity){
52         String id = UUID.randomUUID().toString();
53         httpTagEntity.setId(id);
54         tagService.add(httpTagEntity);
55         return success(true);
56     }
57
58     @PutMapping("/update")
59     public CommonResult<Boolean> update(@RequestBody HttpTagEntity httpTagEntity) {
60         tagService.update(httpTagEntity);
61         return success(true);
62     }
63
64     @DeleteMapping("/delete")
65     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
66         tagService.delete(id);
67         return success(true);
68     }
69 }