package cn.wise.sc.energy.power.plant.business.controller;

import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service.IUnitInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @description: 部件信息controller
 * @author: qh
 * @create: 2020-07-20 18:14
 **/
@CrossOrigin
@RestController
//@Api(tags = "部件选项")
@RequestMapping("unitInfo/")
public class UnitInfoController {

    final
    IUnitInfoService iUnitInfoService;

    public UnitInfoController(IUnitInfoService iUnitInfoService) {
        this.iUnitInfoService = iUnitInfoService;
    }

    /**
     * 获取设备的测点信息
     *
     * @param deviceId 设备ID
     * @return List<EntityVo>
     */
    @GetMapping("{deviceId}")
    public BaseResponse<List<EntityVo>> getUnitInfoByDeviceId(
           @PathVariable("deviceId") @NotEmpty(message = "deviceId不能为空!") String deviceId) {
        List<EntityVo> entityVos = iUnitInfoService.getUnitInfoByDeviceId(deviceId);
        return BaseResponse.okData(entityVos);
    }
}
