Commit 8a43c390 authored by chenzhao's avatar chenzhao

修改代码

parent c8b4e391
......@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
*
......@@ -116,14 +117,28 @@ public class IdxBizPvHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级左侧列表", notes = "预警监测设备级左侧列表")
@GetMapping(value = "/queryForLeftTableListByEquip")
public ResponseModel<List<IdxBizPvHealthIndexDto>> queryForLeftTableListByEquip(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String HEALTHLEVEL) {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquip(STATION,SUBARRAY,HEALTHLEVEL));
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableListByEquip(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) Integer current, @RequestParam(required = false) Integer size ) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>();
page.setCurrent(current);
page.setSize(size);
int total = idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquipCount(STATION, SUBARRAY, HEALTHLEVEL);
Long num = Long.valueOf(total);
page.setTotal(num);
page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquip(STATION,SUBARRAY,HEALTHLEVEL,(current-1)*size,size));
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点级左侧列表", notes = "预警监测设备级左侧列表")
@GetMapping(value = "/queryForLeftTableListByPoint")
public ResponseModel<List<IdxBizPvHealthIndexDto>> queryForLeftTableListByPoint(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false) String POINTNAME) {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION,SUBARRAY,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME));
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableListByPoint(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false) String POINTNAME,@RequestParam(required = false) Integer current,@RequestParam(required = false) Integer size) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>();
page.setCurrent(current);
page.setSize(size);
int total = idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPointCount(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME);
Long num = Long.valueOf(total);
page.setTotal(num);
page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION,SUBARRAY,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME,(current-1)*size,size));
return ResponseHelper.buildResponse(page);
}
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
......@@ -14,7 +15,10 @@ import java.util.List;
*/
public interface IdxBizPvHealthIndexMapper extends BaseMapper<IdxBizPvHealthIndex> {
List<IdxBizPvHealthIndexDto> queryForLeftTableListByEquip(String STATION, String SUBARRAY, String HEALTHLEVEL);
List<Map<String,Object>> queryForLeftTableListByEquip(String STATION, String SUBARRAY, String HEALTHLEVEL, Integer current, Integer size);
int queryForLeftTableListByEquipCount(String STATION, String SUBARRAY, String HEALTHLEVEL);
List<IdxBizPvHealthIndexDto> queryForLeftTableListByPoint(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME);
List<Map<String,Object>> queryForLeftTableListByPoint(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME,Integer current,Integer size);
int queryForLeftTableListByPointCount(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME);
}
......@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
import java.util.Map;
/**
* 服务实现类
......@@ -33,13 +34,20 @@ public class IdxBizPvHealthIndexServiceImpl extends BaseService<IdxBizPvHealthIn
}
public List<IdxBizPvHealthIndexDto> queryForLeftTableListByEquip(String STATION, String SUBARRAY, String HEALTHLEVEL) {
return this.getBaseMapper().queryForLeftTableListByEquip(STATION, SUBARRAY, HEALTHLEVEL);
public List<Map<String,Object>> queryForLeftTableListByEquip(String STATION, String SUBARRAY, String HEALTHLEVEL, Integer current, Integer size) {
return this.getBaseMapper().queryForLeftTableListByEquip(STATION, SUBARRAY, HEALTHLEVEL,current,size);
}
public List<IdxBizPvHealthIndexDto> queryForLeftTableListByPoint(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME) {
return this.getBaseMapper().queryForLeftTableListByPoint(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME);
public List<Map<String,Object>> queryForLeftTableListByPoint(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME,Integer current,Integer size) {
return this.getBaseMapper().queryForLeftTableListByPoint(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME,current,size);
}
public int queryForLeftTableListByPointCount(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME) {
return this.getBaseMapper().queryForLeftTableListByPointCount(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME);
}
public int queryForLeftTableListByEquipCount(String STATION, String SUBARRAY, String HEALTHLEVEL) {
return this.getBaseMapper().queryForLeftTableListByEquipCount(STATION, SUBARRAY, HEALTHLEVEL);
}
}
\ No newline at end of file
......@@ -3,13 +3,14 @@
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthIndexMapper">
<select id="queryForLeftTableListByEquip"
resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvHealthIndexDto">
resultType="map">
SELECT
b.SEQUENCE_NBR,
b.ARAE,
b.STATION,
b.EQUIPMENT_NAME,
b.HEALTH_INDEX,
b.HEALTH_INDEX as value,
b.HEALTH_LEVEL,
CONCAT( '子阵 ', b.SUBARRAY ) AS 子阵,
( CASE b.HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '告警' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS STATUS,
......@@ -31,11 +32,35 @@
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
limit ${current},${size}
</select>
<select id="queryForLeftTableListByEquipCount"
resultType="int">
SELECT
count(1) as value
FROM
`idx_biz_pv_health_index` b
WHERE
DATE_FORMAT(b.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d") AND b.ANALYSIS_OBJ_TYPE = '设备' AND
b.ANALYSIS_TYPE = '按天'
<if test="SUBARRAY != '' and SUBARRAY != null">
AND b.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != '' and STATION != null">
AND b.STATION = #{STATION}
</if>
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
</select>
<select id="queryForLeftTableListByPoint"
resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvHealthIndexDto">
resultType="map">
SELECT
b.*
FROM
......@@ -80,6 +105,55 @@
AND b.POINT_NAME = #{POINTNAME}
</if>
</where>
limit ${current},${size}
</select>
<select id="queryForLeftTableListByPointCount"
resultType="int">
SELECT
COUNT(b.*) as value
FROM
(
SELECT
POINT_NAME ,
STATION,
HEALTH_INDEX,
HEALTH_INDEX as value,
HEALTH_LEVEL,
SUBARRAY,
REC_DATE,
EQUIPMENT_NAME,
INDEX_ADDRESS,
ANALYSIS_OBJ_SEQ,
ANALYSIS_TYPE
FROM
`idx_biz_pv_health_index`
WHERE
ANALYSIS_OBJ_TYPE = '测点'
AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 1 HOUR ) )
OR ( REC_DATE >= CURRENT_DATE ( ) AND ANALYSIS_TYPE = '按天' )
OR ( ANALYSIS_TYPE = '按时刻' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 10 MINUTE ) )
) b
INNER JOIN idx_biz_pv_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ
AND rule.WARNING_NAME = '注意'
AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE
<where>
<if test="STATION != null and STATION != '' ">
b.STATION = #{STATION}
</if>
<if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' ">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND b.SUBARRAY = #{SUBARRAY}
</if>
<if test="HEALTHLEVEL != null and HEALTHLEVEL != '' ">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if test="POINTNAME != null and POINTNAME != '' ">
AND b.POINT_NAME = #{POINTNAME}
</if>
</where>
</select>
</mapper>
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