| | |
| | | //查询分级告警的个数 |
| | | int serchByLevel(@Param("alarmLevel") int alarmLevel, @Param("uId") int uId); |
| | | |
| | | List<Integer> getLevelSubList(int uId, String tableName); |
| | | List<BattalarmDataHistory> getLevelSubList(int uId, String tableName); |
| | | |
| | | List<BattalarmDataHistory> getDataBeforeRetentionMonth(@Param("retentionTime") Date retentionTime); |
| | | |
| | |
| | | import com.whyc.dto.InterfaceParam; |
| | | import com.whyc.dto.paramter.DevAlarmPar; |
| | | import com.whyc.dto.result.AlarmRes; |
| | | import com.whyc.pojo.BattalarmData; |
| | | import com.whyc.pojo.BattalarmDataHistory; |
| | | import com.whyc.pojo.DevalarmDataHistory; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<DevalarmDataHistory> getDataBeforeRetentionMonth(@Param("retentionTime") Date retentionTime); |
| | | |
| | | List<Integer> getLevelSubList(int uId, String tableName); |
| | | List<BattalarmDataHistory> getLevelSubList(int uId, String tableName); |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.BattalarmDataHistory; |
| | | import com.whyc.pojo.DevalarmDataHistory; |
| | | import com.whyc.pojo.PwrdevAlarmHistory; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | List<PwrdevAlarmHistory> getDataBeforeRetentionMonth(@Param("retentionTime") Date retentionTime); |
| | | |
| | | List<Integer> getLevelSubList(int uId, String tableName, List<Integer> almTypes); |
| | | List<BattalarmDataHistory> getLevelSubList(int uId, String tableName, List<Integer> almTypes); |
| | | |
| | | } |
| | |
| | | import com.whyc.dto.paramter.DevAlarmPar; |
| | | import com.whyc.dto.result.AlarmRes; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.DevalarmDataHistory; |
| | | import com.whyc.pojo.PwrdevAlarmHistory; |
| | | import com.whyc.pojo.UserLog; |
| | | import com.whyc.pojo.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | List<String> tableList = getTableList(dbName, tableLike, regex); |
| | | List<Integer> levelList = new LinkedList(); |
| | | for (String tableName : tableList) { |
| | | List<BattalarmDataHistory> levelInfoSubList; |
| | | List<Integer> levelSubList; |
| | | if(tableLike.equals("tb_battalarm_data_history")) { |
| | | levelSubList = battAlarmDataHistoryMapper.getLevelSubList(uId, tableName); |
| | | levelInfoSubList = battAlarmDataHistoryMapper.getLevelSubList(uId, tableName); |
| | | } |
| | | else if(tableLike.equals("tb_devalarm_data_history")){ |
| | | levelSubList = devAlarmDataHistoryMapper.getLevelSubList(uId, tableName); |
| | | levelInfoSubList = devAlarmDataHistoryMapper.getLevelSubList(uId, tableName); |
| | | } |
| | | else{ |
| | | levelSubList = powerAlarmHistoryMapper.getLevelSubList(uId, tableName,almTypes); |
| | | levelInfoSubList = powerAlarmHistoryMapper.getLevelSubList(uId, tableName,almTypes); |
| | | } |
| | | levelSubList = levelInfoSubList.stream().map(BattalarmDataHistory::getAlmLevel).collect(Collectors.toList()); |
| | | levelList.addAll(levelSubList); |
| | | } |
| | | //分为四级查询个数 |
| | |
| | | |
| | | <select id="getCount" resultType="java.lang.Integer"> |
| | | select |
| | | count(*) |
| | | <!--count(*)--> |
| | | count(distinct history.num) |
| | | from db_alarm.${recordYear} history,db_battinf.tb_battinf |
| | | <where> |
| | | history.battgroupid=db_battinf.tb_battinf.battgroupid |
| | |
| | | <select id="getDataBeforeRetentionMonth" resultType="com.whyc.pojo.BattalarmDataHistory"> |
| | | select *,DATE_FORMAT(alm_start_time,"%Y") as recordYear from db_alarm.tb_battalarm_data_history where alm_start_time < #{retentionTime}; |
| | | </select> |
| | | <select id="getLevelSubList" resultType="java.lang.Integer"> |
| | | select alm_level |
| | | <select id="getLevelSubList" resultType="com.whyc.pojo.BattalarmDataHistory"> |
| | | <!--select alm_level--> |
| | | SELECT distinct history.num,history.alm_level |
| | | from db_alarm.${tableName} history, |
| | | db_battinf.tb_battinf |
| | | where history.battgroupid = db_battinf.tb_battinf.battgroupid |
| | |
| | | </select> |
| | | |
| | | <select id="getCount" resultType="java.lang.Integer"> |
| | | SELECT count(*) |
| | | <!--SELECT count(*)--> |
| | | SELECT count(distinct history.num) |
| | | FROM db_alarm.${recordYear} history,db_battinf.tb_battinf |
| | | <where> |
| | | history.dev_id=db_battinf.tb_battinf.FbsDeviceId |
| | |
| | | <select id="getDataBeforeRetentionMonth" resultType="com.whyc.pojo.DevalarmDataHistory"> |
| | | select *,DATE_FORMAT(alm_start_time,"%Y") as recordYear from db_alarm.tb_devalarm_data_history where alm_start_time < #{retentionTime}; |
| | | </select> |
| | | <select id="getLevelSubList" resultType="java.lang.Integer"> |
| | | SELECT alm_level |
| | | <select id="getLevelSubList" resultType="com.whyc.pojo.BattalarmDataHistory"> |
| | | <!--SELECT alm_level--> |
| | | SELECT distinct history.num,history.alm_level |
| | | FROM db_alarm.${tableName} history, |
| | | db_battinf.tb_battinf |
| | | where history.dev_id = db_battinf.tb_battinf.FbsDeviceId |
| | |
| | | </select> |
| | | |
| | | <select id="getCount" resultType="java.lang.Integer"> |
| | | select count(*) from db_pwrdev_alarm.${recordYear} alarm,db_pwrdev_inf.tb_pwrdev_inf inf |
| | | select count(distinct alarm.num) from db_pwrdev_alarm.${recordYear} alarm,db_pwrdev_inf.tb_pwrdev_inf inf |
| | | <where> |
| | | alarm.PowerDeviceId = inf.PowerDeviceId |
| | | <if test="stationName1!=null "> |
| | |
| | | </select> |
| | | |
| | | <select id="getCountForTX" resultType="integer"> |
| | | select count(*) from db_pwrdev_alarm.${recordYear} alarm,db_pwrdev_inf.tb_pwrdev_inf |
| | | select count(distinct alarm.num) from db_pwrdev_alarm.${recordYear} alarm,db_pwrdev_inf.tb_pwrdev_inf |
| | | inf |
| | | <where> |
| | | alarm.PowerDeviceId = inf.PowerDeviceId |
| | |
| | | <select id="getDataBeforeRetentionMonth" resultType="com.whyc.pojo.PwrdevAlarmHistory"> |
| | | select *,DATE_FORMAT(alm_start_time,"%Y") as recordYear from db_pwrdev_alarm.tb_pwrdev_alarm_history where alm_start_time < #{retentionTime}; |
| | | </select> |
| | | <select id="getLevelSubList" resultType="java.lang.Integer"> |
| | | select alm_level from db_pwrdev_alarm.${tableName} alarm,db_pwrdev_inf.tb_pwrdev_inf |
| | | <select id="getLevelSubList" resultType="com.whyc.pojo.BattalarmDataHistory"> |
| | | <!--select alm_level --> |
| | | SELECT distinct history.num,history.alm_level |
| | | from db_pwrdev_alarm.${tableName} alarm,db_pwrdev_inf.tb_pwrdev_inf |
| | | inf |
| | | <where> |
| | | alarm.PowerDeviceId = inf.PowerDeviceId |