| | |
| | | |
| | | //创建充放电一体机离线检测表 |
| | | createCheck_Dialog_Table(pool,recreate); |
| | | |
| | | //创建智能母联实时状态信息表 |
| | | createIntelligentBusbar_State_Table(pool, recreate); |
| | | |
| | | System.out.println(" Db_Ram_Db init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | } |
| | |
| | | " `test_start_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " PRIMARY KEY (`num`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建充放电一体机离线检测表 |
| | | * @param pool |
| | | * @param recreate |
| | | */ |
| | | private static void createIntelligentBusbar_State_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.IntelligentBusbar_State_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.IntelligentBusbar_State_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," + |
| | | " `dcdc1_temp` float NOT NULL DEFAULT '0' COMMENT 'DCDC1_实时温度'," + |
| | | " `dcdc2_temp` float NOT NULL DEFAULT '0' COMMENT 'DCDC2实时温度'," + |
| | | " `dcdc1_outputvol` float NOT NULL DEFAULT '0' COMMENT 'DCDC1实时输出电压'," + |
| | | " `dcdc2_outputvol` float NOT NULL DEFAULT '0' COMMENT 'DCDC2实时输出电压'," + |
| | | " `dcdc1_outputcurr` float NOT NULL DEFAULT '0' COMMENT 'DCDC1实时输出电流'," + |
| | | " `dcdc2_outputcurr` float NOT NULL DEFAULT '0' COMMENT 'DCDC2实时输出电流'," + |
| | | " `dcdc1_inputvol` float NOT NULL DEFAULT '0' COMMENT 'DCDC1实时输入电压'," + |
| | | " `dcdc2_inputvol` float NOT NULL DEFAULT '0' COMMENT 'DCDC2实时输入电压'," + |
| | | " `dcdc1_inputcurr` float NOT NULL DEFAULT '0' COMMENT 'DCDC1实时输入电流'," + |
| | | " `dcdc2_inputcurr` float unsigned NOT NULL DEFAULT '0' COMMENT 'DCDC1实时输入电流'," + |
| | | " `dcdc1_errcode` int(11) NOT NULL DEFAULT '0' COMMENT 'DCDC1 异常代码-状态'," + |
| | | " `dcdc2_errcode` int(11) NOT NULL DEFAULT '0' COMMENT 'DCDC2 异常代码-状态'," + |
| | | " PRIMARY KEY (`num`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能母联实时状态表';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | try { |
| | | if(true == recreate) { |
| | |
| | | + " ADD COLUMN `CellDiffVolHigh` float NOT NULL DEFAULT '0' COMMENT '压差上限(mV)';"); |
| | | } |
| | | /****************************************************************/ |
| | | res = null; |
| | | //添加 dcdc1_outputvol [DCDC1输出电压] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_fbs9100_setparam'" |
| | | + " AND column_name='dcdc1_outputvol'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table |
| | | + " ADD COLUMN `dcdc1_outputvol` float NOT NULL DEFAULT '0' COMMENT 'DCDC1输出电压';"); |
| | | } |
| | | /****************************************************************/ |
| | | res = null; |
| | | //添加 dcdc2_outputvol [DCDC2输出电压] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_fbs9100_setparam'" |
| | | + " AND column_name='dcdc2_outputvol'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table |
| | | + " ADD COLUMN `dcdc2_outputvol` float NOT NULL DEFAULT '0' COMMENT 'DCDC2输出电压';"); |
| | | } |
| | | /****************************************************************/ |
| | | res = null; |
| | | //添加 dcdc1_outputcurr [DCDC1输出限流值] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_fbs9100_setparam'" |
| | | + " AND column_name='dcdc1_outputcurr'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table |
| | | + " ADD COLUMN `dcdc1_outputcurr` float NOT NULL DEFAULT '0' COMMENT 'DCDC1输出限流值';"); |
| | | } |
| | | /****************************************************************/ |
| | | res = null; |
| | | //添加 dcdc2_outputcurr [DCDC2输出限流值] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_fbs9100_setparam'" |
| | | + " AND column_name='dcdc2_outputcurr'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table |
| | | + " ADD COLUMN `dcdc2_outputcurr` float NOT NULL DEFAULT '0' COMMENT 'DCDC2输出限流值';"); |
| | | } |
| | | /****************************************************************/ |
| | | res = null; |
| | | //添加 screensaver_time [进入屏幕保护时间] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_fbs9100_setparam'" |
| | | + " AND column_name='screensaver_time'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table |
| | | + " ADD COLUMN `screensaver_time` int(11) NOT NULL DEFAULT '10' COMMENT '进入屏幕保护时间(不能小于10分钟)';"); |
| | | } |
| | | /****************************************************************/ |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |