| | |
| | | //电池告警历史实时计算每张表查询总数 |
| | | public int getBattHisCount(BattAlarmHistory battAlarmHistory) { |
| | | String sql="SELECT count(*) as number FROM db_alarm."+ battAlarmHistory.getRecordYear()+" history " + |
| | | " where history.binf_id="+ battAlarmHistory.getBinfId() ; |
| | | " where 1=1" ; |
| | | if (battAlarmHistory.getAlmLevel()!=null){ |
| | | sql+=" and history.alm_level="+ battAlarmHistory.getAlmLevel(); |
| | | } |
| | | if(battAlarmHistory.getAlmStartTime()!=null){ |
| | | sql+=" and alm_start_time >='"+ ThreadLocalUtil.format(battAlarmHistory.getAlmStartTime(),1)+"' "; |
| | | } |
| | |
| | | //电池告警历史实时 |
| | | public List<BattAlarmHistory> getBattHisList(BattAlarmHistory battAlarmHistory) { |
| | | String sql="SELECT * FROM db_alarm."+ battAlarmHistory.getRecordYear()+" history " + |
| | | " where history.binf_id="+ battAlarmHistory.getBinfId() ; |
| | | " where 1=1"; |
| | | if(battAlarmHistory.getAlmLevel()!=null){ |
| | | sql+=" and history.alm_level="+ battAlarmHistory.getAlmLevel(); |
| | | } |
| | | if(battAlarmHistory.getAlmStartTime()!=null){ |
| | | sql+=" and alm_start_time >='"+ ThreadLocalUtil.format(battAlarmHistory.getAlmStartTime(),1)+"' "; |
| | | } |
| | |
| | | while (rs.next()){ |
| | | BattAlarmHistory data=new BattAlarmHistory(); |
| | | data.setNum(rs.getInt("num")); |
| | | data.setBinfId(rs.getInt("binf_id")); |
| | | data.setBattGroupId(rs.getInt("binf_id")); |
| | | data.setAlmStartTime(rs.getTimestamp("alm_start_time")); |
| | | data.setAlmEndTime(rs.getTimestamp("alm_end_time")); |
| | | data.setMonNum(rs.getInt("mon_num")); |