package com.persagy.server.controllers


import com.persagy.server.models.objects.Building
import com.persagy.server.service.objects.BuildingService
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.responses.SQueryResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.slf4j.LoggerFactory
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 = ["建筑接口"])
@RestController
@RequestMapping("/building")
class BuildingController {

    companion object {
        // 日志
        private val logger = LoggerFactory.getLogger(BuildingController::class.java)
    } // Companion object

    /**
     * 查询建筑信息
     *
     * @param   request     查询信息条件
     * @return              查询结果
     */
    @ApiOperation(value = "查询建筑信息,以及楼层使用同一个模型文件数量", notes = "级联查询的对象：楼层（floor）、项目（project）")
    @PostMapping(value = ["/query"])
    fun query(@RequestBody request: SQueryRequest): SQueryResponse<Building> {
        return BuildingService.queryBuilding(request)
    } // Function query()

} // Class BuildingController