Commit 32c6a2b8 authored by chenzhao's avatar chenzhao

修改接口sql

parent 8dad2129
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointTag; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointTag;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
...@@ -12,6 +13,8 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord; ...@@ -12,6 +13,8 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanHealthIndexServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanHealthIndexServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,6 +26,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -23,6 +26,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -43,6 +47,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -43,6 +47,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
IdxBizFanPointTagMapper idxBizFanPointTagMapper; IdxBizFanPointTagMapper idxBizFanPointTagMapper;
@Autowired @Autowired
IdxBizPvPointTagMapper idxBizPvPointTagMapper; IdxBizPvPointTagMapper idxBizPvPointTagMapper;
@Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper;
/** /**
* 新增 * 新增
* *
...@@ -325,5 +331,34 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -325,5 +331,34 @@ public class IdxBizFanHealthIndexController extends BaseController {
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电场站列表接口", notes = "TD 风电场站列表接口")
@GetMapping(value = "/stationHealthIndexTable")
public ResponseModel<List<FanHealthIndexDay>> stationHealthIndexTable(@RequestParam(value = "area",required = false) String area,
@RequestParam(value = "station",required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type,
@RequestParam(value = "subSystem",required = false) String subSystem){
if (type.equals("0")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
}
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
return ResponseHelper.buildResponse(fanHealthIndexDays);
}
} }
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" + "SELECT `health_index` AS healthIndex, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> { public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" + "SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMoment> { public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMoment> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" + "SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_day WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" + "FROM analysis_data.pv_health_index_day WHERE and analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " + "<if test='area!= null '> AND area = #{area} </if> " +
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_hour WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" + "FROM analysis_data.pv_health_index_hour WHERE and analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " + "<if test='area!= null '> AND area = #{area} </if> " +
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> { public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_moment WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" + "FROM analysis_data.pv_health_index_moment WHERE and analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " + "<if test='area!= null '> AND area = #{area} </if> " +
......
...@@ -29,4 +29,5 @@ public class FanHealthIndexDay implements Serializable { ...@@ -29,4 +29,5 @@ public class FanHealthIndexDay implements Serializable {
private String pointName; private String pointName;
private String analysisTime; private String analysisTime;
private String kks; private String kks;
private String status;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment