whycxzp
2025-03-24 b81c329ac5c9885f7c1b79b7aea9f8a0a5c8d18a
src/main/java/com/whyc/service/SubTableService.java
@@ -100,7 +100,7 @@
        if(battAlarmHistory.getAlmEndTime()!=null){
            sql+=" and alm_start_time  <='"+ThreadLocalUtil.format(battAlarmHistory.getAlmEndTime(),1)+"' ";
        }
        sql+="  ORDER BY alm_start_time asc  limit "+ battAlarmHistory.getLimitStart()+","+ battAlarmHistory.getLimitEnd()+" ";
        sql+="  ORDER BY alm_start_time desc  limit "+ battAlarmHistory.getLimitStart()+","+ battAlarmHistory.getLimitEnd()+" ";
        List<BattAlarmHistory> list=sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
@@ -126,7 +126,10 @@
    //电源告警历史实时计算每张表查询总数
    public int getPowerHisCount(PowerAlarmHistory powerAlarmHistory) {
        String sql="SELECT  count(*) as number FROM db_power_alarm."+ powerAlarmHistory.getRecordYear()+" history " +
                " where history.power_id="+ powerAlarmHistory.getPowerId() ;
                " where 1=1";
        if(powerAlarmHistory.getAlmLevel()!=null){
            sql+= " and history.alm_level="+ powerAlarmHistory.getAlmLevel();
        }
        if(powerAlarmHistory.getAlmStartTime()!=null){
            sql+=" and alm_start_time  >='"+ ThreadLocalUtil.format(powerAlarmHistory.getAlmStartTime(),1)+"' ";
        }
@@ -155,14 +158,17 @@
    //电源告警历史实时
    public List<PowerAlarmHistory> getPowerHisList(PowerAlarmHistory powerAlarmHistory) {
        String sql="SELECT * FROM db_power_alarm."+ powerAlarmHistory.getRecordYear()+" history " +
                " where history.power_id="+ powerAlarmHistory.getPowerId() ;
                " where 1=1";
        if(powerAlarmHistory.getAlmLevel()!=null){
            sql+= " and history.alm_level="+ powerAlarmHistory.getAlmLevel();
        }
        if(powerAlarmHistory.getAlmStartTime()!=null){
            sql+=" and alm_start_time  >='"+ ThreadLocalUtil.format(powerAlarmHistory.getAlmStartTime(),1)+"' ";
        }
        if(powerAlarmHistory.getAlmEndTime()!=null){
            sql+=" and alm_start_time  <='"+ThreadLocalUtil.format(powerAlarmHistory.getAlmEndTime(),1)+"' ";
        }
        sql+="  ORDER BY alm_start_time asc  limit "+ powerAlarmHistory.getLimitStart()+","+ powerAlarmHistory.getLimitEnd()+" ";
        sql+="  ORDER BY alm_start_time desc  limit "+ powerAlarmHistory.getLimitStart()+","+ powerAlarmHistory.getLimitEnd()+" ";
        List<PowerAlarmHistory> list=sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {