V1.50 edit at date 2023-01-13
1.'web_site.tb_alarm_voice_set'--告警语音设置表单独判断如下数据表字段是否存在并创建
`user_id` int(11) DEFAULT NULL,
`status` int(11) DEFAULT NULL COMMENT '1:有效\n0:无效\n',
`next_timestamp` bigint(20) DEFAULT NULL COMMENT '下次播放的时间戳',
2.新建表'db_pwrdev_alarm.tb_pwrdev_alarm_config'
CREATE TABLE `tb_pwrdev_alarm_config` (
`num` bigint(20) NOT NULL AUTO_INCREMENT,
`SMS_CommPort` varchar(10) NOT NULL DEFAULT ' ',
`SMS_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0',
`Beeper_CommPort` varchar(10) NOT NULL DEFAULT ' ',
`Beeper_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0',
`SMS_Alarm_Text` varchar(100) NOT NULL DEFAULT ' ',
`SMS_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0',
`Beeper_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0',
`Beeper_Sound_OFF` tinyint(1) NOT NULL DEFAULT '0',
`AlarmDevIP` varchar(30) NOT NULL DEFAULT '192.168.10.223',
`SMS_Alarm_ipPort` int(11) NOT NULL DEFAULT '26',
`Beeper_Alarm_ipPort` int(11) NOT NULL DEFAULT '27',
PRIMARY KEY (`num`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
3.新建表'db_pwrdev_alarm.tb_pwrdev_time_adj_alarm'
CREATE TABLE `tb_pwrdev_time_adj_alarm` (
`num` bigint(20) NOT NULL AUTO_INCREMENT,
`PowerDeviceId` bigint(20) NOT NULL DEFAULT '0',
`alarm_typeId` int(11) NOT NULL DEFAULT '0',
`detect_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
`record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
PRIMARY KEY (`num`),
KEY `index_powerdev_id` (`PowerDeviceId`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;
4.新建表'db_pwrdev_alarm.tb_pwrdev_time_out_alarm'
CREATE TABLE `tb_pwrdev_time_out_alarm` (
`num` bigint(20) NOT NULL AUTO_INCREMENT,
`PowerDeviceId` bigint(20) NOT NULL DEFAULT '0',
`alarm_typeId` int(11) NOT NULL DEFAULT '0',
`alarm_index` int(11) NOT NULL DEFAULT '0',
`timeout_tag` int(11) NOT NULL DEFAULT '0',
`read_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
`system_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
`resume_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
PRIMARY KEY (`num`),
KEY `index_powerdev_id` (`PowerDeviceId`)
) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8;
| | |
| | | 蓄电池监控平台建表程序 |
| | | |
| | | |
| | | V1.50 edit at date 2023-01-13 |
| | | 1.'web_site.tb_alarm_voice_set'--告警语音设置表单独判断如下数据表字段是否存在并创建 |
| | | `user_id` int(11) DEFAULT NULL, |
| | | `status` int(11) DEFAULT NULL COMMENT '1:有效\n0:无效\n', |
| | | `next_timestamp` bigint(20) DEFAULT NULL COMMENT '下次播放的时间戳', |
| | | 2.新建表'db_pwrdev_alarm.tb_pwrdev_alarm_config' |
| | | CREATE TABLE `tb_pwrdev_alarm_config` ( |
| | | `num` bigint(20) NOT NULL AUTO_INCREMENT, |
| | | `SMS_CommPort` varchar(10) NOT NULL DEFAULT ' ', |
| | | `SMS_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0', |
| | | `Beeper_CommPort` varchar(10) NOT NULL DEFAULT ' ', |
| | | `Beeper_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0', |
| | | `SMS_Alarm_Text` varchar(100) NOT NULL DEFAULT ' ', |
| | | `SMS_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0', |
| | | `Beeper_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0', |
| | | `Beeper_Sound_OFF` tinyint(1) NOT NULL DEFAULT '0', |
| | | `AlarmDevIP` varchar(30) NOT NULL DEFAULT '192.168.10.223', |
| | | `SMS_Alarm_ipPort` int(11) NOT NULL DEFAULT '26', |
| | | `Beeper_Alarm_ipPort` int(11) NOT NULL DEFAULT '27', |
| | | PRIMARY KEY (`num`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; |
| | | 3.新建表'db_pwrdev_alarm.tb_pwrdev_time_adj_alarm' |
| | | CREATE TABLE `tb_pwrdev_time_adj_alarm` ( |
| | | `num` bigint(20) NOT NULL AUTO_INCREMENT, |
| | | `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0', |
| | | `alarm_typeId` int(11) NOT NULL DEFAULT '0', |
| | | `detect_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | `record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | PRIMARY KEY (`num`), |
| | | KEY `index_powerdev_id` (`PowerDeviceId`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8; |
| | | 4.新建表'db_pwrdev_alarm.tb_pwrdev_time_out_alarm' |
| | | CREATE TABLE `tb_pwrdev_time_out_alarm` ( |
| | | `num` bigint(20) NOT NULL AUTO_INCREMENT, |
| | | `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0', |
| | | `alarm_typeId` int(11) NOT NULL DEFAULT '0', |
| | | `alarm_index` int(11) NOT NULL DEFAULT '0', |
| | | `timeout_tag` int(11) NOT NULL DEFAULT '0', |
| | | `read_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | `system_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | `resume_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | PRIMARY KEY (`num`), |
| | | KEY `index_powerdev_id` (`PowerDeviceId`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8; |
| | | |
| | | V1.49 edit at date 2023-01-13 |
| | | 1.'db_ram_db.tb_fbs9100_state' 新增字段 |
| | |
| | | |
| | | createPwrdev_Alarm_Param_Table(pool, recreate); |
| | | |
| | | createPwrdev_Alarm_Config_Table(pool, recreate); |
| | | |
| | | createPwrdev_Time_Adj_Alarm_Table(pool, recreate); |
| | | |
| | | createPwrdev_Time_Out_Alarm_Table(pool, recreate); |
| | | |
| | | |
| | | System.out.println(" db_pwrdev_alarm init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | |
| | | } |
| | | |
| | | private static void createPwrdev_Time_Out_Alarm_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Pwrdev_Time_Out_Alarm_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Pwrdev_Time_Out_Alarm_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0'," + |
| | | " `alarm_typeId` int(11) NOT NULL DEFAULT '0'," + |
| | | " `alarm_index` int(11) NOT NULL DEFAULT '0'," + |
| | | " `timeout_tag` int(11) NOT NULL DEFAULT '0'," + |
| | | " `read_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00'," + |
| | | " `system_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00'," + |
| | | " `resume_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_powerdev_id` (`PowerDeviceId`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=65 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(); |
| | | } |
| | | } |
| | | private static void createPwrdev_Time_Adj_Alarm_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Pwrdev_Time_Adj_Alarm_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Pwrdev_Time_Adj_Alarm_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0'," + |
| | | " `alarm_typeId` int(11) NOT NULL DEFAULT '0'," + |
| | | " `detect_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00'," + |
| | | " `record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_powerdev_id` (`PowerDeviceId`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=38 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(); |
| | | } |
| | | } |
| | | private static void createPwrdev_Alarm_Config_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Pwrdev_Alarm_Config_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Pwrdev_Alarm_Config_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `SMS_CommPort` varchar(10) NOT NULL DEFAULT ' '," + |
| | | " `SMS_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `Beeper_CommPort` varchar(10) NOT NULL DEFAULT ' '," + |
| | | " `Beeper_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `SMS_Alarm_Text` varchar(100) NOT NULL DEFAULT ' '," + |
| | | " `SMS_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `Beeper_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `Beeper_Sound_OFF` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `AlarmDevIP` varchar(30) NOT NULL DEFAULT '192.168.10.223'," + |
| | | " `SMS_Alarm_ipPort` int(11) NOT NULL DEFAULT '26'," + |
| | | " `Beeper_Alarm_ipPort` int(11) NOT NULL DEFAULT '27'," + |
| | | " PRIMARY KEY (`num`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=2 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(); |
| | | } |
| | | } |
| | | private static void createPwrdev_Alarm_Param_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Pwrdev_Alarm_Param_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Pwrdev_Alarm_Param_Table + " (" + |
| | |
| | | " PRIMARY KEY (`id`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COMMENT='告警语音设置';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | |
| | | ResultSet rs = null; |
| | | try { |
| | | if(true == recreate) { |
| | | //sql.sqlMysqlExecute(sql_str01); |
| | |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | /************************** 添加 user_id 字段 **************************************/ |
| | | String sql_str03 = " SELECT * FROM information_schema.columns " |
| | | + " WHERE table_schema= 'web_site' " |
| | | + " AND table_name='tb_alarm_voice_set' " |
| | | + " AND column_name='user_id'"; |
| | | rs = sql.sqlMysqlQuery(sql_str03); |
| | | if(false == rs.next()) { |
| | | sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.Tb_Alarm_Voice_Set_Table |
| | | + " ADD COLUMN `user_id` int(11) DEFAULT NULL;"); |
| | | } |
| | | /************************** 添加 status 字段 **************************************/ |
| | | rs = null; |
| | | sql_str03 = " SELECT * FROM information_schema.columns " |
| | | + " WHERE table_schema= 'web_site' " |
| | | + " AND table_name='tb_alarm_voice_set' " |
| | | + " AND column_name='status'"; |
| | | rs = sql.sqlMysqlQuery(sql_str03); |
| | | if(false == rs.next()) { |
| | | sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.Tb_Alarm_Voice_Set_Table |
| | | + " ADD COLUMN `status` int(11) DEFAULT NULL COMMENT '1:有效\\n0:无效\\n';"); |
| | | } |
| | | /************************** 添加 next_timestamp 字段 **************************************/ |
| | | rs = null; |
| | | sql_str03 = " SELECT * FROM information_schema.columns " |
| | | + " WHERE table_schema= 'web_site' " |
| | | + " AND table_name='tb_alarm_voice_set' " |
| | | + " AND column_name='next_timestamp'"; |
| | | rs = sql.sqlMysqlQuery(sql_str03); |
| | | if(false == rs.next()) { |
| | | sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.Tb_Alarm_Voice_Set_Table |
| | | + " ADD COLUMN `next_timestamp` bigint(20) DEFAULT NULL COMMENT '下次播放的时间戳';"); |
| | | } |
| | | |
| | | |
| | | |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | |
| | | public final static String Pwrdev_Alarm_Table = DB_PWRDEV_ALARM + ".`tb_pwrdev_alarm`"; |
| | | public final static String Pwrdev_Alarm_History_Table = DB_PWRDEV_ALARM + ".`tb_pwrdev_alarm_history`"; |
| | | public final static String Pwrdev_Alarm_Param_Table = DB_PWRDEV_ALARM + ".`tb_pwrdev_alarm_param`"; |
| | | public final static String Pwrdev_Alarm_Config_Table = DB_PWRDEV_ALARM + ".`tb_pwrdev_alarm_config`"; |
| | | public final static String Pwrdev_Time_Adj_Alarm_Table = DB_PWRDEV_ALARM + ".`tb_pwrdev_time_adj_alarm`"; |
| | | public final static String Pwrdev_Time_Out_Alarm_Table = DB_PWRDEV_ALARM + ".`tb_pwrdev_time_out_alarm`"; |
| | | |
| | | |
| | | |
| | |
| | | 蓄电池监控平台建表程序 |
| | | |
| | | |
| | | V1.50 edit at date 2023-01-13 |
| | | 1.'web_site.tb_alarm_voice_set'--告警语音设置表单独判断如下数据表字段是否存在并创建 |
| | | `user_id` int(11) DEFAULT NULL, |
| | | `status` int(11) DEFAULT NULL COMMENT '1:有效\n0:无效\n', |
| | | `next_timestamp` bigint(20) DEFAULT NULL COMMENT '下次播放的时间戳', |
| | | 2.新建表'db_pwrdev_alarm.tb_pwrdev_alarm_config' |
| | | CREATE TABLE `tb_pwrdev_alarm_config` ( |
| | | `num` bigint(20) NOT NULL AUTO_INCREMENT, |
| | | `SMS_CommPort` varchar(10) NOT NULL DEFAULT ' ', |
| | | `SMS_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0', |
| | | `Beeper_CommPort` varchar(10) NOT NULL DEFAULT ' ', |
| | | `Beeper_CommPort_ReInit` tinyint(1) NOT NULL DEFAULT '0', |
| | | `SMS_Alarm_Text` varchar(100) NOT NULL DEFAULT ' ', |
| | | `SMS_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0', |
| | | `Beeper_Alarm_EN` tinyint(1) NOT NULL DEFAULT '0', |
| | | `Beeper_Sound_OFF` tinyint(1) NOT NULL DEFAULT '0', |
| | | `AlarmDevIP` varchar(30) NOT NULL DEFAULT '192.168.10.223', |
| | | `SMS_Alarm_ipPort` int(11) NOT NULL DEFAULT '26', |
| | | `Beeper_Alarm_ipPort` int(11) NOT NULL DEFAULT '27', |
| | | PRIMARY KEY (`num`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; |
| | | 3.新建表'db_pwrdev_alarm.tb_pwrdev_time_adj_alarm' |
| | | CREATE TABLE `tb_pwrdev_time_adj_alarm` ( |
| | | `num` bigint(20) NOT NULL AUTO_INCREMENT, |
| | | `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0', |
| | | `alarm_typeId` int(11) NOT NULL DEFAULT '0', |
| | | `detect_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | `record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | PRIMARY KEY (`num`), |
| | | KEY `index_powerdev_id` (`PowerDeviceId`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8; |
| | | 4.新建表'db_pwrdev_alarm.tb_pwrdev_time_out_alarm' |
| | | CREATE TABLE `tb_pwrdev_time_out_alarm` ( |
| | | `num` bigint(20) NOT NULL AUTO_INCREMENT, |
| | | `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0', |
| | | `alarm_typeId` int(11) NOT NULL DEFAULT '0', |
| | | `alarm_index` int(11) NOT NULL DEFAULT '0', |
| | | `timeout_tag` int(11) NOT NULL DEFAULT '0', |
| | | `read_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | `system_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | `resume_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00', |
| | | PRIMARY KEY (`num`), |
| | | KEY `index_powerdev_id` (`PowerDeviceId`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8; |
| | | |
| | | V1.49 edit at date 2023-01-13 |
| | | 1.'db_ram_db.tb_fbs9100_state' 新增字段 |
| | |
| | | /**************************************************************************/ |
| | | /**************************************************************************/ |
| | | public final static boolean app_debug = false; |
| | | public final static float m_VersionNum = (float) 1.49; |
| | | public final static float m_VersionNum = (float) 1.50; |
| | | public final static String m_Version = "Welcome To Use BTS DB BUILDER V" + m_VersionNum + " RC_20180908"; |
| | | /**************************************************************************/ |
| | | /**************************************************************************/ |