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


import com.red.circle.console.app.service.app.sys.SysRegionRelationBackService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.user.SysRegionRelationCmd;
import com.red.circle.other.inner.model.cmd.user.SysRegionRelationQryCmd;
import com.red.circle.other.inner.model.dto.user.reigon.RegionRelationDTO;
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;

/**
 * <p>
 * 区域业务关系组合等.
 * </p>
 *
 * @author pengshigang
 * @since 2023-04-01
 */
@RestController
@RequestMapping("/sys/region/relation")
@RequiredArgsConstructor
public class SysRegionRelationRestController extends BaseController {

  private final SysRegionRelationBackService sysRegionRelationBackService;

  /**
   * 分页列表.
   */
  @GetMapping("/page")
  public PageResult<RegionRelationDTO> pageSysPushBack(SysRegionRelationQryCmd query) {
    return sysRegionRelationBackService.pageRelation(query);
  }

  /**
   * 添加区域业务关系.
   */
  @PostMapping("/add")
  public void add(@RequestBody @Validated SysRegionRelationCmd param) {

    sysRegionRelationBackService.add(param);
  }

  /**
   * 修改区域业务关系.
   */
  @PostMapping("/update")
  public void update(@RequestBody @Validated SysRegionRelationCmd param) {

    sysRegionRelationBackService.update(param);
  }

}
