package com.persagy.proxy.calculation.controller;

import com.persagy.proxy.calculation.model.AdmMepSourceTypeEntity;
import com.persagy.proxy.adm.request.AdmCreateRequest;
import com.persagy.proxy.adm.request.AdmResponse;
import com.persagy.proxy.calculation.service.AdmMepSystemCalcService;
import com.persagy.proxy.adm.utils.AdmContextUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.QueryParam;

/***
 * Description: 机电管网系统关系计算
 * @author : lijie
 * @date :2021/9/14 23:15
 * Update By lijie 2021/9/14 23:15
 */
@RestController
@RequestMapping("/mep-system-calc/source/")
@RequiredArgsConstructor
public class AdmMepSystemCalcController {

    private final AdmMepSystemCalcService admMepSystemCalcService;

    /***
     * Description: 添加源端设备类型
     * @param request : 请求参数
     * @return : com.persagy.proxy.adm.request.AdmResponse
     * @author : lijie
     * @date :2021/9/14 23:20
     * Update By lijie 2021/9/14 23:20
     */
    @PostMapping("add")
    public AdmResponse add(@RequestBody AdmCreateRequest<AdmMepSourceTypeEntity> request) {
        return admMepSystemCalcService.add(AdmContextUtil.toDmpContext(), request);
    }
    /***
     * Description: 查询源端设备类型
     * @param calcName : 关系名称
     * @return : com.persagy.proxy.adm.request.AdmResponse
     * @author : lijie
     * @date :2021/9/14 23:20
     * Update By lijie 2021/9/14 23:20
     */
    @GetMapping("query")
    public AdmResponse query(@QueryParam("calcName") String calcName) {
        return admMepSystemCalcService.query(AdmContextUtil.toDmpContext(), calcName);
    }


}
