瀏覽代碼

风机状态查询导出

maxiaoxia 4 年之前
父節點
當前提交
c76005c4d1

+ 45 - 0
src/main/java/com/gyee/frame/controller/FanStatusQueryExportController/FanStatusQueryExportController.java

@@ -0,0 +1,45 @@
+package com.gyee.frame.controller.FanStatusQueryExportController;
+
+import com.gyee.frame.service.FanStatusQueryExportService.FanStatusQueryExportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/FanStatusQueryExport")
+public class FanStatusQueryExportController {
+
+    @Autowired
+    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);
+    }
+
+
+}

+ 20 - 0
src/main/java/com/gyee/frame/mapper/FanStatusQueryExportMapper/FanStatusQueryExportMapper.java

@@ -0,0 +1,20 @@
+package com.gyee.frame.mapper.FanStatusQueryExportMapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Repository
+public interface FanStatusQueryExportMapper {
+    //获取风机Name
+    @Select("select id,name from windturbine where windpowerstationid ='${windpowerstationid}'")
+    List<Map<String, Object>> getFanName(@Param("windpowerstationid") String windpowerstationid);
+
+    @Select("select windturbineid,statusdesc,starttime,speed,stoptime from windturbinestatus where windturbineid='${windturbineid}' and satuscode='${satuscode}' and stoptime >= TO_DATE ('${starttime} ',' yyyy-MM-dd ') and stoptime <= TO_DATE ('${stoptime} ',' yyyy-MM-dd ')")
+    List<Map<String, Object>> getFjStatus(@Param("windturbineid") String windturbineid, @Param("satuscode") String satuscode,@Param("starttime")String starttime,@Param("stoptime") String stoptime);
+
+}

+ 34 - 0
src/main/java/com/gyee/frame/service/FanStatusQueryExportService/FanStatusQueryExportService.java

@@ -0,0 +1,34 @@
+package com.gyee.frame.service.FanStatusQueryExportService;
+
+import com.gyee.frame.mapper.FanStatusQueryExportMapper.FanStatusQueryExportMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class FanStatusQueryExportService {
+
+    @Resource
+    private FanStatusQueryExportMapper fanStatusQueryExportMapper;
+
+    //风机机组名
+    public List<Map<String, Object>> getFanName(String windpowerstationid){
+
+        return fanStatusQueryExportMapper.getFanName(windpowerstationid);}
+
+
+    //风机状态信息
+    public List<Map<String, Object>> getFjStatus(@Param("windturbineid") String windturbineid, @Param("satuscode") String satuscode,@Param("starttime")String starttime,@Param("stoptime") String stoptime){
+        List<Map<String, Object>> list = fanStatusQueryExportMapper.getFjStatus(windturbineid,satuscode,starttime,stoptime);
+        System.out.print(list);
+        return list;
+
+    }
+
+}
+

+ 25 - 0
src/main/resources/mybatis/FanStatusQueryExportMapper/FanStatusQueryExportMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.gyee.frame.mapper.FanStatusQueryExportMapper.FanStatusQueryExportMapper">
+    <!--风场风机名称-->
+    <!--<select id="getFanName" resultType="ArrayList">-->
+       <!--select name from windturbine where windpowerstationid ='${windpowerstationid}'-->
+    <!--</select>-->
+    <!--风机windturbineid-->
+    <!--<select id="getWindturbineid" resultType="String">-->
+        <!--select id from windturbine where name = '${name}'-->
+    <!--</select>-->
+    <!--风机信息-->
+    <!--<select id="getFjStatus" resultType="hasmap">-->
+        <!--select satuscode,starttime,speed,stoptime-->
+        <!--from windturbinestatus-->
+        <!--where-->
+           <!--windturbineid='${windturbineid}'-->
+        <!--or satuscode='${satuscode}'-->
+        <!--or starttime='${starttime}'-->
+        <!--or stoptime='${stoptime}'-->
+    <!--</select>-->
+
+
+</mapper>