From 65ba5339b9aba17751b4136caad2d1518a54197b Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期五, 13 一月 2023 13:54:05 +0800
Subject: [PATCH] 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;

---
 BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 104 insertions(+), 16 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java b/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java
index 37eb8ff..d070028 100644
--- a/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java
+++ b/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java
@@ -19,27 +19,56 @@
 		createPwrdev_Alarm_History_Table(pool, recreate);
 		
 		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_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 + " (" + 
-				"  `num` bigint(20) NOT NULL AUTO_INCREMENT," +
-                "  `alarm_id` bigint(20) NOT NULL DEFAULT '0'," +
-                "  `alarm_limitH` float NOT NULL DEFAULT '0'," +
-                "  `alarm_limitL` float NOT NULL DEFAULT '0'," +
-                "  `alarm_limitEn` int(11) NOT NULL DEFAULT '0' COMMENT '是否可以设置上下限'," +
-                "  `UserAlarm_EN` int(11) NOT NULL DEFAULT '1' COMMENT '告警规则是否启动'," +
-                "  `alarm_level` int(11) NOT NULL DEFAULT '0'," +
-                "  `alarm_devtype` int(11) NOT NULL DEFAULT '0'," +
-                "  `alarm_name` varchar(100) NOT NULL DEFAULT '0'," +
-                "  PRIMARY KEY (`num`)," +
-                "  UNIQUE KEY `unique_alarm_id` (`alarm_id`)," +
-                "  KEY `index_alarm_id` (`alarm_id`)" +
-                ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
+	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) {			
@@ -53,6 +82,65 @@
 			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 + " (" + 
+				"  `num` bigint(20) NOT NULL AUTO_INCREMENT," +
+				"  `alarm_id` bigint(20) NOT NULL DEFAULT '0'," +
+				"  `alarm_limitH` float NOT NULL DEFAULT '0'," +
+				"  `alarm_limitL` float NOT NULL DEFAULT '0'," +
+				"  `alarm_limitEn` int(11) NOT NULL DEFAULT '0' COMMENT '是否可以设置上下限'," +
+				"  `UserAlarm_EN` int(11) NOT NULL DEFAULT '1' COMMENT '告警规则是否启动'," +
+				"  `alarm_level` int(11) NOT NULL DEFAULT '0'," +
+				"  `alarm_devtype` int(11) NOT NULL DEFAULT '0'," +
+				"  `alarm_name` varchar(100) NOT NULL DEFAULT '0'," +
+				"  PRIMARY KEY (`num`)," +
+				"  UNIQUE KEY `unique_alarm_id` (`alarm_id`)," +
+				"  KEY `index_alarm_id` (`alarm_id`)" +
+				") ENGINE=InnoDB AUTO_INCREMENT=1 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();
+		}
+	}
 
 	/**
 	 * 	创建 	db_pwrdev_alarm 数据库

--
Gitblit v1.9.1