| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.mapper.CallBack; |
| | | import com.whyc.pojo.db_alarm.BattAlarmHis; |
| | | import com.whyc.pojo.db_alarm.BattAlarmHistory; |
| | | import com.whyc.pojo.db_dis_batt.BattTestInfData; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | |
| | | return list; |
| | | } |
| | | //告警历史实时计算每张表查询总数 |
| | | public int getBattHisCount(BattAlarmHis battAlarmHis) { |
| | | String sql="SELECT count(*) as number FROM db_alarm."+battAlarmHis.getRecordYear()+" history " + |
| | | " where history.binf_id="+battAlarmHis.getBinfId() ; |
| | | if(battAlarmHis.getAlmStartTime()!=null){ |
| | | sql+=" and alm_start_time >='"+ ThreadLocalUtil.format(battAlarmHis.getAlmStartTime(),1)+"' "; |
| | | public int getBattHisCount(BattAlarmHistory battAlarmHistory) { |
| | | String sql="SELECT count(*) as number FROM db_alarm."+ battAlarmHistory.getRecordYear()+" history " + |
| | | " where history.binf_id="+ battAlarmHistory.getBinfId() ; |
| | | if(battAlarmHistory.getAlmStartTime()!=null){ |
| | | sql+=" and alm_start_time >='"+ ThreadLocalUtil.format(battAlarmHistory.getAlmStartTime(),1)+"' "; |
| | | } |
| | | if(battAlarmHis.getAlmEndTime()!=null){ |
| | | sql+=" and alm_start_time <='"+ThreadLocalUtil.format(battAlarmHis.getAlmEndTime(),1)+"' "; |
| | | if(battAlarmHistory.getAlmEndTime()!=null){ |
| | | sql+=" and alm_start_time <='"+ThreadLocalUtil.format(battAlarmHistory.getAlmEndTime(),1)+"' "; |
| | | } |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | |
| | | return num; |
| | | } |
| | | //告警历史实时 |
| | | public List<BattAlarmHis> getBattHisList(BattAlarmHis battAlarmHis) { |
| | | String sql="SELECT * FROM db_alarm."+battAlarmHis.getRecordYear()+" history " + |
| | | " where history.binf_id="+battAlarmHis.getBinfId() ; |
| | | if(battAlarmHis.getAlmStartTime()!=null){ |
| | | sql+=" and alm_start_time >='"+ ThreadLocalUtil.format(battAlarmHis.getAlmStartTime(),1)+"' "; |
| | | public List<BattAlarmHistory> getBattHisList(BattAlarmHistory battAlarmHistory) { |
| | | String sql="SELECT * FROM db_alarm."+ battAlarmHistory.getRecordYear()+" history " + |
| | | " where history.binf_id="+ battAlarmHistory.getBinfId() ; |
| | | if(battAlarmHistory.getAlmStartTime()!=null){ |
| | | sql+=" and alm_start_time >='"+ ThreadLocalUtil.format(battAlarmHistory.getAlmStartTime(),1)+"' "; |
| | | } |
| | | if(battAlarmHis.getAlmEndTime()!=null){ |
| | | sql+=" and alm_start_time <='"+ThreadLocalUtil.format(battAlarmHis.getAlmEndTime(),1)+"' "; |
| | | if(battAlarmHistory.getAlmEndTime()!=null){ |
| | | sql+=" and alm_start_time <='"+ThreadLocalUtil.format(battAlarmHistory.getAlmEndTime(),1)+"' "; |
| | | } |
| | | sql+=" ORDER BY alm_start_time asc limit "+battAlarmHis.getLimitStart()+","+battAlarmHis.getLimitEnd()+" "; |
| | | List<BattAlarmHis> list=sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | sql+=" ORDER BY alm_start_time asc limit "+ battAlarmHistory.getLimitStart()+","+ battAlarmHistory.getLimitEnd()+" "; |
| | | List<BattAlarmHistory> list=sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List list=new ArrayList(); |
| | | while (rs.next()){ |
| | | BattAlarmHis data=new BattAlarmHis(); |
| | | BattAlarmHistory data=new BattAlarmHistory(); |
| | | data.setNum(rs.getInt("num")); |
| | | data.setBinfId(rs.getInt("binf_id")); |
| | | data.setAlmStartTime(rs.getTimestamp("alm_start_time")); |