whycxzp
2025-03-24 82614438a300523cc13e22b6d175586a3ec8ed71
src/main/java/com/whyc/service/SubTableService.java
@@ -58,7 +58,10 @@
    //电池告警历史实时计算每张表查询总数
    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)+"' ";
        }
@@ -87,7 +90,10 @@
    //电池告警历史实时
    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)+"' ";
        }
@@ -102,7 +108,7 @@
                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"));