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

import cn.wise.sc.energy.power.plant.business.domain.vo.DeviceInfoVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service.IDeviceInfoService;
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:13
 **/
@CrossOrigin
@RestController
//@Api(tags = "设备信息")
@RequestMapping("deviceInfo/")
public class DeviceInfoController {

    final
    IDeviceInfoService iDeviceInfoService;

    public DeviceInfoController(IDeviceInfoService iDeviceInfoService) {
        this.iDeviceInfoService = iDeviceInfoService;
    }

    @GetMapping("{plantId}")
    public BaseResponse<List<EntityVo>> getDeviceInfoByPlantCode(
            @PathVariable("plantId") @NotEmpty(message = "plantCode不能为空!") String plantId) {
        return BaseResponse.okData(iDeviceInfoService.getDeviceInfoByPlantCode(plantId));
    }
    @GetMapping("deviceAndUnit/{plantId}")
    public BaseResponse<List<DeviceInfoVo>> getDeviceAndUnitByPlantCode(
            @PathVariable("plantId") @NotEmpty(message = "plantCode不能为空!") String plantId) {
        return BaseResponse.okData(iDeviceInfoService.getDeviceAndUnitByPlantCode(plantId));
    }

}

