package com.red.circle.console.adapter.app.dynamic;

import com.red.circle.console.app.service.app.dynamic.DynamicTagService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd;
import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd;
import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 动态-标签 前端控制器.
 *
 * @author pengshigang
 * @since 2022-4-15
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/dynamic/tag")
public class DynamicTagRestController extends BaseController {

  private final DynamicTagService dynamicTagService;

  /**
   * 分页
   */
  @GetMapping("/page")
  public PageResult<DynamicTagDTO> pageData(PageDynamicTagQryCmd query) {
    return dynamicTagService.pageData(query);
  }

  /**
   * 添加、更新
   */
  @PostMapping("/add-or-update")
  public void addOrUpdate(@RequestBody @Validated DynamicTagCmd param) {
    dynamicTagService.addOrUpdate(param);
  }


}
