whyclxw
2025-02-08 139f7015c2373a5bba03a7d66045cf40faa1728c
src/main/java/com/whyc/service/SubTableService.java
@@ -78,7 +78,36 @@
        return list;
    }
    //锁的历史记录
    public List<LockHis> getLockHisWithReal(LockHis his) {
        String sql="SELECT * FROM db_lock_his."+ his.getRecordYear()+" history " +
                " where history.lock_id="+  his.getLockId() ;
        if(his.getStartTime()!=null){
            sql+=" and record_time  >='"+ ThreadLocalUtil.format(his.getStartTime(),1)+"' ";
        }
        if(his.getEndTime()!=null){
            sql+=" and record_time  <='"+ThreadLocalUtil.format(his.getEndTime(),1)+"' ";
        }
        sql+="  ORDER BY record_time asc ";
        List<LockHis> list=sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                List list=new ArrayList();
                while (rs.next()){
                    LockHis data=new LockHis();
                    data.setNum(rs.getInt("num"));
                    data.setLockId(rs.getInt("lock_id"));
                    data.setRecordTime(rs.getTimestamp("record_time"));
                    data.setLockState(rs.getInt("lock_state"));
                    data.setUnlockType(rs.getInt("unlock_type"));
                    data.setUnlockId(rs.getString("unlock_id"));
                    list.add(data);
                }
                return list;
            }
        });
        return list;
    }
    //锁的告警历史记录总数
    public int getLockAlmHisCount(LockAlarmHis his) {
        String sql="SELECT  count(*) as number FROM db_lock_alarm."+ his.getRecordYear()+" history " +