潘志宝
2024-09-19 336bd22b721af9ff7fcaa23eb54c307b9047ffaa
提交 | 用户 | 时间
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;
7c3e09 10 import org.springframework.security.access.prepost.PreAuthorize;
c7f709 11 import org.springframework.web.bind.annotation.*;
L 12
13 import javax.annotation.Resource;
14 import javax.validation.Valid;
336bd2 15 import java.util.Date;
c7f709 16 import java.util.List;
L 17 import java.util.UUID;
18
19 import static com.iailab.framework.common.pojo.CommonResult.success;
20
21
22 /**
23  * @author lirm
24  * @Description
25  * @createTime 2024年08月27日
26  */
27 @RestController
7c3e09 28 @RequestMapping("/data/channel/http/tag")
c7f709 29 public class HttpTagController {
L 30
31     @Resource
32     private HttpTagService tagService;
33
7c3e09 34     @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
c7f709 35     @GetMapping("page")
L 36     public CommonResult<PageResult<HttpTagRespVO>> page(@Valid HttpTagPageReqVO reqVO) {
37         PageResult<HttpTagEntity> page = tagService.queryPage(reqVO);
38         return success(BeanUtils.toBean(page, HttpTagRespVO.class));
39     }
40
7c3e09 41     @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
c7f709 42     @GetMapping("list")
L 43     public CommonResult<List<HttpTagEntity>> list(){
44         List<HttpTagEntity> list = tagService.list();
45         return new CommonResult<List<HttpTagEntity>>().setData(list);
46     }
47
7c3e09 48     @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
c7f709 49     @GetMapping("/info/{id}")
L 50     public CommonResult<HttpTagEntity> info(@PathVariable("id") String id){
51         HttpTagEntity info= tagService.info(id);
52         return success(info);
53     }
54
7c3e09 55     @PreAuthorize("@ss.hasPermission('data:channel-http:create')")
56     @PostMapping("/create")
c7f709 57     public CommonResult<Boolean> add(@RequestBody HttpTagEntity httpTagEntity){
336bd2 58         httpTagEntity.setId(UUID.randomUUID().toString());
59         httpTagEntity.setCreateTime(new Date());
c7f709 60         tagService.add(httpTagEntity);
L 61         return success(true);
62     }
63
7c3e09 64     @PreAuthorize("@ss.hasPermission('data:channel-http:update')")
c7f709 65     @PutMapping("/update")
L 66     public CommonResult<Boolean> update(@RequestBody HttpTagEntity httpTagEntity) {
336bd2 67         httpTagEntity.setUpdateTime(new Date());
c7f709 68         tagService.update(httpTagEntity);
L 69         return success(true);
70     }
71
7c3e09 72     @PreAuthorize("@ss.hasPermission('data:channel-http:delete')")
c7f709 73     @DeleteMapping("/delete")
L 74     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
75         tagService.delete(id);
76         return success(true);
77     }
78 }