package com.gyee.frame.controller.health;

import com.gyee.frame.common.conf.AjaxStatus;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.model.custom.HealthmodelrecordsVo;
import com.gyee.frame.service.health.WindTurbineHealthListService;
import com.gyee.frame.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/wtHealthList")
@Api(value = "风机健康列表" ,tags =  "风机健康列表")
public class WindTurbineHealthListController {

    @Resource
    private WindTurbineHealthListService windTurbineHealthListService;

    /**风机健康列表**/
    @PostMapping("/windTurbineHealthList")
    @ResponseBody
    @ApiOperation(value = "风机健康列表", notes = "风机健康列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")})

    public AjaxResult windTurbineHealthList(String wpId) throws Exception {

        List<HealthmodelrecordsVo> vos = new ArrayList<HealthmodelrecordsVo>();
        if (StringUtils.notEmp(wpId))
        {
            vos=windTurbineHealthListService.windTurbineHealthList(wpId);
        }

        if (null!=vos) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }



}
