Browse Source

add 操作记录接口

Administrator 3 years ago
parent
commit
58745455c4

+ 26 - 2
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/controller/auto/OperationrecordController.java

@@ -1,9 +1,19 @@
 package com.gyee.benchmarkingimpala.controller.auto;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.gyee.benchmarkingimpala.common.StringUtils;
+import com.gyee.benchmarkingimpala.config.R;
+import com.gyee.benchmarkingimpala.model.auto.Benchmarkingbetween;
+import com.gyee.benchmarkingimpala.model.auto.Operationrecord;
+import com.gyee.benchmarkingimpala.service.auto.IOperationrecordService;
+import com.gyee.benchmarkingimpala.service.auto.impl.OperationrecordServiceImpl;
+import com.gyee.benchmarkingimpala.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -16,5 +26,19 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("//operationrecord")
 public class OperationrecordController {
+    @Autowired
+    private OperationrecordServiceImpl operationrecordService;
+    @GetMapping("/czlb")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R czlb(@RequestParam(value = "WindPowerStation",required = true)String WindPowerStation,
+                     @RequestParam( value ="wtid",required = false)String wtid,
+//                     @RequestParam(value = "type",required = false) String type,
+                     @RequestParam(value = "beginDate",required = false) String beginDate,
+                     @RequestParam(value = "endDate",required = true) String endDate){
+
+        List<Map> Map = operationrecordService.listBy(WindPowerStation,wtid,DateUtils.parseDate(beginDate),DateUtils.parseDate(endDate));
+        return R.ok(Map.size()).data(Map);
+    }
 
 }

+ 5 - 0
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/mapper/auto/OperationrecordMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Select;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -19,4 +20,8 @@ import java.util.List;
 public interface OperationrecordMapper extends BaseMapper<Operationrecord> {
     @Select("select * from operationrecord where time>=#{begin} and time <=#{end} ")
     public List<Operationrecord> listByBeginAndEnd(@Param(value = "begin") Date begin, @Param(value = "end")Date end);
+
+    @Select(" select s.name,o.wtid,o.id,w.windpowerstationid,o.time,o.value from operationrecord o left join windturbine w on w.id = o.wtid left join WindPowerStation s on s.id = w.windpowerstationid where w.windpowerstationid = #{WindPowerStation} and o.wtid = #{wtid} and o.time >=#{beginDate} and o.time <=#{endDate}")
+    public List<Map> listBy(@Param(value = "WindPowerStation") String WindPowerStation,@Param(value = "wtid")String wtid,
+                            @Param(value = "beginDate")Date beginDate,@Param(value = "endDate")Date endDate);
 }

+ 4 - 0
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/service/auto/IOperationrecordService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -16,4 +17,7 @@ import java.util.List;
  */
 public interface IOperationrecordService extends IService<Operationrecord> {
     public List<Operationrecord> listByBeginAndEnd(Date begin, Date end);
+
+    public List<Map> listBy (String WindPowerStation,String wtid,Date beginDate, Date endDate);
+
 }

+ 8 - 0
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/service/auto/impl/OperationrecordServiceImpl.java

@@ -1,14 +1,18 @@
 package com.gyee.benchmarkingimpala.service.auto.impl;
 
+import com.gyee.benchmarkingimpala.model.auto.Benchmarkingbetween;
 import com.gyee.benchmarkingimpala.model.auto.Operationrecord;
 import com.gyee.benchmarkingimpala.mapper.auto.OperationrecordMapper;
+import com.gyee.benchmarkingimpala.model.auto.Windpowerstation;
 import com.gyee.benchmarkingimpala.service.auto.IOperationrecordService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -27,4 +31,8 @@ public class OperationrecordServiceImpl extends ServiceImpl<OperationrecordMappe
         return operationrecordMapper.listByBeginAndEnd(begin,end);
     }
 
+    public List<Map> listBy (String WindPowerStation,String wtid,Date beginDate, Date endDate) {
+        return operationrecordMapper.listBy(WindPowerStation,wtid,beginDate,endDate);
+    }
+
 }