package com.persagy.server.controllers.relation_calc

import com.persagy.server.datacenter.models.entities.graphtype.block.RelationAddRequest
import com.persagy.server.datacenter.models.requests.ManualRelationCalcDel
import com.persagy.server.datacenter.models.requests.ManualRelationCalcRequest
import com.persagy.server.datacenter.models.response.ManualRelationCalcResponse
import com.persagy.server.datacenter.models.response.ManualRelationCalcSCreateResponse
import com.persagy.server.services.relation_calc.ManualRelationCalcService
import com.persagy.service.models.responses.SBaseResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
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 = ["013、关系计算-手动计算"])
@RestController
@RequestMapping("/relation-manual-calc")
class ManualRelationCalcController {

    /**
     * 服务
     */
    @Autowired
    lateinit var service: ManualRelationCalcService

    /**
     * 查询关系数据
     */
    @ApiOperation(value = "查询关系数据", notes = "")
    @PostMapping(value = ["/rel-query"])
    fun query(@RequestBody manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
        return service.query(manualRelationCalcRequest)
    } // Fun

    /**
     * 添加关系
     */
    @ApiOperation(value = "添加关系", notes = "")
    @PostMapping(value = ["/rel-add"])
    fun addRels(@RequestBody relationAddRequest: RelationAddRequest): ManualRelationCalcSCreateResponse {
        return service.addRel(relationAddRequest)
    } // Fun

    /**
     * 删除关系
     */
    @ApiOperation(value = "删除关系", notes = "")
    @PostMapping(value = ["/rel-del"])
    fun delRels(@RequestBody manualRelationCalcDel: ManualRelationCalcDel): SBaseResponse {
        return service.delRel(manualRelationCalcDel)
    } // Fun

} // Class ManualRelationCalcController














