From 56c672f46d4b901b1ee4b1ee47768ed53ec5e6a8 Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期四, 08 七月 2021 11:52:25 +0800
Subject: [PATCH] V1.60 edit at date 2021-07-08 	1.新建'db_ram_db.`tb_fbs9100s_buscouple_state`'-->'母联开关状态表'数据库表 	1.新建'db_ram_db.`tb_fbs9100s_stemnode_state`'-->'干接点状态表'数据库表

---
 BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java |  550 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 515 insertions(+), 35 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java b/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
index e39ded0..f4a38f2 100644
--- a/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
+++ b/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -25,6 +25,14 @@
 	final public static String DB_RamDB_BATT_RT = "`db_ram_batt_rt`";
 	
 	final public static String WEB_Site = "`web_site`";
+	final public static String DB_BATT_HISTORY = "`db_batt_history`";
+	final public static String DB_LD9_TESTDATA = "`db_ld9_testdata`";
+	
+	final public static String DB_PWRDEV_ALARM = "`db_pwrdev_alarm`";
+	final public static String DB_PWRDEV_DATA_RT = "`db_pwrdev_data_rt`";
+	final public static String DB_PWRDEV_INF = "`db_pwrdev_inf`";
+	
+	
 	//--------------------------------------------------------------------------------------------//
 	public final static String TB_HardDevSmsState = "tb_hard_dev_sms_state";
 	//--------------------------------------------------------------------------------------------//
@@ -32,8 +40,8 @@
 	public final static String TB_ServerState = "tb_server_state";
 	
 	public final static String TB_BattTestDataInf = "tb_batttestdata_inf";
+	public final static String TB_BattRtData = "tb_batt_rtdata";
 	public final static String TB_BattRtState = "tb_batt_rtstate";
-	public final static String TB_BattRtData = "tb_server_state";
 	
 	public final static String TB_UserInf = "tb_user_inf";
 	public final static String TB_UserLog = "tb_user_log";
@@ -55,27 +63,11 @@
 	public final static String TB_UserJieJiaRi = "tb_user_jiejiari";
 	//--------------------------------------------------------------------------------------------//
 	//--------------------------------------------------------------------------------------------//
-	public final static String ServerState_Table = DB_RamDB + ".`tb_server_state`";
-	public final static String BattRtData_Table = DB_RamDB + ".`tb_batt_rtdata`";
-	public final static String BattRtState_Table = DB_RamDB + ".`tb_batt_rtstate`";
-	
 	public final static String CInterfaceState_Table = DB_RamDB + ".`tb_cinterface_state`";
 	
-	public final static String HardDevSmsState_Table = DB_RamDB + ".`tb_hard_dev_sms_state`";
-	public final static String FBS9100State_Table = DB_RamDB + ".`tb_fbs9100_state`";
-	public final static String FBS9100S_DcDcState_Table = DB_RamDB + ".`tb_fbs9100s_dcdc_state`";
-	public final static String FBS9100SetParam_Table = DB_RamDB + ".`tb_fbs9100_setparam`";
-	public final static String FBS9100S_DFUState_Table = DB_RamDB + ".`tb_fbs9100s_DFU_state`";
-	
-	public final static String BMP7100State_Table = DB_RamDB + ".`tb_bpm7100_state`";
-	
-	public final static String FBS9600State_Table = DB_RamDB + ".`tb_fbs9600_state`";
 	public final static String FBS9600SetParam_Table = DB_RamDB + ".`tb_fbs9600_setparam`";
 	//public final static String FBS9600Param_Table = DB_RamDB + ".`tb_fbs9600_param`";
-	public final static String SocketClientStateTable = DB_RamDB + ".`tb_socketclient_state`";
-	public final static String RamDB_CMCC_POWER_Data = DB_RamDB + ".`cmcc_power_data`";
 	
-	public final static String BTSStationState_Table = DB_RamDB + ".`tb_bts_station_state`";						//机房状态表
 	//--------------------------------------------------------------------------------------------//
 	//--------------------------------------------------------------------------------------------//
 	public final static String AppSys_Table = DB_AppSys + ".`tb_app_sys`";
@@ -86,9 +78,10 @@
 	public final static String BattMainProcess_Table = DB_BATT_INF + ".`tb_batt_maint_process`";
 	
 	
+	
 	public final static String BattTestDataInf_Table = DB_BATT_TESTDATA + ".`tb_batttestdata_inf`";
-	public final static String BattResData_Table = DB_BATT_TESTDATA + ".`tb_BattResData`";
 	public final static String BattResDataInf_Table = DB_BATT_TESTDATA + ".`tb_battresdata_inf`";
+	public final static String BattResData_Table = DB_BATT_TESTDATA + ".`tb_BattResData`";
 	
 	public final static String UserInfTable = DB_USER + ".`tb_user_inf`";
 	public final static String UserLogTable = DB_USER + ".`tb_user_log`";
@@ -113,6 +106,166 @@
 	public final static String UserPermitGroupTable = DB_USER + ".`tb_user_permitgroup`";
 	public final static String UserPermitGroupDataTable = DB_USER + ".`tb_user_permitgroup_data`";
 	public final static String UserJieJiaRiTable = DB_USER + ".`tb_user_jiejiari`";
+	
+	
+	public final static String BTSStationEvent_Table = DB_ALARM + ".`tb_bts_station_event`";							//机房状态历史表
+	
+	/**************************** db_ram_db数据库 ***************************************************/
+	public final static String SocketClientStateTable = DB_RamDB + ".`tb_socketclient_state`";
+	public final static String ServerState_Table = DB_RamDB + ".`tb_server_state`";
+	public final static String Ld9_Updatestatue_Table = DB_RamDB + ".`tb_ld9_updatestatue`";
+	public final static String Ld9_State_Table = DB_RamDB + ".`tb_ld9_state`";
+	public final static String Ld9_Setparam_Table = DB_RamDB + ".`tb_ld9_setparam`";
+	public final static String Ld9_Concentratestate_Table = DB_RamDB + ".`tb_ld9_concentratestate`";
+	public final static String Ld9_Concentrateparam_Table = DB_RamDB + ".`tb_ld9_concentrateparam`";
+	public final static String HardDevSmsState_Table = DB_RamDB + ".`tb_hard_dev_sms_state`";
+	public final static String FBS9600State_Table = DB_RamDB + ".`tb_fbs9600_state`";
+	public final static String FBS9100_NiBian_State = DB_RamDB + ".tb_fbs9100s_nibian_state";						//61850离线养护计划参数表
+	public final static String FBS9100s_fod_state = DB_RamDB + ".tb_fbs9100s_fod_state";							//61850除硫状态表
+	public final static String FBS9100SetDLParam_Table = DB_RamDB + ".`tb_fbs9100s_fod_param`";						//61850除硫参数表
+	public final static String FBS9100S_DFUState_Table = DB_RamDB + ".`tb_fbs9100s_DFU_state`";
+	public final static String FBS9100S_DcDcState_Table = DB_RamDB + ".`tb_fbs9100s_dcdc_state`";
+	public final static String FBS9100SysParam_Table = DB_RamDB + ".`tb_fbs9100_sysparam`";							//系统参数表
+	public final static String FBS9100State_Table = DB_RamDB + ".`tb_fbs9100_state`";
+	public final static String FBS9100SetParam_Table = DB_RamDB + ".`tb_fbs9100_setparam`";
+	public final static String FBS9100_offlineyhplan = DB_RamDB + ".tb_fbs9100_offlineyhplan";						//61850离线养护计划参数表
+	public final static String FBS9100BattParam_Table = DB_RamDB + ".`tb_fbs9100_battparam`";						//电池组参数表
+	public final static String BTSStationState_Table = DB_RamDB + ".`tb_bts_station_state`";						//机房状态表
+	public final static String BTSGPRSState_Table = DB_RamDB + ".`tb_bts_gprs_state`";								//gprs 信息表
+	public final static String BMP7100State_Table = DB_RamDB + ".`tb_bpm7100_state`";
+	public final static String BattRtState_Table = DB_RamDB + ".`tb_batt_rtstate`";
+	public final static String BattRtData_Table = DB_RamDB + ".`tb_batt_rtdata`";
+	public final static String TB_61850_JHState_Table = DB_RamDB +".tb_61850_jhstate";								//61850均衡61850供电模块信息
+	public final static String RamDB_CMCC_POWER_Data = DB_RamDB + ".`cmcc_power_data`";
+	public final static String FBS9100_InsulatstateTable = DB_RamDB + ".`tb_fbs9100_insulatstate`";					//绝缘装置
+	public final static String FBS9100_CollectionstateTable = DB_RamDB + ".`tb_fbs9100_collectionstate`";			//汇集装置
+	public final static String FBS9100_ChargerstateTable = DB_RamDB + ".`tb_fbs9100_chargerstate`";					//充电机
+	public final static String Tb_Lithium_DataTable = DB_RamDB + ".`tb_lithium_data`";								//锂电池数据表
+	
+	public final static String Tb_Batt_RSAlarm_Table = DB_RamDB + ".`tb_batt_rsalarm`";								//锂电池数据表
+	public final static String Tb_Batt_RTAlarm_Table = DB_RamDB + ".`tb_batt_rtalarm`";								//锂电池数据表
+	
+	public final static String FBS9100s_stemnode_state_Table = DB_RamDB + ".`tb_fbs9100s_stemnode_state`";			//干节点状态表
+	public final static String FBS9100s_buscouple_state_Table = DB_RamDB + ".`tb_fbs9100s_buscouple_state`";		//母联开关状态表
+	
+	
+	/**************************** db_user数据库 ***************************************************/
+	public final static String User_Permitgroup_Table = DB_USER + ".`tb_user_permitgroup`";								//权限表
+	public final static String User_Permitgroup_Data_Table = DB_USER + ".`tb_user_permitgroup_data`";					//用户权限表
+	public final static String User_Task_User_List_Table = DB_USER + ".`tb_user_task_user_list`";						//
+	public final static String User_Task_Template_Table = DB_USER + ".`tb_user_task_template`";							//
+	public final static String User_Task_Param_Table = DB_USER + ".`tb_user_task_param`";							//
+	public final static String User_Task_Change_Table = DB_USER + ".`tb_user_task_change`";							//
+	public final static String User_Task_Batt_Test_Table = DB_USER + ".`tb_user_task_batt_test`";							//
+	public final static String User_Task_Batt_Template_Table = DB_USER + ".`tb_user_task_batt_template`";							//
+	public final static String User_Task_Batt_Check_Table = DB_USER + ".`tb_user_task_batt_check`";							//
+	public final static String User_Task_Table = DB_USER + ".`tb_user_task`";							//
+	public final static String User_Sms_Format_Table = DB_USER + ".`tb_user_sms_format`";							//
+	public final static String User_Sms_Table = DB_USER + ".`tb_user_sms`";							//
+	public final static String User_Paixiu_Table = DB_USER + ".`tb_user_paixiu`";							//
+	public final static String User_Log_Table = DB_USER + ".`tb_user_log`";							//
+	public final static String User_Jiejiari_Table = DB_USER + ".`tb_user_jiejiari`";							//
+	public final static String User_Face_Table = DB_USER + ".`tb_user_face`";							//
+	public final static String User_Battmaint_Check_Process_Table = DB_USER + ".`tb_user_battmaint_check_process`";							//
+	public final static String User_Battmaint_Check_Table = DB_USER + ".`tb_user_battmaint_check`";							//
+	public final static String User_Battgroup_Baojigroup_Usr_Table = DB_USER + ".`tb_user_battgroup_baojigroup_usr`";							//
+	public final static String User_Battgroup_Baojigroup_Battgroup_Table = DB_USER + ".`tb_user_battgroup_baojigroup_battgroup`";							//
+	public final static String User_Battgroup_Baojigroup_Table = DB_USER + ".`tb_user_battgroup_baojigroup`";							//
+	public final static String User_Limit_Table = DB_USER + ".`tb_user_limit`";							//
+	
+	
+	
+	
+	
+	
+	/**************************** web_site数据库 ***************************************************/
+	public final static String ThreadUtil_Table = WEB_Site + ".`tb_thread_util`";						//线程帮助表
+	public final static String PositiomapUsr_Table = WEB_Site + ".`tb_positiomap_usr`";					//首页地图中心点定位表
+	public final static String ChartColor_Table = WEB_Site + ".`tb_chart_color`";						//用户实时监测页面指定柱状的颜色设置表
+	public final static String UserChart_Table = WEB_Site + ".`tb_user_chart`";							//班组管理表
+	public final static String ProcessSurvey_Table = WEB_Site + ".`tb_process_survey`";					//线程监控表
+	public final static String EchartsUsr_Table = WEB_Site + ".`tb_echarts_usr`";						//用户首页定制表
+	public final static String DevstateUsr_Table = WEB_Site + ".`tb_devstate_usr`";						//用户放电添加记录表
+	public final static String CustomPage_Table = WEB_Site + ".`tb_custompage`";						//导航数据表
+	public final static String Announce_Table = WEB_Site + ".`tb_announce`";							//公告表
+	public final static String BattAttention_Table = WEB_Site + ".`tb_batt_attention`";					//创建电池组单体关注表
+	public final static String BattpowerOff_Table = WEB_Site + ".`tb_battpower_off`";					//机房停电表
+	public final static String BadbattMon_Table = WEB_Site + ".`tb_badbatt_mon`";						//落后单体表
+	public final static String BadbattMonFlag_Table = WEB_Site + ".`tb_badbatt_mon_flag`";				//落后单体控制表
+	public final static String BattEndurance_Table = WEB_Site + ".`tb_batt_endurance`";					//机房续航表
+	public final static String BattParamLow_Table = WEB_Site + ".`tb_batt_param_low`";					//电池参数表
+	public final static String BattDischargeParam_Table = WEB_Site + ".`tb_battdischarge_param`";		//放电计划参数表
+	public final static String BattDischargePlan_Table = WEB_Site + ".`tb_battdischarge_plan`";			//放电计划表
+	public final static String Avoid_plan_Table = WEB_Site + ".`tb_avoid_plan`";						//放电计划规避时间表
+	public final static String BattMapInformation_Table = WEB_Site + ".`tb_battmap_information`";		//基站定位表
+	public final static String BattDischarge_Table = WEB_Site + ".`tb_batt_discharge`";					//基站故障表
+	public final static String BattReplace_Table = WEB_Site + ".`tb_batt_replace`";						//电池更换记录表
+	public final static String Dev_Restart_Plan_Table = WEB_Site +".`tb_dev_restart_plan`";				//设备定期重启计划表
+	public final static String Vip_User_Table = WEB_Site +".`tb_vip_user`";								//超级用户表
+	public final static String License_Table = WEB_Site +".`tb_license`";								//超级用户表
+	
+	
+	/***************************** db_battinf数据库  ***************************************/
+	public final static String DeverrorRecord_Table = DB_BATT_INF + ".`tb_deverror_record`";						//机房问题记录表
+	public final static String BattinfApply_TABLE = DB_BATT_INF + ".`tb_battinf_apply`";							//机房安装审批表
+	public final static String BattinfEx_TABLE = DB_BATT_INF + ".`tb_battinf_ex`";									//基站信息表
+	public final static String BattinfRebuild_TABLE = DB_BATT_INF + ".`tb_battinf_rebuild`";						//机房配组表
+	public final static String BattmonTestcap_TABLE = DB_BATT_INF + ".`tb_battmon_testcap`";						//机房标准测试曲线记录表
+	public final static String Battcurr_Inf_TABLE = DB_BATT_INF + ".`tb_battcurr_inf`";						
+	public final static String Batt_Maint_Process_TABLE = DB_BATT_INF + ".`tb_batt_maint_process`";						
+	public final static String Batt_Maint_Inf_TABLE = DB_BATT_INF + ".`tb_batt_maint_inf`";						
+	public final static String Batt_Alm_Param_TABLE = DB_BATT_INF + ".`tb_batt_alm_param`";						
+	
+	
+	
+	
+	/***************************** db_alarm数据库  ***************************************/
+	public final static String Devalarm_Data_Table = DB_ALARM + ".`tb_devalarm_data`";
+	public final static String Devalarm_Data__History_Table = DB_ALARM + ".`tb_devalarm_data_history`";
+	public final static String Bts_Station_Event_Table = DB_ALARM + ".`tb_bts_station_event`";
+	public final static String Battalarm_Data_Table = DB_ALARM + ".`tb_battalarm_data`";
+	public final static String Battalarm_Data_History_Table = DB_ALARM + ".`tb_battalarm_data_history`";
+	
+	
+	/***************************** db_app_sys 数据库  ***************************************/
+	public final static String Page_Param_Table = DB_AppSys + ".`tb_page_param`";
+	public final static String Fbsdev_Statechange_Inf_Table = DB_AppSys + ".`tb_fbsdev_statechange_inf`";
+	public final static String Dashboard_Module_Chart_Table = DB_AppSys + ".`tb_dashboard_module_chart`";
+	public final static String Dashboard_Module_Table = DB_AppSys + ".`tb_dashboard_module`";
+	public final static String Dashboard_Chart_Type_Table = DB_AppSys + ".`tb_dashboard_chart_type`";
+	public final static String App_Sys_Table = DB_AppSys + ".`tb_app_sys`";
+	public final static String App_Bts_Comm_Task_Table = DB_AppSys + ".`tb_app_bts_comm_task`";
+	public final static String App_Bts_Battgroup_Table = DB_AppSys + ".`tb_app_bts_battgroup`";
+	public final static String Menu_Table = DB_AppSys + ".`tb_menu`";
+	
+	/***************************** db_ld9_testdata 数据库  ***************************************/
+	public final static String Ld9testdata_Inf_Table = DB_LD9_TESTDATA + ".`tb_ld9testdata_inf`";
+	
+	/***************************** db_param 数据库  ***************************************/
+	public final static String Dev_Param_Table = DB_PARAM + ".`tb_dev_param`";
+	public final static String App_Param_Table = DB_PARAM + ".`tb_app_param`";
+	public final static String Alarm_Param_Table = DB_PARAM + ".`tb_alarm_param`";
+	
+	/***************************** db_pwrdev_alarm 数据库  ************************************/
+	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`";
+	
+	/***************************** db_pwrdev_data_rt 数据库  ************************************/
+	public final static String Pwrdev_Acdcdata_Table = DB_PWRDEV_DATA_RT + ".`tb_pwrdev_acdcdata`";
+	public final static String Pwrdev_Dcdata_Table = DB_PWRDEV_DATA_RT + ".`tb_pwrdev_dcdata`";
+	public final static String Pwrdev_Acdata_Table = DB_PWRDEV_DATA_RT + ".`tb_pwrdev_acdata`";
+	
+	/***************************** db_pwrdev_inf 数据库  ************************************/
+	public final static String Pwrdev_Inf_Table = DB_PWRDEV_INF + ".`tb_pwrdev_inf`";
+	public final static String Pwrapp_Sys_Table = DB_PWRDEV_INF + ".`tb_pwrapp_sys`";
+	public final static String Display_Config_Table = DB_PWRDEV_INF + ".`tb_display_config`";
+	
+	public final static String Pwrapp_Stainf_Table = DB_PWRDEV_INF + ".`tb_pwrapp_stainf`";
+	public final static String Pwrapp_Dcinf_Table = DB_PWRDEV_INF + ".`tb_pwrapp_dcinf`";
+	public final static String Pwrapp_Acinf_Table = DB_PWRDEV_INF + ".`tb_pwrapp_acinf`";
+	public final static String Pwrapp_Acdcinf_Table = DB_PWRDEV_INF + ".`tb_pwrapp_acdcinf`";
+	
+	
 	//--------------------------------------------------------------------------------------------//
 	//--------------------------------------------------------------------------------------------//
 	public Connection mysql_con;
@@ -152,7 +305,7 @@
 		sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + DB_USER);
 		sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + DB_RamDB);
 		
-		sqlMysqlExecute("DROP DATABASE IF EXISTS " + DB_RamDB_BATT_RT);
+		//sqlMysqlExecute("DROP DATABASE IF EXISTS " + DB_RamDB_BATT_RT);
 		//sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + DB_RamDB_BATT_RT);
 		
 		sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + WEB_Site);
@@ -163,6 +316,8 @@
 						+ "`SqlDB_BackUpTime` DATETIME NOT NULL DEFAULT '2000-1-1 00:00:00',"
 						+ "`SqlDB_BackUpManual_EN` BOOLEAN NOT NULL DEFAULT false, "
 						+ "`AppServer_Reinit_BattGroupData_EN` BOOLEAN NOT NULL DEFAULT false, "
+						+ "`AppServer_Reinit_BattGroupData_LD9_EN` BOOLEAN NOT NULL DEFAULT false, "			//用于9度程序重新加载设备
+						+ "`AppServer_Reinit_Config_EN` BOOLEAN NOT NULL DEFAULT false, "
 						+ "`AppServer_Version` FLOAT NOT NULL DEFAULT '1.0',"
 						+ "`AppClient_Version` FLOAT NOT NULL DEFAULT '1.0',"
 						+ "`AppName` VARCHAR(50) NOT NULL DEFAULT '0',"
@@ -236,6 +391,7 @@
 						+ "PRIMARY KEY (`num`)) "
 						+ "ENGINE=InnoDB DEFAULT CHARSET=utf8;";
 		
+		
 		String table_3 = "CREATE TABLE IF NOT EXISTS " + BattMainInf_Table
 						+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
 						+ "`BattGroupId` INT NOT NULL DEFAULT 0, "
@@ -276,6 +432,8 @@
 						+ "INDEX index_batt_maint_rec_id (`batt_maint_rec_id`), "
 						+ " PRIMARY KEY (`num`)) "
 						+ "ENGINE=InnoDB DEFAULT CHARSET=utf8;";
+		
+		
 		
 		String table_3_2 = "CREATE TABLE IF NOT EXISTS " + UsrBattMaintCheck_Table
 						+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
@@ -396,6 +554,23 @@
 						+ "INDEX index_dev_id (`dev_id`), "
 						+ "PRIMARY KEY (`num`)) "
 						+ "ENGINE=InnoDB DEFAULT CHARSET=utf8;";
+		
+		
+		
+		
+		String table_9 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSStationEvent_Table
+						+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
+						+ "`station_id` BIGINT NOT NULL DEFAULT 0, "
+						+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
+						+ "`record_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
+						
+						+ "`station_event_type` INT NOT NULL DEFAULT 0, "
+						+ "`station_event_trig` INT NOT NULL DEFAULT 0, "
+						
+						+ " INDEX index_dev_id (`dev_id`), "
+						+ " INDEX index_station_id (`station_id`), "
+						+ " PRIMARY KEY (`num`) ) "
+						+ " ENGINE=InnoDB DEFAULT CHARSET=utf8";
 		//-------------------------------------------------------------------------------------//
 		//-------------------------------------------------------------------------------------//
 		sqlMysqlUseDB(Sql_Mysql.DB_AppSys);
@@ -420,26 +595,61 @@
 			}
 		}
 		//---------------------------------------------------------------------------------------------//
-		ResultSet res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+			ResultSet res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_app_sys'"
+									+ " AND table_name='tb_app_sys'"
+									+ " AND column_name='SqlDB_BackUpTime'");
+			if(false == res0.next()) {
+				sqlMysqlExecute("ALTER TABLE " + AppSys_Table 
+								+ " ADD COLUMN `SqlDB_BackUpTime` DATETIME NOT NULL DEFAULT '2000-1-1 00:00:00'"
+								+ " AFTER `SqlDB_Version`,"
+								+ " ADD COLUMN `SqlDB_BackUpManual_EN` BOOLEAN NOT NULL DEFAULT false"
+								+ " AFTER `SqlDB_BackUpTime`");
+			}
+			res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
 								+ " WHERE table_schema='db_app_sys'"
 								+ " AND table_name='tb_app_sys'"
-								+ " AND column_name='SqlDB_BackUpTime'");
-		if(false == res0.next()) {
+								+ " AND column_name='SqlDB_BackUpManual_EN'");
+			if(false == res0.next()) {
+				sqlMysqlExecute("ALTER TABLE " + AppSys_Table 
+								+ " ADD COLUMN `SqlDB_BackUpManual_EN` BOOLEAN NOT NULL DEFAULT false"
+								+ " AFTER `SqlDB_BackUpTime`");
+			}
+		
+			/**************************** db_app_sys 表中添加 AppServer_Reinit_BattGroupData_EN列(重新载入电池组信息) *******************************************/
+			res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_app_sys'"
+					+ " AND table_name='tb_app_sys'"
+					+ " AND column_name='AppServer_Reinit_BattGroupData_EN'");
+			if(false == res0.next()) {
 			sqlMysqlExecute("ALTER TABLE " + AppSys_Table 
-							+ " ADD COLUMN `SqlDB_BackUpTime` DATETIME NOT NULL DEFAULT '2000-1-1 00:00:00'"
-							+ " AFTER `SqlDB_Version`,"
-							+ " ADD COLUMN `SqlDB_BackUpManual_EN` BOOLEAN NOT NULL DEFAULT false"
-							+ " AFTER `SqlDB_BackUpTime`");
-		}
-		res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
-							+ " WHERE table_schema='db_app_sys'"
-							+ " AND table_name='tb_app_sys'"
-							+ " AND column_name='SqlDB_BackUpManual_EN'");
-		if(false == res0.next()) {
+							+ " ADD COLUMN `AppServer_Reinit_BattGroupData_EN` BOOLEAN NOT NULL DEFAULT false"
+							+ " AFTER `SqlDB_BackUpManual_EN`");
+			}
+			
+			
+			/**************************** db_app_sys 表中添加 AppServer_Reinit_BattGroupData_EN 列(用于主程序动态调整运行参数) *******************************************/
+			res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_app_sys'"
+					+ " AND table_name='tb_app_sys'"
+					+ " AND column_name='AppServer_Reinit_Config_EN'");
+			if(false == res0.next()) {
 			sqlMysqlExecute("ALTER TABLE " + AppSys_Table 
-							+ " ADD COLUMN `SqlDB_BackUpManual_EN` BOOLEAN NOT NULL DEFAULT false"
-							+ " AFTER `SqlDB_BackUpTime`");
-		}
+							+ " ADD COLUMN `AppServer_Reinit_Config_EN` BOOLEAN NOT NULL DEFAULT false"
+							+ " AFTER `AppServer_Reinit_BattGroupData_EN`");
+			}
+			
+			
+			/**************************** db_app_sys 表中添加 AppServer_Reinit_BattGroupData_LD9_EN 列(用于LD9主程序动态加载设备参数) *******************************************/
+			res0 = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_app_sys'"
+					+ " AND table_name='tb_app_sys'"
+					+ " AND column_name='AppServer_Reinit_BattGroupData_LD9_EN'");
+			if(false == res0.next()) {
+			sqlMysqlExecute("ALTER TABLE " + AppSys_Table 
+							+ " ADD COLUMN `AppServer_Reinit_BattGroupData_LD9_EN` BOOLEAN NOT NULL DEFAULT false"
+							+ " AFTER `AppServer_Reinit_BattGroupData_EN`");
+			}
 		//---------------------------------------------------------------------------------------------//
 		
 		sqlMysqlExecute(table_1);
@@ -453,6 +663,7 @@
 		sqlMysqlExecute(table_6);
 		sqlMysqlExecute(table_7);
 		sqlMysqlExecute(table_8);
+		sqlMysqlExecute(table_9);
 		
 		//---------------------------------------------------------------------------------------------//
 		ResultSet res = sqlMysqlQuery("show index from " + BattInf_Table + " where column_name='BattGroupId'");
@@ -504,7 +715,257 @@
 						}
 						
 				//---------------------------------------------------------------------------------------------//
+				
+				//-------------------------------- 2018-10-16 by lijun   (  binf表中添加   station_install->标识机房是否已经安装 )------------------------------------//		
+						res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+								+ " WHERE table_schema='db_battinf'"
+								+ " AND table_name='tb_battinf'"
+								+ " AND column_name='station_install'");
+						if(false == res.next()) {
+							sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+											+ " ADD COLUMN `station_install` BOOLEAN NOT NULL DEFAULT false");
+						}
 						
+				//---------------------------------------------------------------------------------------------//
+				//-------------------------------- 2018-11-29 by lijun   (  binf表中添加   StationId_ex->基站站址编号   install_user-->安装人)------------------------------------//		
+						res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+								+ " WHERE table_schema='db_battinf'"
+								+ " AND table_name='tb_battinf'"
+								+ " AND column_name='StationId_ex'");
+						if(false == res.next()) {
+							sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+											+ " ADD COLUMN `StationId_ex` varchar(20) DEFAULT '' AFTER StationId");
+						}
+						res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+								+ " WHERE table_schema='db_battinf'"
+								+ " AND table_name='tb_battinf'"
+								+ " AND column_name='install_user'");
+						if(false == res.next()) {
+							sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+									+ " ADD COLUMN `install_user` varchar(64) DEFAULT ''");
+						}
+						
+				//---------------------------------------------------------------------------------------------//
+				//-------------------------------- 2018-12-12 by lijun   (  binf表中添加  charge_curr_max  最大充电电流)------------------------------------//		
+						res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+								+ " WHERE table_schema='db_battinf'"
+								+ " AND table_name='tb_battinf'"
+								+ " AND column_name='charge_curr_max'");
+						if(false == res.next()) {
+							sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+											+ " ADD COLUMN `charge_curr_max` float DEFAULT '20'");
+						}
+				 //---------------------------------------------------------------------------------------------//
+						//为紫晶南网平台添加指定的列
+						boolean isZijing = true;
+						if(isZijing) {
+							//添加电压等级列
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='Vol_grade'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `Vol_grade` float DEFAULT '0'");
+							}
+							
+							//生产厂家
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='Manufacturers'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `Manufacturers` varchar(64) DEFAULT ''");
+							}
+							
+							//是否资产级设备
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='Assetequipment'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `Assetequipment` varchar(64) DEFAULT ''");
+							}
+							
+							
+							
+							//设备分类全路径
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='Deviceclasspath'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `Deviceclasspath` varchar(64) DEFAULT ''");
+							}
+							
+							//设备运维部门
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='Deviceoperationdepartment'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `DeviceOperationDepartment` varchar(64) DEFAULT ''");
+							}
+							
+							//产权单位
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='PropertyRightUnit'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `PropertyRightUnit` varchar(64) DEFAULT ''");
+							}
+							
+							//产权属性
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='PropertyAttribute'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `PropertyAttribute` varchar(64) DEFAULT ''");
+							}
+							
+							//出厂编号
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='FactoryNumber'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `FactoryNumber` varchar(64) DEFAULT ''");
+							}
+							
+							//运维班组
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='OperationTeam'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `OperationTeam` varchar(64) DEFAULT ''");
+							}
+							
+							//设备身份编码
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='DeviceIdentityCode'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `DeviceIdentityCode` varchar(64) DEFAULT ''");
+							}
+							
+							
+							//项目类型
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='ProjectType'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `ProjectType` varchar(64) DEFAULT ''");
+							}
+							
+							//蓄电池应用类型
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='BatteryApplicationType'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `BatteryApplicationType` varchar(64) DEFAULT ''");
+							}
+							
+							//单电池额定电压
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='SingleRatedVoltage'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `SingleRatedVoltage` float DEFAULT '0'");
+							}
+							
+							//是否实现远程监控  
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='RemoteMonitor'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `RemoteMonitor` varchar(64) DEFAULT ''");
+							}
+							
+							//是否独立蓄电池室放置  
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='BatttIndependentPlaced'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `BatttIndependentPlaced` varchar(64) DEFAULT ''");
+							}
+							
+							//均充电压设定值 
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='JunChargeVoltageValue'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `JunChargeVoltageValue` float DEFAULT '0'");
+							}
+							
+							
+							//公钥X
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='PublicKeyX'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `PublicKeyX` varchar(200) NOT NULL DEFAULT ''");
+							}
+							
+							//公钥Y
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='PublicKeyY'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `PublicKeyY` varchar(200) NOT NULL DEFAULT ''");
+							}
+							
+							//KeyID
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='KeyID'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `KeyID` varchar(200) NOT NULL DEFAULT ''");
+							}
+							
+							//唯一索引
+							res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
+									+ " WHERE table_schema='db_battinf'"
+									+ " AND table_name='tb_battinf'"
+									+ " AND column_name='SerialNumber'");
+							if(false == res.next()) {
+								sqlMysqlExecute("ALTER TABLE " + BattInf_Table 
+												+ " ADD COLUMN `SerialNumber` varchar(200) NOT NULL DEFAULT ''");
+							}
+						}
+						
+						
+		
 						
 		//---------------------------------------------------------------------------------------------//
 		res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
@@ -577,6 +1038,25 @@
 			}
 		}
 		//---------------------------------------------------------------------------------------------//
+		//-----------------------------  tb_fbsdev_statechange_inf 表中新增2个字段  ----------------------------------------------------------------//
+		res = sqlMysqlQuery("SELECT DATA_TYPE FROM information_schema.columns"
+				+ " WHERE table_schema='db_app_sys'"
+				+ " AND table_name='tb_fbsdev_statechange_inf'"
+				+ " AND column_name='eve_type'");
+		if(false == res.next()) {
+			sqlMysqlExecute("ALTER TABLE " + FBSDevStateChangeInf_Table 
+					+ " ADD COLUMN `eve_type` int DEFAULT 0;");
+		}
+		
+		res = sqlMysqlQuery("SELECT DATA_TYPE FROM information_schema.columns"
+				+ " WHERE table_schema='db_app_sys'"
+				+ " AND table_name='tb_fbsdev_statechange_inf'"
+				+ " AND column_name='module_num'");
+		if(false == res.next()) {
+			sqlMysqlExecute("ALTER TABLE " + FBSDevStateChangeInf_Table 
+					+ " ADD COLUMN `module_num` int DEFAULT 0;");
+		}
+		
 	}
 	
 	//使用db数据库

--
Gitblit v1.9.1