package com.yuchen.saas.park.service.controller.elevator;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.elevator.ElevatorPersonDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nest.springwrap.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.nest.springwrap.core.tool.api.R;
import lombok.extern.slf4j.Slf4j;
import com.yuchen.saas.park.api.entity.elevator.SaasParkElevatorRelativePark;
import com.yuchen.saas.park.service.service.elevator.ISaasParkElevatorRelativeParkService;

import javax.validation.Valid;

/**
 * <p>
 * 梯控-园区关联表 前端控制器
 * </p>
 *
 * @author baichaojie
 * @since 2024-08-21
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/saasParkElevatorRelativePark")
@Api(value = "梯控园区设置信息", tags = "梯控园区设置信息")
public class SaasParkElevatorRelativeParkController {

    private final ISaasParkElevatorRelativeParkService baseService;


    /**
     * 获取详情
     *
     * @param parkId
     * @return
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "梯控园区 详情", notes = "梯控园区详情")
    public R detail(Long parkId) {
        return R.data(baseService.getDetailById(parkId));
    }


    /**
     * 梯控园区设置信息 新增或修改
     */
    @PostMapping("/saveOrUpdate")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "梯控园区 新增或修改", notes = "梯控园区 新增或修改")
    public R saveOrUpdate(@Valid @RequestBody SaasParkElevatorRelativePark saasParkElevatorRelativePark) {
        if (Func.isEmpty(saasParkElevatorRelativePark)) {
            return R.error("梯控园区不能为空");
        }
        return R.data(baseService.saveOrUpdateByParam(saasParkElevatorRelativePark));
    }




}
