From 63f2a0fac2d9a27f17a99bf9cd0b1369eb1057c5 Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期四, 09 六月 2022 14:34:29 +0800
Subject: [PATCH] V1.27 edit at date 2022-06-08 	1.'db_pwrdev_data_rt.tb_pwrdev_acdcdata'表新增字段,修复fg2.0电源信息显示bug 		  `acIn2_currA` float NOT NULL DEFAULT '0',   		  `acIn2_currB` float NOT NULL DEFAULT '0',           `acIn2_currC` float NOT NULL DEFAULT '0',

---
 BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java |   73 +++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java b/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java
index a6e108a..08622dd 100644
--- a/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java
+++ b/BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java
@@ -2081,6 +2081,36 @@
 				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table 
 						+ " ADD COLUMN `is_Smoke_CommErr3` tinyint(1) NOT NULL DEFAULT '0' COMMENT '烟感3通信故障';");
 			}
+			
+			
+			//添加acIn2_currA字段
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_pwrdev_data_rt'"
+					+ " AND table_name='tb_pwrdev_acdcdata'"
+					+ " AND column_name='acIn2_currA'");
+			
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table 
+						+ " ADD COLUMN `acIn2_currA` float NOT NULL DEFAULT '0';");
+			}
+			//添加acIn2_currB字段
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_pwrdev_data_rt'"
+					+ " AND table_name='tb_pwrdev_acdcdata'"
+					+ " AND column_name='acIn2_currB'");
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table 
+						+ " ADD COLUMN `acIn2_currB` float NOT NULL DEFAULT '0';");
+			}
+			//添加acIn2_currC字段
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_pwrdev_data_rt'"
+					+ " AND table_name='tb_pwrdev_acdcdata'"
+					+ " AND column_name='acIn2_currC'");
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table 
+						+ " ADD COLUMN `acIn2_currC` float NOT NULL DEFAULT '0';");
+			}
 		} catch (SQLException e) {
 			e.printStackTrace();
 		} finally {
@@ -2110,7 +2140,7 @@
 				"  `is_dc1_under_vol` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_dc2_over_vol` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_dc2_under_vol` tinyint(1) NOT NULL DEFAULT '0'," + 
-				"  `is_dc_monitorerr` tinyint(1) NOT NULL," + 
+				"  `is_dc_monitorerr` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_tempalarm` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn1_trip` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn2_trip` tinyint(1) NOT NULL DEFAULT '0'," + 
@@ -2177,7 +2207,7 @@
 				"  `is_acIn1_under_volA` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn1_less_A` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn1_over_volB` tinyint(1) NOT NULL DEFAULT '0'," + 
-				"  `is_acIn1_under_volB` tinyint(1) NOT NULL," + 
+				"  `is_acIn1_under_volB` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn1_less_B` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn1_over_volC` tinyint(1) NOT NULL DEFAULT '0'," + 
 				"  `is_acIn1_under_volC` tinyint(1) NOT NULL DEFAULT '0'," + 
@@ -2221,15 +2251,52 @@
 				"  KEY `index_powerdev_id` (`PowerDeviceId`)" + 
 				") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
 		Sql_Mysql sql = new Sql_Mysql(pool.getConn());
+		ResultSet res = null;
 		try {
 			if(true == recreate) {			
 				sql.sqlMysqlExecute(sql_str01);
 			}
-			sql.sqlMysqlExecute(sql_str02);		
+			sql.sqlMysqlExecute(sql_str02);	
+			
+			
+			
+			//添加acIn2_currA字段
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_pwrdev_data_rt'"
+					+ " AND table_name='tb_pwrdev_acdata'"
+					+ " AND column_name='acIn2_currA'");
+			
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdata_Table 
+						+ " ADD COLUMN `acIn2_currA` float NOT NULL DEFAULT '0';");
+			}
+			//添加acIn2_currB字段
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_pwrdev_data_rt'"
+					+ " AND table_name='tb_pwrdev_acdata'"
+					+ " AND column_name='acIn2_currB'");
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdata_Table 
+						+ " ADD COLUMN `acIn2_currB` float NOT NULL DEFAULT '0';");
+			}
+			//添加acIn2_currC字段
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_pwrdev_data_rt'"
+					+ " AND table_name='tb_pwrdev_acdata'"
+					+ " AND column_name='acIn2_currC'");
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdata_Table 
+						+ " ADD COLUMN `acIn2_currC` float NOT NULL DEFAULT '0';");
+			}
 		} catch (SQLException e) {
 			e.printStackTrace();
 		} finally {
 			sql.close_con();
 		}
 	}
+	
+	public static void main(String[] args) {
+		MysqlConnPool pool = new MysqlConnPool("192.168.10.112", 3360, 50);
+		createPwrdev_Acdata_Table(pool, false);
+	}
 }

--
Gitblit v1.9.1