package com.persagy.server.controllers.rel

import com.persagy.server.datacenter.models.entities.rel.RSpinBd
import com.persagy.server.services.rel.RSpInBdService
import com.persagy.service.models.requests.SCreateRequest
import com.persagy.service.models.requests.SUpdateRequest
import com.persagy.service.models.responses.SBaseResponse
import com.persagy.service.models.responses.SCreateResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
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 张维新
 */
@Api(tags = ["025、关系-业务空间所在的建筑楼层"])
@RestController
@RequestMapping("/rel/sp-in")
class RSpInBdOrFlController {

    /**
     * 创建业务空间和建筑的关系
     */
    @ApiOperation(value = "创建业务空间和建筑的关系", notes = "")
    @PostMapping(value = ["/bd-create"])
    fun spInBdCreate(@RequestBody rSiInSpBase: SCreateRequest<RSpinBd>): SCreateResponse<RSpinBd> {
        return RSpInBdService.spInBdCreates(rSiInSpBase)
    } // Function spInBdCreate()

    /**
     * 删除业务空间和建筑的关系
     */
    @ApiOperation(value = "删除业务空间和建筑的关系", notes = "")
    @PostMapping(value = ["/bd-del"])
    fun spInBdDeL(@RequestBody rSpinBdList: ArrayList<RSpinBd>): SBaseResponse {
        return RSpInBdService.spInBdDeLs(rSpinBdList)
    } // Function spInBdCreate()

    /**
     * 修改业务空间所在的建筑
     */
    @ApiOperation(value = "删除业务空间和建筑的关系", notes = "")
    @PostMapping(value = ["/bd-update"])
    fun spInBdUpdate(@RequestBody request: SUpdateRequest<RSpinBd>): SBaseResponse{
        return RSpInBdService.spInBdUpdates(request)
    } // Function spInBdUpdate()

} // Class RSpInBdOrFlController