package com.gyee.frame.controller.FanStatusQueryExportController;

import com.gyee.frame.service.FanStatusQueryExportService.FanStatusQueryExportService;
import org.springframework.web.bind.annotation.*;

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

@RestController
@RequestMapping("/FanStatusQueryExport")
public class FanStatusQueryExportController {

    @Resource
    FanStatusQueryExportService fanStatusQueryExportService;

    //获取所有风机
    @CrossOrigin(origins  = "*",maxAge = 3600)
    @PostMapping("/FanName")
    @ResponseBody
    public List<Map<String, Object>> getFanName(@RequestBody  String windpowerstationid){

        return fanStatusQueryExportService.getFanName(windpowerstationid.substring(0,windpowerstationid.length()-1));
    }


    //根据风机id和风机状态
    @CrossOrigin(origins  = "*",maxAge = 3600)
    @PostMapping("/FjStatus")

    @ResponseBody
    public List<Map<String, Object>> getFjStatus( @RequestBody Map<String, Object> map){

        String name = (String) map.get("name");
        String satuscode = (String) map.get("satuscode");
        String starttime = (String) map.get("starttime");
        String stoptime = (String) map.get("stoptime");

        return fanStatusQueryExportService.getFjStatus(name,satuscode,starttime,stoptime);
    }


}
