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> page(@Valid KioTagPageReqVO reqVO){ PageResult page = channelKioTagService.queryPage(reqVO); return success(BeanUtils.toBean(page, KioTagRespVO.class)); } @GetMapping("/info/{id}") @Operation(summary = "信息") public CommonResult info(@PathVariable("id") String id) { ChannelKioTagEntity info = channelKioTagService.info(id); return success(info); } @PostMapping("/add") public CommonResult 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 update(@RequestBody ChannelKioTagEntity channelKioTagEntity) { channelKioTagEntity.setUpdateTime(new Date()); channelKioTagService.update(channelKioTagEntity); return success(true); } @DeleteMapping("/delete") public CommonResult delete(@RequestParam("id") String id) { channelKioTagService.delete(id); return success(true); } }