package com.iailab.module.data.channel.http.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.http.entity.HttpTagEntity; import com.iailab.module.data.channel.http.service.HttpTagService; import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; import com.iailab.module.data.channel.http.vo.HttpTagRespVO; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; import java.util.Date; import java.util.List; import java.util.UUID; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author lirm * @Description * @createTime 2024年08月27日 */ @RestController @RequestMapping("/data/channel/http/tag") public class HttpTagController { @Resource private HttpTagService tagService; @PreAuthorize("@ss.hasPermission('data:channel-http:query')") @GetMapping("page") public CommonResult> page(@Valid HttpTagPageReqVO reqVO) { PageResult page = tagService.queryPage(reqVO); return success(BeanUtils.toBean(page, HttpTagRespVO.class)); } @PreAuthorize("@ss.hasPermission('data:channel-http:query')") @GetMapping("list") public CommonResult> list(){ List list = tagService.list(); return new CommonResult>().setData(list); } @PreAuthorize("@ss.hasPermission('data:channel-http:query')") @GetMapping("/info/{id}") public CommonResult info(@PathVariable("id") String id){ HttpTagEntity info= tagService.info(id); return success(info); } @PreAuthorize("@ss.hasPermission('data:channel-http:create')") @PostMapping("/create") public CommonResult add(@RequestBody HttpTagEntity httpTagEntity){ httpTagEntity.setId(UUID.randomUUID().toString()); httpTagEntity.setCreateTime(new Date()); tagService.add(httpTagEntity); return success(true); } @PreAuthorize("@ss.hasPermission('data:channel-http:update')") @PutMapping("/update") public CommonResult update(@RequestBody HttpTagEntity httpTagEntity) { httpTagEntity.setUpdateTime(new Date()); tagService.update(httpTagEntity); return success(true); } @PreAuthorize("@ss.hasPermission('data:channel-http:delete')") @DeleteMapping("/delete") public CommonResult delete(@RequestParam("id") String id) { tagService.delete(id); return success(true); } }