From decb4fa9de09d81de7d98a390d4902d7c19ef71d Mon Sep 17 00:00:00 2001
From: whycrzg <ruanzhigang@whycst.com>
Date: 星期五, 07 一月 2022 16:48:38 +0800
Subject: [PATCH] V2.05 edit at date 2022-1-7     1:新增 `db_ram_db`.`tb_ess3100_sysstate`和`tb_ess3100_sysstate`;修改 tb_ld9_updatestatue表添加字段 并初始化数据;

---
 BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java |  270 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 253 insertions(+), 17 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java b/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java
index 21fa8e1..ce76b97 100644
--- a/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java
+++ b/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java
@@ -100,8 +100,219 @@
 		
 
 		createTb_li9130_setparam_plan(pool, recreate);
+		
+		/**
+		 * db_ram_db.tb_ess3100_sysstate
+		 */
+		createTb_ess3100_sysstate(pool, recreate);
+		
+		/**
+		 * db_ram_db.tb_ess3100_pcs_state
+		 */
+		createTb_ess3100_pcs_state(pool, recreate);
 	}
 	
+	private static void createTb_ess3100_pcs_state(MysqlConnPool pool, boolean recreate) {
+		String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_ess3100_pcs_state;
+		String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_ess3100_pcs_state + " (" + 
+				"`num` bigint(20) NOT NULL AUTO_INCREMENT," +
+                "  `dev_id` int(11) NOT NULL," +
+                "  `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," +
+                "  `acUa` float NOT NULL DEFAULT '0' COMMENT '交流A相电压'," +
+                "  `acUb` float NOT NULL DEFAULT '0' COMMENT '交流B相电压'," +
+                "  `acUc` float NOT NULL DEFAULT '0' COMMENT '交流C相电压'," +
+                "  `acIa` float NOT NULL DEFAULT '0' COMMENT '交流A相电流'," +
+                "  `acIb` float NOT NULL DEFAULT '0' COMMENT '交流B相电流'," +
+                "  `acIc` float NOT NULL DEFAULT '0' COMMENT '交流C相电流'," +
+                "  `acActPower` float NOT NULL DEFAULT '0' COMMENT '交流有功功率'," +
+                "  `acReaPower` float NOT NULL DEFAULT '0' COMMENT '交流无功功率'," +
+                "  `acAppPower` float NOT NULL DEFAULT '0' COMMENT '交流视在功率'," +
+                "  `acFreq` float NOT NULL DEFAULT '0' COMMENT '交流频率'," +
+                "  `powerFact` float NOT NULL DEFAULT '0' COMMENT '功率因数'," +
+                "  `macInsTmp` float NOT NULL DEFAULT '0' COMMENT '机内温度'," +
+                "  `maxFlowCharPower` float NOT NULL DEFAULT '0' COMMENT '系统最大允许充电功率'," +
+                "  `maxFlowDiscPower` float NOT NULL DEFAULT '0' COMMENT '系统最大允许放电功率'," +
+                "  `dcVol1` float NOT NULL DEFAULT '0' COMMENT '直流电压1'," +
+                "  `dcCurr1` float NOT NULL DEFAULT '0' COMMENT '直流电流1'," +
+                "  `dcPower1` float NOT NULL DEFAULT '0' COMMENT '直流功率1'," +
+                "  `dcVol2` float NOT NULL DEFAULT '0' COMMENT '直流电压2'," +
+                "  `dcCurr2` float NOT NULL DEFAULT '0' COMMENT '直流电流2'," +
+                "  `dcPower2` float NOT NULL DEFAULT '0' COMMENT '直流功率2'," +
+                "  `dcVol3` float NOT NULL DEFAULT '0' COMMENT '直流电压3'," +
+                "  `dcCurr3` float NOT NULL DEFAULT '0' COMMENT '直流电流3'," +
+                "  `dcPower3` float NOT NULL DEFAULT '0' COMMENT '直流功率3'," +
+                "  `dcVol4` float NOT NULL DEFAULT '0' COMMENT '直流电压4'," +
+                "  `dcCurr4` float NOT NULL DEFAULT '0' COMMENT '直流电流4'," +
+                "  `dcPower4` float NOT NULL DEFAULT '0' COMMENT '直流功率4'," +
+                "  `dcAC1DevRun` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC1设备运行状态字'," +
+                "  `dcAC1CompFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC1系统综合故障字'," +
+                "  `dcAC1EnvirFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC1系统环境故障字'," +
+                "  `dcAC1HardFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC1系统硬件故障字'," +
+                "  `dcAC1TmpFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC1系统温度故障字'," +
+                "  `dcAC2DevRun` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC2设备运行状态字'," +
+                "  `dcAC2CompFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC2系统综合故障字'," +
+                "  `dcAC2EnvirFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC2系统环境故障字'," +
+                "  `dcAC2HardFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC2系统硬件故障字'," +
+                "  `dcAC2TmpFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC2系统温度故障字'," +
+                "  `dcAC3DevRun` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC3设备运行状态字'," +
+                "  `dcAC3CompFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC3系统综合故障字'," +
+                "  `dcAC3EnvirFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC3系统环境故障字'," +
+                "  `dcAC3HardFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC3系统硬件故障字'," +
+                "  `dcAC3TmpFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC3系统温度故障字'," +
+                "  `dcAC4DevRun` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC4设备运行状态字'," +
+                "  `dcAC4CompFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC4系统综合故障字'," +
+                "  `dcAC4EnvirFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC4系统环境故障字'," +
+                "  `dcAC4HardFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC4系统硬件故障字'," +
+                "  `dcAC4TmpFault` int(11) NOT NULL DEFAULT '0' COMMENT 'DCAC4系统温度故障字'," +
+                "  PRIMARY KEY (`num`)," +
+                "  UNIQUE KEY `index_dev_id` (`dev_id`) USING BTREE" +
+                ") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;";
+		Sql_Mysql sql = new Sql_Mysql(pool.getConn());
+		ResultSet res = null;
+		
+		try {
+			if(true == recreate) {			
+				sql.sqlMysqlExecute(sql_str01);
+			}
+			sql.sqlMysqlExecute(sql_str02);	
+			//初始化默认数据
+			res = sql.sqlMysqlQuery("SELECT COUNT(*) num FROM db_ram_db.tb_ess3100_pcs_state;");
+			if(false != res.next()) {
+				int num = res.getInt("num");
+				if(num==0){
+					//初始化数据
+					sql.sqlMysqlExecute("INSERT INTO db_ram_db.`tb_ess3100_pcs_state` VALUES "
+							+ "('1', '310000001', '2021-11-27 11:40:58', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '3276.8', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');");
+				}else{
+//					System.out.println("db_ram_db.tb_ess3100_pcs_state 有 Num 条数据 "+num);
+				}
+			}
+
+
+		
+		} catch (SQLException e) {
+			e.printStackTrace();
+		} finally {
+			sql.close_con();
+		}
+	}
+
+	private static void createTb_ess3100_sysstate(MysqlConnPool pool, boolean recreate) {
+		String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_ess3100_sysstate;
+		String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_ess3100_sysstate + " (" + 
+				"`num` bigint(20) NOT NULL AUTO_INCREMENT," +
+                "  `dev_id` int(11) NOT NULL DEFAULT '1' COMMENT '设备id'," +
+                "  `sysState` int(11) NOT NULL DEFAULT '1' COMMENT '系统工作状态1:停机;2自检;3运行;4:预留;5:故障'," +
+                "  `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," +
+                "  `workModel` int(11) NOT NULL DEFAULT '1' COMMENT '系统工作模式1:离网模式;2:P/Q模式;3:自动运行模式'," +
+                "  `activePowerLimitDis` int(11) NOT NULL DEFAULT '0' COMMENT '放电有功功率限值'," +
+                "  `activePowerLimitChar` int(11) NOT NULL DEFAULT '0' COMMENT '充电有功功率限值'," +
+                "  `acUa` float NOT NULL DEFAULT '0' COMMENT '交流A相电压'," +
+                "  `acUb` float NOT NULL DEFAULT '0' COMMENT '交流B相电压'," +
+                "  `acUc` float NOT NULL DEFAULT '0' COMMENT '交流C相电压'," +
+                "  `acIa` float NOT NULL DEFAULT '0' COMMENT '交流A相电流'," +
+                "  `acIb` float NOT NULL DEFAULT '0' COMMENT '交流B相电流'," +
+                "  `acIc` float NOT NULL DEFAULT '0' COMMENT '交流C相电流'," +
+                "  `sysActivePowerSum` float NOT NULL DEFAULT '0' COMMENT '系统当前有功功率和'," +
+                "  `sysReactivePowerSum` float NOT NULL DEFAULT '0' COMMENT '系统当前无功率和'," +
+                "  `sysSoc` int(11) NOT NULL DEFAULT '0' COMMENT '系统SOC'," +
+                "  `runPCSMode` float NOT NULL DEFAULT '0' COMMENT '运行PCS模块数'," +
+                "  `parkPower` float NOT NULL DEFAULT '0' COMMENT '园区功率'," +
+                "  `pcsState1` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS模块1状态'," +
+                "  `pcsState2` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS模块2状态'," +
+                "  `pcsState3` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS模块3状态'," +
+                "  `pcsState4` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS模块4状态'," +
+                "  `sysAlm0` int(11) NOT NULL DEFAULT '0' COMMENT '系统告警信息0'," +
+                "  `sysAlm1` int(11) NOT NULL DEFAULT '0' COMMENT '系统告警信息1'," +
+                "  `sysAlm2` int(11) NOT NULL DEFAULT '0' COMMENT '系统告警信息2'," +
+                "  `sysAlm3` int(11) NOT NULL DEFAULT '0' COMMENT '系统告警信息3'," +
+                "  `sysFault0` int(11) NOT NULL DEFAULT '0' COMMENT '系统故障信息0'," +
+                "  `sysFault1` int(11) NOT NULL DEFAULT '0' COMMENT '系统故障信息1'," +
+                "  `pcsWareTmp` float NOT NULL DEFAULT '0' COMMENT 'PCS仓环境温度'," +
+                "  `battWareTmp` float NOT NULL DEFAULT '0' COMMENT '电池仓环境温度'," +
+                "  `containWareTmp` float NOT NULL DEFAULT '0' COMMENT '集装箱外环境温度'," +
+                "  `battWateHum` int(11) NOT NULL DEFAULT '0' COMMENT '电池仓环境湿度'," +
+                "  `pcsWateHum` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS仓环境湿度'," +
+                "  `containWateHum` int(11) NOT NULL DEFAULT '0' COMMENT '集装箱环境湿度'," +
+                "  `airCondState1` int(11) NOT NULL DEFAULT '0' COMMENT '空调状态1'," +
+                "  `airCondState2` int(11) NOT NULL DEFAULT '0' COMMENT '空调状态2'," +
+                "  `sys_year` int(11) NOT NULL DEFAULT '0' COMMENT '系统时间-年'," +
+                "  `sys_month` int(11) NOT NULL DEFAULT '0' COMMENT '系统时间-月'," +
+                "  `sys_day` int(11) NOT NULL DEFAULT '0' COMMENT '系统时间-日'," +
+                "  `sys_hour` int(11) NOT NULL DEFAULT '0' COMMENT '系统时间时'," +
+                "  `sys_minte` int(11) NOT NULL DEFAULT '0' COMMENT '系统时间-分'," +
+                "  `sys_second` int(11) NOT NULL DEFAULT '0' COMMENT '系统时间-秒'," +
+                "  `auxPowerEle_ref` int(11) NOT NULL DEFAULT '0' COMMENT '辅助供电-输入有功电能参考值'," +
+                "  `auxPowerEle_real` int(11) NOT NULL DEFAULT '0' COMMENT '辅助供电-输入有功电能实际值'," +
+                "  `pcsUIChanges` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS UI变比'," +
+                "  `pcsPQChanges` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS PQ变比'," +
+                "  `pcsUa` float NOT NULL DEFAULT '0' COMMENT 'PCS相电压Ua'," +
+                "  `pcsUb` float NOT NULL DEFAULT '0' COMMENT 'PCS相电压Ub'," +
+                "  `pcsUc` float NOT NULL DEFAULT '0' COMMENT 'PCS相电压Uc'," +
+                "  `pcsUab` float NOT NULL DEFAULT '0' COMMENT 'PCS线电压Uab'," +
+                "  `pcsUbc` float NOT NULL DEFAULT '0' COMMENT 'PCS线电压Ubc'," +
+                "  `pcsUca` float NOT NULL DEFAULT '0' COMMENT 'PCS线电压Uca'," +
+                "  `pcsIa` float NOT NULL DEFAULT '0' COMMENT 'PCS电流Ia'," +
+                "  `pcsIb` float NOT NULL DEFAULT '0' COMMENT 'PCS电流Ib'," +
+                "  `pcsIc` float NOT NULL DEFAULT '0' COMMENT 'PCS电流Ic'," +
+                "  `pcsAActPower` float NOT NULL DEFAULT '0' COMMENT 'PCS A相有功功率'," +
+                "  `pcsBActPower` float NOT NULL DEFAULT '0' COMMENT 'PCS B相有功功率'," +
+                "  `pcsCActPower` float NOT NULL DEFAULT '0' COMMENT 'PCS C相有功功率'," +
+                "  `pcsSumActPower` float NOT NULL DEFAULT '0' COMMENT 'PCS 总有功功率'," +
+                "  `pcsAReaPower` float NOT NULL DEFAULT '0' COMMENT 'PCS A相无功功率'," +
+                "  `pcsBReaPower` float NOT NULL DEFAULT '0' COMMENT 'PCS B相无功功率'," +
+                "  `pcsCReaPower` float NOT NULL DEFAULT '0' COMMENT 'PCS C相无功功率'," +
+                "  `pcsSumReaPower` float NOT NULL DEFAULT '0' COMMENT 'PCS 总无功功率'," +
+                "  `pcsApowerFact` float NOT NULL DEFAULT '0' COMMENT 'PCS A相功率因数'," +
+                "  `pcsBpowerFact` float NOT NULL DEFAULT '0' COMMENT 'PCS B相功率因数'," +
+                "  `pcsCpowerFact` float NOT NULL DEFAULT '0' COMMENT 'PCS C相功率因数'," +
+                "  `pcsSumpowerFact` float NOT NULL DEFAULT '0' COMMENT '总功率因数'," +
+                "  `pcsAAppPower` float NOT NULL DEFAULT '0' COMMENT 'PCS A相视在功率'," +
+                "  `pcsBAppPower` float NOT NULL DEFAULT '0' COMMENT 'PCS B相视在功率'," +
+                "  `pcsCAppPower` float NOT NULL DEFAULT '0' COMMENT 'PCS C相视在功率'," +
+                "  `pcsSumAppPower` float NOT NULL DEFAULT '0' COMMENT 'PCS 总视在功率'," +
+                "  `pcsFreq` float NOT NULL DEFAULT '0' COMMENT 'PCS 频率'," +
+                "  `pcsInActPower_ref` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 输入有功电能'," +
+                "  `pcsOutActPower_ref` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS输出有功电能'," +
+                "  `pcsPerReaPower_ref` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 感性无功电能'," +
+                "  `pcsCapReaPower_ref` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 容性无功功率'," +
+                "  `pcsInActPower_real` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 输入有功电能实际值'," +
+                "  `pcsOutActPower_real` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 输出有功电能实际值'," +
+                "  `pcsPerReaPower_real` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 感性无功电能实际值'," +
+                "  `pcsCapReaPower_real` int(11) NOT NULL DEFAULT '0' COMMENT 'PCS 容性无功功率实际值'," +
+                "  PRIMARY KEY (`num`)," +
+                "  UNIQUE KEY `index_dev_id` (`dev_id`) USING BTREE" +
+                ") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;";
+		Sql_Mysql sql = new Sql_Mysql(pool.getConn());
+		ResultSet res = null;
+		
+		try {
+			if(true == recreate) {			
+				sql.sqlMysqlExecute(sql_str01);
+			}
+			sql.sqlMysqlExecute(sql_str02);	
+
+			//初始化默认数据
+			res = sql.sqlMysqlQuery("SELECT COUNT(*) num FROM db_ram_db.tb_ess3100_sysstate;");
+			if(false != res.next()) {
+				int num = res.getInt("num");
+				if(num==0){
+					//初始化数据
+					sql.sqlMysqlExecute("INSERT INTO db_ram_db.`tb_ess3100_sysstate` VALUES "
+							+ "('1', '310000001', '1', '2021-11-27 11:40:59', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '77', '0', '0', '0', '0', '0', '0', '0', '0', '32', '0', '0', '0', '7.3', '11.6', '7.6', '0', '0', '0', '0', '1', '2021', '11', '27', '11', '42', '50', '18709', '0', '771', '1536', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '100', '100', '100', '100', '0', '0', '0', '0', '0', '35184', '32512', '52192', '5120', '23945', '38336', '1244', '9219');");
+				}else{
+//					System.out.println("db_ram_db.tb_ess3100_sysstate 有 Num 条数据 "+num);
+				}
+			}
+
+			
+		} catch (SQLException e) {
+			e.printStackTrace();
+		} finally {
+			sql.close_con();
+		}
+	}
+
 	/**
 	 * 
 	 * @Title: createTb_li9130_setparam_plan
@@ -134,7 +345,7 @@
                 "  `ChargeCurrSet` float NOT NULL DEFAULT '0' COMMENT '充电电流'," +
                 "  `MonomerTmp_High` float NOT NULL DEFAULT '0' COMMENT '温度上限'," +
                 "  PRIMARY KEY (`num`)" +
-                ") ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;";
+                ") ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;";
 		Sql_Mysql sql = new Sql_Mysql(pool.getConn());
 		
 		try {
@@ -142,7 +353,7 @@
 				sql.sqlMysqlExecute(sql_str01);
 			}
 			sql.sqlMysqlExecute(sql_str02);	
-			
+
 		} catch (SQLException e) {
 			e.printStackTrace();
 		} finally {
@@ -1002,26 +1213,51 @@
 	public static void createLd9_Updatestatue_Table(MysqlConnPool pool, boolean recreate) {
 		String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Ld9_Updatestatue_Table;
 		String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Ld9_Updatestatue_Table + " (" + 
-				"  num bigint(20) NOT NULL AUTO_INCREMENT," + 
-				"  dev_id bigint(20) NOT NULL DEFAULT '0'," + 
-				"  update_file varchar(200) NOT NULL DEFAULT ''," + 
-				"  update_en tinyint(1) NOT NULL DEFAULT '0'," + 
-				"  send_upfile_ok tinyint(1) NOT NULL DEFAULT '0'," + 
-				"  stopreason int(11) NOT NULL DEFAULT '0'," + 
-				"  countpackage int(11) NOT NULL DEFAULT '0'," + 
-				"  nowpackagenum int(11) NOT NULL DEFAULT '0'," + 
-				"  updatetime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + 
-				"  starttime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + 
-				"  note varchar(200) NOT NULL DEFAULT ''," + 
-				"  PRIMARY KEY (num)," + 
-				"  UNIQUE KEY index_dev_id_uniq (dev_id)" + 
-				") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
+				"`num` bigint(20) NOT NULL AUTO_INCREMENT," +
+                "  `dev_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '设备ID'," +
+                "  `update_file` varchar(200) NOT NULL DEFAULT '' COMMENT '升级文件名称'," +
+                "  `update_en` tinyint(1) NOT NULL DEFAULT '0' COMMENT '升级使能:0:不操作;1:开始升级'," +
+                "  `update_type` int(1) NOT NULL DEFAULT '0' COMMENT '0:升级LD9;1:升级显示屏'," +
+                "  `send_upfile_ok` tinyint(1) NOT NULL DEFAULT '0' COMMENT '升级是否成功'," +
+                "  `stopreason` int(11) NOT NULL DEFAULT '0' COMMENT '停止原因'," +
+                "  `countpackage` int(11) NOT NULL DEFAULT '0' COMMENT '总数据包数量'," +
+                "  `nowpackagenum` int(11) NOT NULL DEFAULT '0' COMMENT '当前数据包编号'," +
+                "  `updatetime` datetime NOT NULL DEFAULT '1982-01-01 00:00:00' COMMENT '更新时间'," +
+                "  `starttime` datetime NOT NULL DEFAULT '1982-01-01 00:00:00' COMMENT '开始升级时间'," +
+                "  `note` varchar(200) NOT NULL DEFAULT ''," +
+                "  PRIMARY KEY (`num`)," +
+                "  UNIQUE KEY `index_dev_id_uniq` (`dev_id`)" +
+                ") ENGINE=MEMORY AUTO_INCREMENT=7 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);	
+			//添加在线充电列
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_ram_db'"
+					+ " AND table_name='tb_ld9_updatestatue'"
+					+ " AND column_name='update_type'");
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Ld9_Updatestatue_Table 
+								+ " ADD COLUMN `update_type` int(1) NOT NULL DEFAULT '0' COMMENT '0:升级LD9;1:升级显示屏' AFTER update_en;");
+			}			
+			
+			//初始化默认数据
+			res = sql.sqlMysqlQuery("SELECT COUNT(*) num FROM db_ram_db.tb_ld9_updatestatue;");
+			if(false != res.next()) {
+				int num = res.getInt("num");
+				if(num==0){
+					//初始化数据
+					sql.sqlMysqlExecute("INSERT INTO db_ram_db.`tb_ld9_updatestatue` VALUES ('6', '401900002', 'E51_DFU.SM5', '0', '0', '1', '0', '668', '668', '2022-01-07 10:10:02', '2022-01-07 10:07:12', '');");
+				}else{
+//					System.out.println("db_ram_db.tb_ld9_updatestatue 有 Num 条数据 "+num);
+				}
+			}
+
+			
 		} catch (SQLException e) {
 			e.printStackTrace();
 		} finally {

--
Gitblit v1.9.1