package com.database_util;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.Date;
|
|
import com.base.Com;
|
import com.battdata_rt.BattData_RT_RamDB_Thread_SQL;
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class DB_Ram_db {
|
|
public static void init(MysqlConnPool pool, boolean recreate) {
|
createDb_Ram_Db(pool);
|
|
createFBS9100s_fod_state(pool,recreate); //´´½¨³ýÁò״̬±ítb_fbs9100s_fod_state
|
|
createFBS9100SetDLParam_Table(pool,recreate); //´´½¨³ýÁò²ÎÊý±í
|
|
createFBS9100_NiBian_State_Table(pool, recreate); //´´½¨Äæ±äÐÅÏ¢±í
|
|
|
createSocketClientStateTable(pool, recreate);
|
|
createServerState_Table(pool, recreate);
|
|
createLd9_Updatestatue_Table(pool, recreate);
|
|
createLd9_State_Table(pool, recreate);
|
|
createLd9_Setparam_Table(pool, recreate);
|
|
createLd9_Concentratestate_Table(pool, recreate);
|
|
createLd9_Concentrateparam_Table(pool, recreate);
|
|
createHardDevSmsState_Table(pool, recreate);
|
|
createFBS9600State_Table(pool, recreate);
|
|
createFBS9100S_DFUState_Table(pool, recreate);
|
|
createFBS9100S_DcDcState_Table(pool, recreate);
|
|
createFBS9100SysParam_Table(pool, recreate);
|
|
createFBS9100State_Table(pool, recreate);
|
|
createFBS9100SetParam_Table(pool, recreate);
|
|
createFBS9100_offlineyhplan_Table(pool, recreate);
|
|
createFBS9100BattParam_Table(pool, recreate);
|
|
createBTSStationState_Table(pool, recreate);
|
|
createBTSGPRSState_Table(pool, recreate);
|
|
createBMP7100State_Table(pool, recreate);
|
|
createBattRtState_Table(pool, recreate);
|
|
createBattRtData_Table(pool, recreate);
|
|
create61850_JHState_Table(pool, recreate);
|
|
createRamDB_CMCC_POWER_Data_Table(pool, recreate);
|
|
createFBS9100_CollectionstateTable(pool, recreate);
|
|
createFBS9100_InsulatstateTable(pool, recreate);
|
|
createFBS9100_ChargerstateTable(pool, recreate);
|
|
createTb_Lithium_DataTable(pool, recreate);
|
|
//ÄϾ©ËͼìÌØÓÐ
|
createTb_Batt_RTAlarm_Table(pool, recreate);
|
//ÄϾ©ËͼìÌØÓÐ
|
createTb_Batt_RSAlarm_Table(pool, recreate);
|
|
//´´½¨¸É½Úµã״̬±í
|
createFBS9100s_stemnode_state_Table(pool, recreate);
|
|
//´´½¨Ä¸Áª¿ª¹Ø×´Ì¬±í
|
createFBS9100s_buscouple_state_Table(pool, recreate);
|
}
|
|
|
|
|
|
/**
|
* ´´½¨ web_site Êý¾Ý¿â
|
* @param pool
|
*/
|
public static void createDb_Ram_Db(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_RamDB);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨³ýÁò״̬±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100s_fod_state(MysqlConnPool pool, boolean recreate) {
|
String sql_str1 = " DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100s_fod_state;
|
String sql_str2 = "CREATE TABLE IF NOT EXISTS "+ Sql_Mysql.FBS9100s_fod_state +" (" +
|
" num int(11) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" BattGroupId int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éid'," +
|
" record_time datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" RestTime_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é1)'," +
|
" WorkState_one int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é1)'," +
|
" VGroupVol_one double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é1)'," +
|
" VpeakVol_one double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é1)'," +
|
" RestTime_two int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é2)'," +
|
" WorkState_two int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é2)'," +
|
" VGroupVol_two double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é2)'," +
|
" VpeakVol_two double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é2)'," +
|
" RestTime_three int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é3)'," +
|
" WorkState_three int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é3)'," +
|
" VGroupVol_three double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é3)'," +
|
" VpeakVol_three double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é3)'," +
|
" RestTime_four int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é4)'," +
|
" WorkState_four int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é4)'," +
|
" VGroupVol_four double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é4)'," +
|
" VpeakVol_four double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é4)'," +
|
" RestTime_five int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£Óàʱ¼ä(×é5)'," +
|
" WorkState_five int(11) NOT NULL DEFAULT '0' COMMENT '³ýÁò5״̬(×é5)'," +
|
" VGroupVol_five int(11) NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é5)'," +
|
" VpeakVol_five int(11) NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é5)'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY unique_battgroupid (BattGroupId) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet res = null;
|
try {
|
if(recreate) {
|
sql.sqlMysqlExecute(sql_str1);
|
}
|
sql.sqlMysqlExecute(sql_str2);
|
|
//Ìí¼ÓÊ£Óàʱ¼ä(×é1)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='RestTime_one'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN RestTime_one int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£Óàʱ¼ä(×é5)'");
|
}
|
//Ìí¼Ó³ýÁò״̬(×é1)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='WorkState_one'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN WorkState_one int(11) NOT NULL DEFAULT '0' COMMENT '³ýÁò5״̬(×é5)'");
|
}
|
//Ìí¼Ó×é¶Ëµçѹ(×é1)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VGroupVol_one'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VGroupVol_one int(11) NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é5)'");
|
}
|
//Ìí¼Ó·åÖµµçѹ(×é1)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VpeakVol_one'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VpeakVol_one int(11) NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é5)'");
|
}
|
|
//Ìí¼ÓÊ£Óàʱ¼ä(×é2)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='RestTime_two'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN RestTime_two int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£Óàʱ¼ä(×é5)'");
|
}
|
//Ìí¼Ó³ýÁò״̬(×é2)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='WorkState_two'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN WorkState_two int(11) NOT NULL DEFAULT '0' COMMENT '³ýÁò5״̬(×é5)'");
|
}
|
//Ìí¼Ó×é¶Ëµçѹ(×é2)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VGroupVol_two'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VGroupVol_two int(11) NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é5)'");
|
}
|
//Ìí¼Ó·åÖµµçѹ(×é2)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VpeakVol_two'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VpeakVol_two int(11) NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é5)'");
|
}
|
|
//Ìí¼ÓÊ£Óàʱ¼ä(×é3)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='RestTime_three'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN RestTime_three int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£Óàʱ¼ä(×é5)'");
|
}
|
//Ìí¼Ó³ýÁò״̬(×é3)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='WorkState_three'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN WorkState_three int(11) NOT NULL DEFAULT '0' COMMENT '³ýÁò5״̬(×é5)'");
|
}
|
//Ìí¼Ó×é¶Ëµçѹ(×é3)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VGroupVol_three'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VGroupVol_three int(11) NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é5)'");
|
}
|
//Ìí¼Ó·åÖµµçѹ(×é3)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VpeakVol_three'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VpeakVol_three int(11) NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é5)'");
|
}
|
|
//Ìí¼ÓÊ£Óàʱ¼ä(×é4)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='RestTime_four'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN RestTime_four int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£Óàʱ¼ä(×é5)'");
|
}
|
//Ìí¼Ó³ýÁò״̬(×é4)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='WorkState_four'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN WorkState_four int(11) NOT NULL DEFAULT '0' COMMENT '³ýÁò5״̬(×é5)'");
|
}
|
//Ìí¼Ó×é¶Ëµçѹ(×é4)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VGroupVol_four'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VGroupVol_four int(11) NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é5)'");
|
}
|
//Ìí¼Ó·åÖµµçѹ(×é4)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VpeakVol_four'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VpeakVol_four int(11) NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é5)'");
|
}
|
|
//Ìí¼ÓÊ£Óàʱ¼ä(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='RestTime_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN RestTime_five int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£Óàʱ¼ä(×é5)'");
|
}
|
//Ìí¼Ó³ýÁò״̬(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='WorkState_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN WorkState_five int(11) NOT NULL DEFAULT '0' COMMENT '³ýÁò5״̬(×é5)'");
|
}
|
//Ìí¼Ó×é¶Ëµçѹ(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VGroupVol_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VGroupVol_five int(11) NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é5)'");
|
}
|
//Ìí¼Ó·åÖµµçѹ(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='VpeakVol_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN VpeakVol_five int(11) NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é5)'");
|
}
|
//Ìí¼Óµç³Ø×éid×Ö¶Î
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_state'"
|
+ " AND column_name='BattGroupId'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100s_fod_state
|
+ " ADD COLUMN BattGroupId int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éid' AFTER dev_id");
|
}
|
//ÒÆ³ý֮ǰµÄÒÔÉ豸id·Ö×éµÄÉ豸idΨһË÷Òý
|
res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100s_fod_state+" WHERE KEY_name = 'unique_dev_id'");
|
if(res.next()) {
|
sql.sqlMysqlExecute("alter table "+Sql_Mysql.FBS9100s_fod_state+" drop index unique_dev_id;");
|
}
|
//Ìí¼Óµç³Ø×éidΪΨһË÷Òý
|
res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100s_fod_state+" WHERE KEY_name = 'unique_BattGroupId'");
|
if(!res.next()) {
|
//Ìí¼ÓΨһË÷ÒýǰÏÈɾ³ý±íÖмǼ
|
sql.sqlMysqlExecute("DELETE FROM "+Sql_Mysql.FBS9100s_fod_state+" WHERE num>0");
|
sql.sqlMysqlExecute("alter table "+Sql_Mysql.FBS9100s_fod_state+" add UNIQUE unique_BattGroupId(BattGroupId);");
|
}
|
//ÒÆ³ý֮ǰµÄÒÔÉ豸id·Ö×éµÄÉ豸idΨһË÷Òý
|
/*res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100s_fod_state+" WHERE KEY_name = 'unique_BattGroupId'");
|
if(res.next()) {
|
sql.sqlMysqlExecute("alter table "+Sql_Mysql.FBS9100s_fod_state+" drop index unique_BattGroupId;");
|
}
|
//Ìí¼ÓÐÞ¸´É豸idΪΨһË÷Òý
|
res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100s_fod_state+" WHERE KEY_name = 'unique_dev_id'");
|
if(!res.next()) {
|
//Ìí¼ÓΨһË÷ÒýǰÏÈɾ³ý±íÖмǼ
|
sql.sqlMysqlExecute("DELETE FROM "+Sql_Mysql.FBS9100s_fod_state+" WHERE num>0");
|
sql.sqlMysqlExecute("alter table "+Sql_Mysql.FBS9100s_fod_state+" add UNIQUE unique_dev_id(dev_id);");
|
}*/
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(null != res) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨³ýÁò״̬±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100SetDLParam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str1 = " DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SetDLParam_Table;
|
String sql_str2 = "CREATE TABLE IF NOT EXISTS "+ Sql_Mysql.FBS9100SetDLParam_Table +" (" +
|
" num int(11) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" test_cmd int(11) NOT NULL DEFAULT '0'," +
|
" GroupNum int(11) NOT NULL DEFAULT '0' COMMENT 'Ä£¿é±àºÅ'," +
|
" BattGroupNum int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éºÅ'," +
|
" STDCap_one int(11) NOT NULL DEFAULT '0' COMMENT '×é1±ê³ÆÈÝÁ¿'," +
|
" FloatVol_one double NOT NULL DEFAULT '0' COMMENT '×é1¸¡³äµçѹ'," +
|
" Strength_one double NOT NULL DEFAULT '0' COMMENT '×é1³ýÁòÇ¿¶È'," +
|
" YHStrength_one double NOT NULL DEFAULT '0' COMMENT '×é1Ñø»¤Ç¿¶È'," +
|
" TimeLong_one int(11) NOT NULL DEFAULT '0' COMMENT '×é1³ýÁòÌìÊý'," +
|
" STDCap_two int(11) NOT NULL DEFAULT '0' COMMENT '×é2±ê³ÆÈÝÁ¿'," +
|
" FloatVol_two double NOT NULL DEFAULT '0' COMMENT '×é2¸¡³äµçѹ'," +
|
" Strength_two double NOT NULL DEFAULT '0' COMMENT '×é2³ýÁòÇ¿¶È'," +
|
" YHStrength_two double NOT NULL DEFAULT '0' COMMENT '×é2Ñø»¤Ç¿¶È'," +
|
" TimeLong_two int(11) NOT NULL DEFAULT '0' COMMENT '×é2³ýÁòÌìÊý'," +
|
" STDCap_three int(11) NOT NULL DEFAULT '0' COMMENT '×é3±ê³ÆÈÝÁ¿'," +
|
" FloatVol_three double NOT NULL DEFAULT '0' COMMENT '×é3¸¡³äµçѹ'," +
|
" Strength_three double NOT NULL DEFAULT '0' COMMENT '×é3³ýÁòÇ¿¶È'," +
|
" YHStrength_three double NOT NULL DEFAULT '0' COMMENT '×é3Ñø»¤Ç¿¶È'," +
|
" TimeLong_three int(11) NOT NULL DEFAULT '0' COMMENT '×é3³ýÁòÌìÊý'," +
|
" STDCap_four int(11) NOT NULL DEFAULT '0' COMMENT '×é4±ê³ÆÈÝÁ¿'," +
|
" FloatVol_four double NOT NULL DEFAULT '0' COMMENT '×é4¸¡³äµçѹ'," +
|
" Strength_four double NOT NULL DEFAULT '0' COMMENT '×é4³ýÁòÇ¿¶È'," +
|
" YHStrength_four double NOT NULL DEFAULT '0' COMMENT '×é4Ñø»¤Ç¿¶È'," +
|
" TimeLong_four int(11) NOT NULL DEFAULT '0' COMMENT '×é4³ýÁòÌìÊý'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY unique_dev_id (dev_id)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet res = null;
|
try {
|
if(recreate) {
|
sql.sqlMysqlExecute(sql_str1);
|
}
|
sql.sqlMysqlExecute(sql_str2);
|
//Ìí¼Óµç³Ø×é±àºÅ×Ö¶Î
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_param'"
|
+ " AND column_name='BattGroupNum'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetDLParam_Table
|
+ " ADD COLUMN BattGroupNum int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é×éºÅ'");
|
}
|
//Ìí¼Ó±ê³ÆÈÝÁ¿(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_param'"
|
+ " AND column_name='STDCap_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetDLParam_Table
|
+ " ADD COLUMN STDCap_five int(11) NOT NULL DEFAULT '0' COMMENT '×é5±ê³ÆÈÝÁ¿'");
|
}
|
//Ìí¼Ó¸¡³äµçѹ(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_param'"
|
+ " AND column_name='FloatVol_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetDLParam_Table
|
+ " ADD COLUMN FloatVol_five double NOT NULL DEFAULT '0' COMMENT '×é5¸¡³äµçѹ'");
|
}
|
//Ìí¼Ó³ýÁòÇ¿¶È(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_param'"
|
+ " AND column_name='Strength_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetDLParam_Table
|
+ " ADD COLUMN Strength_five double NOT NULL DEFAULT '0' COMMENT '×é5³ýÁòÇ¿¶È'");
|
}
|
//Ìí¼ÓÑø»¤Ç¿¶È(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_param'"
|
+ " AND column_name='YHStrength_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetDLParam_Table
|
+ " ADD COLUMN YHStrength_five double NOT NULL DEFAULT '0' COMMENT '×é5Ñø»¤Ç¿¶È'");
|
}
|
//Ìí¼ÓÊ£Óàʱ¼ä(×é5)
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100s_fod_param'"
|
+ " AND column_name='TimeLong_five'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetDLParam_Table
|
+ " ADD COLUMN TimeLong_five int(11) NOT NULL DEFAULT '0' COMMENT '×é5³ýÁòÌìÊý'");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(null != res) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Äæ±äÐÅÏ¢±í
|
*/
|
public static void createFBS9100_NiBian_State_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100_NiBian_State;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100_NiBian_State + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id bigint(11) NOT NULL DEFAULT '0'," +
|
" nb_num bigint(11) NOT NULL DEFAULT '0'," +
|
" record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" AC_ASimVol float NOT NULL DEFAULT '0'," +
|
" AC_ASimCur float NOT NULL DEFAULT '0'," +
|
" AC_BSimVol float NOT NULL DEFAULT '0'," +
|
" AC_BSimCur float NOT NULL DEFAULT '0'," +
|
" AC_CSimVol float NOT NULL DEFAULT '0'," +
|
" AC_CSimCur float NOT NULL DEFAULT '0'," +
|
" A_HZ float NOT NULL DEFAULT '0'," +
|
" B_HZ float NOT NULL DEFAULT '0'," +
|
" C_HZ float NOT NULL DEFAULT '0'," +
|
" Power_Pa float NOT NULL DEFAULT '0'," +
|
" Power_Pb float NOT NULL DEFAULT '0'," +
|
" Power_Pc float NOT NULL DEFAULT '0'," +
|
" Power_Sa float NOT NULL DEFAULT '0'," +
|
" Power_Sb float NOT NULL DEFAULT '0'," +
|
" Power_Sc float NOT NULL DEFAULT '0'," +
|
" Temp1 float NOT NULL DEFAULT '0'," +
|
" Temp2 float NOT NULL DEFAULT '0'," +
|
" RunState float NOT NULL DEFAULT '0'," +
|
" DcACState int(11) NOT NULL DEFAULT '0'," +
|
" InsulaTionRes1 int(11) NOT NULL DEFAULT '0'," +
|
" InsulaTionRes2 int(11) NOT NULL DEFAULT '0'," +
|
" DCInputVol float NOT NULL DEFAULT '0'," +
|
" DCInputCur float NOT NULL DEFAULT '0'," +
|
" SetRun_Stop int(11) NOT NULL DEFAULT '0'," +
|
" SetDischargeCur float NOT NULL DEFAULT '0'," +
|
" CommTxCnt int(11) NOT NULL DEFAULT '0'," +
|
" CommRxCnt int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY nb_num_index (nb_num) USING HASH" +
|
") 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_socketclient_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createSocketClientStateTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.SocketClientStateTable;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.SocketClientStateTable + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" uId int(11) NOT NULL DEFAULT '0'," +
|
" client_type int(11) NOT NULL DEFAULT '0'," +
|
" client_id bigint(20) NOT NULL DEFAULT '0'," +
|
" BattGroupId int(11) NOT NULL DEFAULT '0'," +
|
" client_is_connected tinyint(1) NOT NULL DEFAULT '0'," +
|
" client_ip varchar(64) NOT NULL DEFAULT ' '," +
|
" client_conn_time datetime NOT NULL DEFAULT '1980-01-01 00:00:00'," +
|
" client_disconn_time datetime NOT NULL DEFAULT '1980-01-01 00:00:00'," +
|
" PRIMARY KEY (num)," +
|
" KEY index_user_id (uId)," +
|
" KEY index_client_type (client_type)" +
|
") 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_server_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createServerState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ServerState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ServerState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" server_version float NOT NULL DEFAULT '0'," +
|
" server_datetime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" max_mem bigint(20) NOT NULL DEFAULT '0'," +
|
" total_mem bigint(20) NOT NULL DEFAULT '0'," +
|
" free_men bigint(20) NOT NULL DEFAULT '0'," +
|
" total_disc_space bigint(20) NOT NULL DEFAULT '0'," +
|
" free_disc_space bigint(20) NOT NULL DEFAULT '0'," +
|
" db_conn_max int(11) NOT NULL DEFAULT '0'," +
|
" db_conn_count int(11) NOT NULL DEFAULT '0'," +
|
" app_conn_max int(11) NOT NULL DEFAULT '0'," +
|
" app_busy_conn_cnt int(11) NOT NULL DEFAULT '0'," +
|
" app_idle_conn_cnt int(11) NOT NULL DEFAULT '0'," +
|
" server_cpu_rate float NOT NULL DEFAULT '0'," +
|
" server_network_rate float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)" +
|
") 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_ld9_updatestatue ±í
|
* @param pool
|
* @param recreate
|
*/
|
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;";
|
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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_ld9_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createLd9_State_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Ld9_State_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Ld9_State_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '401900001'," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.1'," +
|
" record_datetime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" dev_version varchar(64) NOT NULL DEFAULT 'v1.01.01'," +
|
" sys_state int(11) NOT NULL DEFAULT '0'," +
|
" sys_online_vol float NOT NULL DEFAULT '0.01'," +
|
" sys_group_vol float NOT NULL DEFAULT '0.01'," +
|
" sys_now_battnum int(11) NOT NULL DEFAULT '1'," +
|
" sys_now_battstate int(11) NOT NULL DEFAULT '1'," +
|
" sys_now_battvol float NOT NULL DEFAULT '0.01'," +
|
" sys_now_battcurr float NOT NULL DEFAULT '0.01'," +
|
" sys_now_battcap float NOT NULL DEFAULT '0.01'," +
|
" sys_now_testtime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" sys_next_battnum int(11) NOT NULL DEFAULT '1'," +
|
" sys_next_battstate int(11) NOT NULL DEFAULT '1'," +
|
" sys_next_battvol float NOT NULL DEFAULT '0.01'," +
|
" sys_next_battcurr float NOT NULL DEFAULT '0.01'," +
|
" sys_next_battcap float NOT NULL DEFAULT '0.01'," +
|
" sys_next_testtime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" sys_tmp float NOT NULL DEFAULT '0.1'," +
|
" sys_stop_reason int(11) NOT NULL DEFAULT '1'," +
|
" dev_commcount int(11) NOT NULL DEFAULT '0'," +
|
" dev_errcommcount int(11) NOT NULL DEFAULT '0'," +
|
" timelong int(11) NOT NULL DEFAULT '0'," +
|
" monvol_hightalarm int(11) NOT NULL DEFAULT '0'," +
|
" monvol_loweralarm int(11) NOT NULL DEFAULT '0'," +
|
" moncap_alarm int(11) NOT NULL DEFAULT '0'," +
|
" montmp_alarm int(11) NOT NULL DEFAULT '0'," +
|
" monres_alarm int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id (dev_id)" +
|
") ENGINE=InnoDB 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_ld9_setparam ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createLd9_Setparam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Ld9_Setparam_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Ld9_Setparam_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '401900001'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" param_teststart_batt_num int(11) NOT NULL DEFAULT '0'," +
|
" param_cap int(11) NOT NULL DEFAULT '1'," +
|
" param_discharge_curr float NOT NULL DEFAULT '0.001'," +
|
" param_mon_curr_high float NOT NULL DEFAULT '0.001'," +
|
" param_charge_curr float NOT NULL DEFAULT '0.001'," +
|
" param_mon_curr_low float NOT NULL DEFAULT '0.001'," +
|
" param_online_vol float NOT NULL DEFAULT '0.01'," +
|
" param_charge_curr_low float NOT NULL DEFAULT '0.001'," +
|
" param_charge_cap_low float NOT NULL DEFAULT '0.1'," +
|
" param_online_vol_recover int(11) NOT NULL DEFAULT '0'," +
|
" param_module_address int(11) NOT NULL DEFAULT '1'," +
|
" param_junheng_model int(11) NOT NULL DEFAULT '0'," +
|
" param_cap_low float NOT NULL DEFAULT '0'," +
|
" param_datasource int(11) NOT NULL DEFAULT '0'," +
|
" param_res_args int(11) NOT NULL DEFAULT '0'," +
|
" param_tmp_high float NOT NULL DEFAULT '0'," +
|
" param_res_high float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id (dev_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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_ld9_setparam ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createLd9_Concentratestate_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Ld9_Concentratestate_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Ld9_Concentratestate_Table + " (" +
|
" num int(11) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" systemVersion varchar(255) NOT NULL DEFAULT '' COMMENT 'ϵͳ°æ±¾'," +
|
" systemState int(11) NOT NULL DEFAULT '0' COMMENT 'ϵͳ״̬'," +
|
" groupVol float NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ'," +
|
" groupCurr float NOT NULL DEFAULT '0' COMMENT '×é¶ËµçÁ÷'," +
|
" battState int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×´Ì¬'," +
|
" currDirection int(11) NOT NULL DEFAULT '0' COMMENT 'µçÁ÷·½Ïò'," +
|
" rippleCurrAvg float NOT NULL DEFAULT '0' COMMENT 'ÎÆ²¨µçÁ÷¾ùÖµ'," +
|
" rippleCurrTop float NOT NULL DEFAULT '0' COMMENT 'ÎÆ²¨µçÁ÷·åÖµ'," +
|
" resTestCount int(11) NOT NULL DEFAULT '0' COMMENT 'ÄÚ×è²âÊÔ´ÎÊý'," +
|
" resTestMethod int(11) NOT NULL DEFAULT '0' COMMENT 'ÄÚ×è²âÊÔ·½·¨'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY unique_dev_id (dev_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();
|
}
|
}
|
|
|
/**
|
* ´´½¨ tb_ld9_concentrateparam ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createLd9_Concentrateparam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Ld9_Concentrateparam_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Ld9_Concentrateparam_Table + " (" +
|
" num int(11) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0' COMMENT 'ÃüÁî¿ØÖÆ×Ö¶Î'," +
|
" addr int(11) NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷µØÖ·£¨0-2555£©'," +
|
" firthMonCount int(11) NOT NULL DEFAULT '0' COMMENT 'µÚһ·µ¥Ìå¸öÊý'," +
|
" secondMonCount int(11) NOT NULL DEFAULT '0' COMMENT 'µÚ¶þ·µ¥Ìå¸öÊý'," +
|
" thirdMonCount int(11) NOT NULL DEFAULT '0' COMMENT 'µÚÈý·µ¥Ìå¸öÊý'," +
|
" fourthMonCount int(11) NOT NULL DEFAULT '0' COMMENT 'µÚËÄ·µ¥Ìå¸öÊý'," +
|
" fifthMonCount int(11) NOT NULL DEFAULT '0' COMMENT 'µÚÎå·µ¥Ìå¸öÊý'," +
|
" currRange int(11) NOT NULL DEFAULT '0' COMMENT 'µçÁ÷ǯÁ¿³Ì'," +
|
" floatCurrLimit float NOT NULL DEFAULT '0' COMMENT '¸¡³äµçÁ÷ÃÅÏÞ'," +
|
" rippleCurrLimit float NOT NULL DEFAULT '0' COMMENT 'ÎÆ²¨µçÁ÷·§Öµ'," +
|
" autoTestCycle int(11) NOT NULL DEFAULT '1' COMMENT '×Ô¶¯²âÊÔÖÜÆÚ'," +
|
" resTestType int(11) NOT NULL DEFAULT '0' COMMENT 'ÄÚ×è²âÊÔ·½·¨'," +
|
" dischargeType int(11) NOT NULL DEFAULT '0' COMMENT '·Åµçģʽ'," +
|
" battCapStd int(11) NOT NULL DEFAULT '0' COMMENT '±ê³ÆÈÝÁ¿'," +
|
" backup1 int(11) NOT NULL DEFAULT '0' COMMENT '±¸ÓÃ1'," +
|
" backup2 int(11) NOT NULL DEFAULT '0' COMMENT '±¸ÓÃ2'," +
|
" backup3 int(11) NOT NULL DEFAULT '0' COMMENT '±¸ÓÃ3'," +
|
" backup4 int(11) NOT NULL DEFAULT '0' COMMENT '±¸ÓÃ4'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY unique_dev_id (dev_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();
|
}
|
}
|
|
|
/**
|
* ´´½¨ tb_hard_dev_sms_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createHardDevSmsState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.HardDevSmsState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.HardDevSmsState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" sms_dev_ip varchar(20) NOT NULL DEFAULT '192.168.1.60'," +
|
" sms_ack_type int(11) NOT NULL DEFAULT '0'," +
|
" sms_sincard_ok tinyint(1) NOT NULL DEFAULT '0'," +
|
" sms_mobile_net_ok tinyint(1) NOT NULL DEFAULT '0'," +
|
" sms_sinal_value int(11) NOT NULL DEFAULT '0'," +
|
" sms_is_busy tinyint(1) NOT NULL DEFAULT '0'," +
|
" sms_money_rest float NOT NULL DEFAULT '0'," +
|
" sms_com_count int(11) NOT NULL DEFAULT '0'," +
|
" sms_com_err_count int(11) NOT NULL DEFAULT '0'," +
|
" note varchar(100) NOT NULL DEFAULT ' '," +
|
" PRIMARY KEY (num)" +
|
") ENGINE=MEMORY 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9600_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9600State_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9600State_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9600State_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" dev_workstate int(11) NOT NULL DEFAULT '0'," +
|
" dev_alarmstate int(11) NOT NULL DEFAULT '0'," +
|
" dev_commcount int(11) NOT NULL DEFAULT '0'," +
|
" dev_errcommcount int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100s_dfu_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100S_DFUState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100S_DFUState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100S_DFUState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" sysVersion_new int(11) NOT NULL DEFAULT '0'," +
|
" softVersion_new int(11) NOT NULL DEFAULT '0'," +
|
" sysVersion_dev int(11) NOT NULL DEFAULT '0'," +
|
" softVersion_dev int(11) NOT NULL DEFAULT '0'," +
|
" dfu_file varchar(200) NOT NULL DEFAULT ' '," +
|
" dfu_en tinyint(1) NOT NULL DEFAULT '0'," +
|
" dfu_wr_stat int(11) NOT NULL DEFAULT '0'," +
|
" dfu_data_blocknum int(11) NOT NULL DEFAULT '0'," +
|
" dfu_data_blocklen int(11) NOT NULL DEFAULT '256'," +
|
" dfu_password varchar(100) NOT NULL DEFAULT ' '," +
|
" dfu_file_len int(11) NOT NULL," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_id)" +
|
") ENGINE=InnoDB 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100s_dcdc_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100S_DcDcState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100S_DcDcState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100S_DcDcState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" dcdc_num bigint(20) NOT NULL DEFAULT '0'," +
|
" dcdc_Vsys float NOT NULL DEFAULT '0'," +
|
" dcdc_Vout float NOT NULL DEFAULT '0'," +
|
" dcdc_Vbat float NOT NULL DEFAULT '0'," +
|
" dcdc_Iout float NOT NULL DEFAULT '0'," +
|
" dcdc_Ibuck float NOT NULL DEFAULT '0'," +
|
" dcdc_Tmp_Dis float NOT NULL DEFAULT '0'," +
|
" dcdc_Tmp_Chr float NOT NULL DEFAULT '0'," +
|
" dcdc_SMR_Alarm1 int(11) NOT NULL DEFAULT '0'," +
|
" dcdc_SMR_Alarm2 int(11) NOT NULL DEFAULT '0'," +
|
" dcdc_version int(11) NOT NULL DEFAULT '0'," +
|
" dcdc_ModeSetComm int(11) NOT NULL DEFAULT '0'," +
|
" dcdc_RunSetComm int(11) NOT NULL DEFAULT '0'," +
|
" dcdc_BuckISet float NOT NULL DEFAULT '0'," +
|
" dcdc_DisVolSet float NOT NULL DEFAULT '0'," +
|
" dcdc_DisCurrSet float NOT NULL DEFAULT '0'," +
|
" dcdc_CommTxCnt int(11) NOT NULL DEFAULT '0'," +
|
" dcdc_CommRxCnt int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dcdc_num_uniq (dcdc_num)" +
|
") ENGINE=MEMORY 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100_sysparam ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100SysParam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100SysParam_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SysParam_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" IPADDR varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" SubIPADDR varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" NetGateADDR varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" GroupVolRange int(11) NOT NULL DEFAULT '0'," +
|
" GroupVolSorce int(11) NOT NULL DEFAULT '0'," +
|
" CurrentRange int(11) NOT NULL DEFAULT '0'," +
|
" CurrentTyte int(11) NOT NULL DEFAULT '0'," +
|
" MonomerOrder int(11) NOT NULL DEFAULT '0'," +
|
" BackLightTime int(11) NOT NULL DEFAULT '0'," +
|
" MACADDR varchar(30) NOT NULL DEFAULT '0.0.0.0.0.0'," +
|
" LoaderCount int(11) NOT NULL DEFAULT '0'," +
|
" DtCardCount int(11) NOT NULL DEFAULT '0'," +
|
" PowerBreakChargeCurr float NOT NULL DEFAULT '0'," +
|
" MajorBattGroupNum int(11) NOT NULL DEFAULT '0'," +
|
" POF_BG_Boost_Cnt int(11) NOT NULL DEFAULT '0'," +
|
" POF_BG_Boost_VolStop float NOT NULL DEFAULT '0'," +
|
" POF_BG_Boost_VolStart float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_id)" +
|
") ENGINE=InnoDB 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100State_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100State_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100State_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" dev_version varchar(64) NOT NULL DEFAULT ''," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" record_datetime varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" dev_datetime varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" dev_testtype int(11) NOT NULL DEFAULT '0'," +
|
" dev_testgroupnum int(11) NOT NULL DEFAULT '0'," +
|
" dev_workstate int(11) NOT NULL DEFAULT '0'," +
|
" dev_alarmstate int(11) NOT NULL DEFAULT '0'," +
|
" dev_onlinevollow tinyint(1) NOT NULL DEFAULT '0'," +
|
" dev_eachgroup_battsum int(11) NOT NULL DEFAULT '0'," +
|
" dev_captest_onlinevol float NOT NULL DEFAULT '0'," +
|
" dev_captest_groupvol float NOT NULL DEFAULT '0'," +
|
" dev_captest_curr float NOT NULL DEFAULT '0'," +
|
" dev_captest_cap float NOT NULL DEFAULT '0'," +
|
" dev_captest_timelong int(11) NOT NULL DEFAULT '0'," +
|
" dev_restest_moncount int(11) NOT NULL DEFAULT '0'," +
|
" dev_restest_monindex int(11) NOT NULL DEFAULT '0'," +
|
" dev_commcount int(11) NOT NULL DEFAULT '0'," +
|
" dev_errcommcount int(11) NOT NULL DEFAULT '0'," +
|
" dev_rxnullerrcount int(11) NOT NULL DEFAULT '0'," +
|
" dev_temp float NOT NULL DEFAULT '0'," +
|
" dev_res_test_state int(11) NOT NULL DEFAULT '0'," +
|
" dev_restest_count int(11) NOT NULL DEFAULT '0'," +
|
" dev_last_captest_stop_type int(11) NOT NULL DEFAULT '0'," +
|
" dev_condvoldp float NOT NULL DEFAULT '0'," +
|
" dev_conresist float NOT NULL DEFAULT '0'," +
|
" dev_conresist1 float NOT NULL DEFAULT '0'," +
|
" dev_condcurr float NOT NULL DEFAULT '0'," +
|
" dev_61850alarms varchar(64) NOT NULL DEFAULT ''," +
|
" dev_batt_xuhang_tlong int(11) NOT NULL DEFAULT '0'," +
|
" dev_station_poff_tlong int(11) NOT NULL DEFAULT '0'," +
|
" dev_station_poff_cnt int(11) NOT NULL DEFAULT '0'," +
|
" dev_data_flowsum bigint(20) NOT NULL DEFAULT '0'," +
|
" batt_online_state int(11) NOT NULL DEFAULT '0'," +
|
" dev_concurr float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_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();
|
}
|
}
|
|
|
/**
|
* ´´½¨ tb_fbs9100_setparam ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100SetParam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100SetParam_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SetParam_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" TestCmd int(11) NOT NULL DEFAULT '0'," +
|
" HourRate int(11) NOT NULL DEFAULT '0'," +
|
" DisCurr float NOT NULL DEFAULT '0'," +
|
" DisCap float NOT NULL DEFAULT '0'," +
|
" DisTime int(11) NOT NULL DEFAULT '0'," +
|
" GroupVol_LOW float NOT NULL DEFAULT '0'," +
|
" MonomerVol_LOW float NOT NULL DEFAULT '0'," +
|
" MonomerLowCount int(11) NOT NULL DEFAULT '0'," +
|
" BattGroupNum int(11) NOT NULL DEFAULT '0'," +
|
" OnlineVolLowAction int(11) NOT NULL DEFAULT '0'," +
|
" DCVolHighLimit float NOT NULL DEFAULT '0'," +
|
" ChargeCurrSet float NOT NULL DEFAULT '0'," +
|
" MonomerTmp_High float NOT NULL DEFAULT '0'," +
|
" AutoTestStartVol float NOT NULL DEFAULT '0'," +
|
" OnLineVol_Low float NOT NULL DEFAULT '0'," +
|
" OffLineYH_Cycle int(11) NOT NULL DEFAULT '0'," +
|
" OffLineYHstarttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" OffLineYHTimes int(11) NOT NULL DEFAULT '1'," +
|
" OffLineYHOnceCycle int(11) NOT NULL DEFAULT '1'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_id)" +
|
") ENGINE=MEMORY 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100_offlineyhplan ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100_offlineyhplan_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100_offlineyhplan;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100_offlineyhplan + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '1'," +
|
" OffLineYH_Cycle int(11) NOT NULL DEFAULT '1'," +
|
" OffLineYHstarttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" OffLineYHTimes int(11) NOT NULL DEFAULT '0'," +
|
" OffLineYHOnceCycle int(11) NOT NULL DEFAULT '0'," +
|
" note varchar(255) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (num)" +
|
") ENGINE=InnoDB 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();
|
}
|
}
|
/**
|
* ´´½¨ tb_fbs9100_battparam ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100BattParam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100BattParam_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100BattParam_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" STD_CAP int(11) NOT NULL DEFAULT '0'," +
|
" STD_RES int(11) NOT NULL DEFAULT '0'," +
|
" BattGroupCount int(11) NOT NULL DEFAULT '0'," +
|
" EachGroupBattCount int(11) NOT NULL DEFAULT '0'," +
|
" MonomerVol float NOT NULL DEFAULT '0'," +
|
" GroupVol float NOT NULL DEFAULT '0'," +
|
" BattTemp float NOT NULL DEFAULT '0'," +
|
" FloatChargeVol float NOT NULL DEFAULT '0'," +
|
" FloatChargeCurr float NOT NULL DEFAULT '0'," +
|
" OnlineVolLow float NOT NULL DEFAULT '0'," +
|
" GroupConnType int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_id)" +
|
") ENGINE=MEMORY 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();
|
}
|
}
|
/**
|
* ´´½¨ tb_bts_station_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createBTSStationState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BTSStationState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSStationState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" station_id bigint(20) NOT NULL DEFAULT '0'," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" record_datetime varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_stat int(11) NOT NULL DEFAULT '0'," +
|
" station_poff_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_fadian_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_diaozhan_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_temp float NOT NULL DEFAULT '0'," +
|
" station_damp float NOT NULL DEFAULT '0'," +
|
" station_dooropen_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_xuhang_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_xuhang_end_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_station_id_uniq (station_id)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=11 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();
|
}
|
}
|
/**
|
* ´´½¨ tb_bts_gprs_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createBTSGPRSState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BTSGPRSState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSGPRSState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" station_id bigint(20) NOT NULL DEFAULT '0'," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" record_datetime varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_stat int(11) NOT NULL DEFAULT '0'," +
|
" station_poff_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_fadian_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_diaozhan_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_temp float NOT NULL DEFAULT '0'," +
|
" station_damp float NOT NULL DEFAULT '0'," +
|
" station_dooropen_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_xuhang_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" station_xuhang_end_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_station_id_uniq (station_id)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=11 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();
|
}
|
}
|
/**
|
* ´´½¨ tb_bpm7100_state ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createBMP7100State_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BMP7100State_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BMP7100State_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_ip varchar(20) NOT NULL DEFAULT '127.0.0.0'," +
|
" dev_id int(11) NOT NULL DEFAULT '0'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0'," +
|
" dev_workstate int(11) NOT NULL DEFAULT '0'," +
|
" dev_worktime bigint(20) NOT NULL DEFAULT '0'," +
|
" dev_commcount int(11) NOT NULL DEFAULT '0'," +
|
" dev_errcommcount int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)" +
|
") ENGINE=MEMORY 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_batt_rtstate ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createBattRtState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattRtState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattRtState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" BattGroupId int(11) NOT NULL DEFAULT '0'," +
|
" batt_count int(11) NOT NULL DEFAULT '0'," +
|
" rec_datetime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" online_vol float NOT NULL DEFAULT '0'," +
|
" group_vol float NOT NULL DEFAULT '0'," +
|
" group_tmp float NOT NULL DEFAULT '0'," +
|
" group_curr float NOT NULL DEFAULT '0'," +
|
" batt_state int(11) NOT NULL DEFAULT '0'," +
|
" batt_test_type int(11) NOT NULL DEFAULT '0'," +
|
" batt_test_starttime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" batt_test_recordtime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" batt_test_tlong int(11) NOT NULL DEFAULT '0'," +
|
" batt_test_cap float NOT NULL DEFAULT '0'," +
|
" batt_real_cap float NOT NULL DEFAULT '0'," +
|
" batt_rest_cap float NOT NULL DEFAULT '0'," +
|
" batt_rest_power1_time int(11) NOT NULL DEFAULT '0'," +
|
" batt_rest_power2_time int(11) NOT NULL DEFAULT '0'," +
|
" test_loadertype int(11) NOT NULL DEFAULT '0'," +
|
" test_recordnum int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" KEY index_BattGroupId (BattGroupId)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=8 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();
|
}
|
}
|
/**
|
* ´´½¨ tb_batt_rtdata ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createBattRtData_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattRtData_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattRtData_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" BattGroupId int(11) NOT NULL DEFAULT '0'," +
|
" rec_datetime datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" mon_num int(11) NOT NULL DEFAULT '0'," +
|
" mon_vol float NOT NULL DEFAULT '0'," +
|
" mon_tmp float NOT NULL DEFAULT '0'," +
|
" mon_res float NOT NULL DEFAULT '0'," +
|
" mon_ser float NOT NULL DEFAULT '0'," +
|
" mon_conn_res float NOT NULL DEFAULT '0'," +
|
" mon_cap float NOT NULL DEFAULT '0'," +
|
" mon_JH_curr float NOT NULL DEFAULT '0'," +
|
" mon_LY_vol float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" KEY index_BattGroupId (BattGroupId)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=347 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();
|
}
|
}
|
/**
|
* ´´½¨ tb_61850_jhstate ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void create61850_JHState_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.TB_61850_JHState_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.TB_61850_JHState_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0'," +
|
" dev_version varchar(255) NOT NULL DEFAULT ''," +
|
" input_vol_total double NOT NULL DEFAULT '0'," +
|
" output_vol_total double NOT NULL DEFAULT '0'," +
|
" input_curr_total double NOT NULL DEFAULT '0'," +
|
" output_curr_total double NOT NULL DEFAULT '0'," +
|
" output_vol_one double NOT NULL DEFAULT '0'," +
|
" output_vol_two double NOT NULL DEFAULT '0'," +
|
" output_vol_three double NOT NULL DEFAULT '0'," +
|
" output_vol_four double NOT NULL DEFAULT '0'," +
|
" output_vol_five double NOT NULL DEFAULT '0'," +
|
" output_vol_six double NOT NULL DEFAULT '0'," +
|
" output_vol_seven double NOT NULL DEFAULT '0'," +
|
" output_vol_eight double NOT NULL DEFAULT '0'," +
|
" output_vol_nine double NOT NULL DEFAULT '0'," +
|
" output_vol_ten double NOT NULL DEFAULT '0'," +
|
" dev_temp double NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_unique (dev_id) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=9046 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();
|
}
|
}
|
/**
|
* ´´½¨ cmcc_power_data ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createRamDB_CMCC_POWER_Data_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.RamDB_CMCC_POWER_Data;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.RamDB_CMCC_POWER_Data + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id bigint(20) NOT NULL DEFAULT '0'," +
|
" vol1 float NOT NULL DEFAULT '0'," +
|
" vol2 float NOT NULL DEFAULT '0'," +
|
" vol3 float NOT NULL DEFAULT '0'," +
|
" vol4 float NOT NULL DEFAULT '0'," +
|
" vol5 float NOT NULL DEFAULT '0'," +
|
" curr1 float NOT NULL DEFAULT '0'," +
|
" curr2 float NOT NULL DEFAULT '0'," +
|
" curr3 float NOT NULL DEFAULT '0'," +
|
" curr4 float NOT NULL DEFAULT '0'," +
|
" curr5 float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (num)," +
|
" UNIQUE KEY index_dev_id_uniq (dev_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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100_insulatstate ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100_InsulatstateTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100_InsulatstateTable;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100_InsulatstateTable + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," +
|
" `PowerDeviceId` int(11) NOT NULL DEFAULT '1' COMMENT 'µçÔ´id'," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éid'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `dev_version` varchar(64) NOT NULL DEFAULT '' COMMENT 'Ðת°æ±¾ºÅ'," +
|
" `insulat_system_vol` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿éϵͳµçѹ'," +
|
" `insulat_ground_vol` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿éÕý¶ÔµØµçѹ'," +
|
" `insulat_negative_vol` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é¸º¶ÔµØµçѹ'," +
|
" `insulat_ground_res` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿éÕý¶ÔµØµç×è'," +
|
" `insulat_negative_res` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é¸º¶ÔµØµç×è'," +
|
" `insulat_batt_res` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿éµç³Ø¶ÔµØµç×è'," +
|
" `insulat_fault_num` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é¹ÊÕÏµç³Ø½ÚÊý'," +
|
" `insulat_ac_vol` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½»Á÷µçѹ'," +
|
" `insulat_system_state` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿éϵͳ״̬'," +
|
" `insulat_record_state` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é˲ʱ¼Ç¼״̬'," +
|
" `insulat_state` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é×°ÖÃ״̬'," +
|
" `insulat_branch_num_1` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é1)'," +
|
" `insulat_branch_res_is_1` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é1)'," +
|
" `insulat_branch_res_ne_1` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é1)'," +
|
" `insulat_branch_num_2` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é2)'," +
|
" `insulat_branch_res_is_2` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é2)'," +
|
" `insulat_branch_res_ne_2` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é2)'," +
|
" `insulat_branch_num_3` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é3)'," +
|
" `insulat_branch_res_is_3` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é3)'," +
|
" `insulat_branch_res_ne_3` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é3)'," +
|
" `insulat_branch_num_4` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é4)'," +
|
" `insulat_branch_res_is_4` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é4)'," +
|
" `insulat_branch_res_ne_4` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é4)'," +
|
" `insulat_branch_num_5` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é5)'," +
|
" `insulat_branch_res_is_5` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é5)'," +
|
" `insulat_branch_res_ne_5` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é5)'," +
|
" `insulat_branch_num_6` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é6)'," +
|
" `insulat_branch_res_is_6` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é6)'," +
|
" `insulat_branch_res_ne_6` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é6)'," +
|
" `insulat_branch_num_7` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é7)'," +
|
" `insulat_branch_res_is_7` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é7)'," +
|
" `insulat_branch_res_ne_7` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é7)'," +
|
" `insulat_branch_num_8` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é8)'," +
|
" `insulat_branch_res_is_8` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é8)'," +
|
" `insulat_branch_res_ne_8` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é8)'," +
|
" `insulat_branch_num_9` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é9)'," +
|
" `insulat_branch_res_is_9` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é9)'," +
|
" `insulat_branch_res_ne_9` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é9)'," +
|
" `insulat_branch_num_10` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é10)'," +
|
" `insulat_branch_res_is_10` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é10)'," +
|
" `insulat_branch_res_ne_10` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é10)'," +
|
" `insulat_branch_num_11` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é11)'," +
|
" `insulat_branch_res_is_11` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é11)'," +
|
" `insulat_branch_res_ne_11` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é11)'," +
|
" `insulat_branch_num_12` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é12)'," +
|
" `insulat_branch_res_is_12` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é12)'," +
|
" `insulat_branch_res_ne_12` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é12)'," +
|
" `insulat_branch_num_13` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é13)'," +
|
" `insulat_branch_res_is_13` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é13)'," +
|
" `insulat_branch_res_ne_13` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é13)'," +
|
" `insulat_branch_num_14` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é14)'," +
|
" `insulat_branch_res_is_14` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é14)'," +
|
" `insulat_branch_res_ne_14` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é14)'," +
|
" `insulat_branch_num_15` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é15)'," +
|
" `insulat_branch_res_is_15` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é15)'," +
|
" `insulat_branch_res_ne_15` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é15)'," +
|
" `insulat_branch_num_16` int(11) NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é½ÓµØÖ§Â·ºÅ(Ä£¿é12)'," +
|
" `insulat_branch_res_is_16` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·Õý¶ÔµØµç×è(Ä£¿é12)'," +
|
" `insulat_branch_res_ne_16` float NOT NULL DEFAULT '0' COMMENT '¾øÔµ¼à²âÄ£¿é֧·¸º¶ÔµØµç×è(Ä£¿é12)'," +
|
" `note` varchar(32) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (`num`,`PowerDeviceId`)," +
|
" KEY `index_PowerDeviceId` (`PowerDeviceId`) USING BTREE," +
|
" KEY `index_battgroupid` (`BattGroupId`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=4 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);
|
//ÒÆ³ý֮ǰµÄÒÔµç³Ø×éidÉèÖõÄΨһË÷Òý
|
res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100_InsulatstateTable+" WHERE KEY_name = 'unique_battgroupid'");
|
if(res.next()) {
|
sql.sqlMysqlExecute("alter table "+Sql_Mysql.FBS9100_InsulatstateTable+" drop index unique_battgroupid;");
|
}
|
//Ìí¼Ó×Ö¶ÎPowerDeviceId
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100_insulatstate'"
|
+ " AND column_name='PowerDeviceId'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100_InsulatstateTable
|
+ " ADD COLUMN `PowerDeviceId` int(11) NOT NULL DEFAULT '1' COMMENT 'µçÔ´id'");
|
}
|
//Ìí¼Ó×Ö¶Îdev_version
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100_insulatstate'"
|
+ " AND column_name='dev_version'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100_InsulatstateTable
|
+ " ADD COLUMN `dev_version` varchar(64) NOT NULL DEFAULT '' COMMENT 'Ðת°æ±¾ºÅ';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(null != res) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100_collectionstate ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100_CollectionstateTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100_CollectionstateTable;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100_CollectionstateTable + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éID'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `col_version` float NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷°æ±¾'," +
|
" `col_state` int(11) NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷״̬'," +
|
" `col_vol` float NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷×éµçѹ'," +
|
" `col_curr` float NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷×éµçÁ÷'," +
|
" `col_batt_state` int(11) NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷µç³Ø×´Ì¬'," +
|
" `col_curr_dir` float NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷µçÁ÷·½Ïò'," +
|
" `col_mean_rip_curr` float NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷ÎÆ²¨µçÁ÷¾ùÖµ'," +
|
" `col_peak_rip_curr` float NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷ÎÆ²¨µçÁ÷·åÖµ'," +
|
" `col_restest_count` int(11) NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷ÄÚ×è²âÊÔ´ÎÊý'," +
|
" `col_restest_type` int(11) NOT NULL DEFAULT '0' COMMENT '»ã¼¯Æ÷ÄÚ×è²âÊÔ·½·¨'," +
|
" `note` varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `unique_battgroupid` (`BattGroupId`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=4 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();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_lithium_data ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createTb_Lithium_DataTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Lithium_DataTable;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Lithium_DataTable + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '1000001' COMMENT 'µç³Ø×éID'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `envir_tmp` float NOT NULL DEFAULT '0' COMMENT '»·¾³Î¶È'," +
|
" `power_tmp` float NOT NULL DEFAULT '0' COMMENT '¹¦ÂÊζÈ'," +
|
" `rest_cap` float NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÈÝÁ¿'," +
|
" `remote_control_count` int(11) NOT NULL DEFAULT '0' COMMENT '×Ô¶¨ÒåÒ£¿ØÊýÁ¿'," +
|
" `batt_total_cap` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×ÜÈÝÁ¿'," +
|
" `batt_cycles` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³ØÑ»·´ÎÊý'," +
|
" `evir_tmp_alm_state` int(11) NOT NULL DEFAULT '0' COMMENT '»·¾³Î¶ȸ澯״̬'," +
|
" `power_tmp_alm_state` int(11) NOT NULL DEFAULT '0' COMMENT '¹¦ÂÊζȸ澯״̬'," +
|
" `discharge_curr_alm_state` int(11) NOT NULL DEFAULT '0' COMMENT '³ä·ÅµçµçÁ÷¸æ¾¯×´Ì¬'," +
|
" `batt_totalvol_alm_state` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×ܵçѹ¸æ¾¯×´Ì¬'," +
|
" `custom_alm_count` int(11) NOT NULL DEFAULT '0' COMMENT '×Ô¶¨Ò叿¾¯Á¿ÊýÁ¿'," +
|
" `junheng_event_code` int(11) NOT NULL DEFAULT '0' COMMENT '¾ùºâʼþ´úÂë'," +
|
" `vol_event_code` int(11) NOT NULL DEFAULT '0' COMMENT 'µçѹʼþ´úÂë'," +
|
" `tmp_event_code` int(11) NOT NULL DEFAULT '0' COMMENT 'ζÈʼþ´úÂë'," +
|
" `curr_event_code` int(11) NOT NULL DEFAULT '0' COMMENT 'µçÁ÷ʼþ´úÂë'," +
|
" `fet_state_code` int(11) NOT NULL DEFAULT '0' COMMENT 'FET״̬´úÂë'," +
|
" `junheng_state_code` int(11) NOT NULL DEFAULT '0' COMMENT '¾ùºâ״̬´úÂë'," +
|
" `sys_state_code` int(11) NOT NULL DEFAULT '0' COMMENT 'ϵͳ״̬´úÂë'," +
|
" `note` varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB 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();
|
}
|
}
|
|
/**
|
* ´´½¨×é¶ËÐÅÏ¢¸æ¾¯¼Ç¼±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createTb_Batt_RSAlarm_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Batt_RSAlarm_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Batt_RSAlarm_Table + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '1000001' COMMENT 'µç³Ø×éID'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `groupvol_alm` tinyint(4) NOT NULL DEFAULT '0' COMMENT '×éµçѹ¸æ¾¯'," +
|
" `test_end_vol` float NOT NULL DEFAULT '0' COMMENT '²âÊÔÖÕÖ¹µçѹ'," +
|
" `test_end_cap` float NOT NULL DEFAULT '0' COMMENT '²âÊÔÖÕֹʣÓàÈÝÁ¿'," +
|
" `test_timelong` int(11) NOT NULL DEFAULT '0' COMMENT '²âÊÔÖÕֹʱ¼ä(Ãë)'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_BattGroupId` (`BattGroupId`) USING BTREE," +
|
" KEY `index_record_time` (`record_time`) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
|
try {
|
if(true == recreate) {
|
sql.sqlMysqlExecute(sql_str01);
|
}
|
//System.out.println(sql_str02);
|
sql.sqlMysqlExecute(sql_str02);
|
//Ìí¼Óδ¼Èëµç³Ø×éµÄ×é¶ËÐÅÏ¢
|
String sql_str03 = "INSERT INTO " + Sql_Mysql.Tb_Batt_RSAlarm_Table + " (BattGroupId)" +
|
" SELECT BattGroupId FROM " + Sql_Mysql.BattInf_Table +
|
" WHERE BattGroupId NOT IN (SELECT BattGroupId FROM " + Sql_Mysql.Tb_Batt_RSAlarm_Table + ")";
|
//System.out.println(sql_str03);
|
sql.sqlMysqlExecute(sql_str03);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨µ¥ÌåÐÅÏ¢¸æ¾¯¼Ç¼±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createTb_Batt_RTAlarm_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Batt_RTAlarm_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Batt_RTAlarm_Table + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '1000001' COMMENT 'µç³Ø×éid'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `mon_num` int(11) NOT NULL DEFAULT '0' COMMENT 'µ¥Ìå±àºÅ'," +
|
" `monvol_alm` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'µ¥Ìåµçѹ¸æ¾¯'," +
|
" `montmp_alm` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'µ¥Ìåζȸ澯'," +
|
" `monres_alm` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÄÚ×è¸æ¾¯'," +
|
" `monrestcap_alm` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÊ£ÓàÈÝÁ¿¸æ¾¯'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_BattGroupId` (`BattGroupId`) USING BTREE," +
|
" KEY `index_record_time` (`record_time`) USING BTREE" +
|
") 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);
|
|
ResultSet res_t = sql.sqlMysqlQuery("SELECT BattGroupId,MonCount FROM " + Sql_Mysql.BattInf_Table);
|
while(res_t.next()) {
|
int bg_id = res_t.getInt("BattGroupId");
|
int mon_cnt = res_t.getInt("MonCount");
|
|
if(mon_cnt > 0){
|
|
int max_monnum = BattData_RT_RamDB_Thread_SQL.seachBattRTAlarmMaxMonNum(pool,bg_id); //µ±Ç°µç³Ø×éÔÚ tb_batt_rtdata ±íÖеÄ×î´óµ¥Ìå¸öÊý
|
if(mon_cnt > max_monnum){
|
//ÐèÒª´Ómax_monnum¿ªÊ¼Ìí¼Óµ¥Ìå¼Ç¼
|
String sql_str2 = "INSERT INTO " + Sql_Mysql.Tb_Batt_RTAlarm_Table + "(BattGroupId, mon_num)" + " VALUES ";
|
boolean isStart = true;
|
for(int mc = max_monnum; mc < mon_cnt; mc++) {
|
if(isStart) {
|
isStart = false;
|
}else{
|
sql_str2 += ",";
|
}
|
sql_str2 += "(" + bg_id + "," + (mc+1) + ")";
|
}
|
System.out.println("µç³Ø×é"+bg_id+"´Óµ¥Ìå"+(max_monnum+1)+"¿ªÊ¼ÔÚtb_batt_rtdata±íÖÐÌí¼Óµ¥ÌåÊý¾Ý at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
sql.sqlMysqlExecute(sql_str2);
|
}else if(mon_cnt < max_monnum){
|
//ɾ³ýµ±Ç°µç³Ø×éÖг¬¹ýµ¥Ìå¸öÊýµÄÊý¾Ý
|
String sql_str2 = " DELETE FROM " + Sql_Mysql.Tb_Batt_RTAlarm_Table + " WHERE BattGroupId = " +bg_id+ " AND mon_num > "+mon_cnt;
|
sql.sqlMysqlExecute(sql_str2);
|
System.out.println("µç³Ø×é"+bg_id+"´Óµ¥Ìå"+(mon_cnt+1)+"¿ªÊ¼É¾³ýtb_batt_rtdataµ¥ÌåÊý¾Ý at "+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
}
|
}
|
}
|
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
|
/**
|
* ´´½¨ tb_fbs9100_chargerstate ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFBS9100_ChargerstateTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100_ChargerstateTable;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100_ChargerstateTable + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," +
|
" `PowerDeviceId` int(11) NOT NULL DEFAULT '1' COMMENT 'µçÔ´id'," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éID'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `dev_version` varchar(64) NOT NULL DEFAULT '' COMMENT 'Ðת°æ±¾ºÅ'," +
|
" `char_output_vol` float NOT NULL DEFAULT '0' COMMENT '³äµç»úÊä³öµçѹ'," +
|
" `char_output_curr` float NOT NULL DEFAULT '0' COMMENT '³äµç»úÊä³öµçÁ÷'," +
|
" `char_peak_rip_vol` float NOT NULL DEFAULT '0' COMMENT 'ÎÆ²¨·åÖµ'," +
|
" `char_peak_rip_param` float NOT NULL DEFAULT '0' COMMENT 'ÎÆ²¨·åֵϵÊý'," +
|
" `char_Uan` float NOT NULL DEFAULT '0' COMMENT 'Uan'," +
|
" `char_Ian` float NOT NULL DEFAULT '0' COMMENT 'Ian'," +
|
" `char_Ubn` float NOT NULL DEFAULT '0' COMMENT 'Ubn'," +
|
" `char_Ibn` float NOT NULL DEFAULT '0' COMMENT 'Ibn'," +
|
" `char_Ucn` float NOT NULL DEFAULT '0' COMMENT 'Ucn'," +
|
" `char_Icn` float NOT NULL DEFAULT '0' COMMENT 'Icn'," +
|
" `char_system_state` int(11) NOT NULL DEFAULT '0' COMMENT 'ϵͳ״̬'," +
|
" `note` varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_battgroupid` (`BattGroupId`) USING BTREE," +
|
" KEY `index_PowerDeviceId` (`PowerDeviceId`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=4 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);
|
//ÒÆ³ý֮ǰµÄÒÔµç³Ø×éidÉèÖõÄΨһË÷Òý
|
res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100_ChargerstateTable+" WHERE KEY_name = 'unique_battgroupid'");
|
if(res.next()) {
|
sql.sqlMysqlExecute("alter table "+Sql_Mysql.FBS9100_ChargerstateTable+" drop index unique_battgroupid;");
|
}
|
//Ìí¼Ó×Ö¶ÎPowerDeviceId
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100_chargerstate'"
|
+ " AND column_name='PowerDeviceId'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100_ChargerstateTable
|
+ " ADD COLUMN `PowerDeviceId` int(11) NOT NULL DEFAULT '1' COMMENT 'µçÔ´id';");
|
}
|
//Ìí¼Ó×Ö¶Îdev_version
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='db_ram_db'"
|
+ " AND table_name='tb_fbs9100_chargerstate'"
|
+ " AND column_name='dev_version'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100_ChargerstateTable
|
+ " ADD COLUMN `dev_version` varchar(64) NOT NULL DEFAULT '' COMMENT 'Ðת°æ±¾ºÅ';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(null != res) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨¸É½Óµã״̬±í
|
* @param pool
|
* @param recreate
|
*/
|
private static void createFBS9100s_stemnode_state_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100s_stemnode_state_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100s_stemnode_state_Table + " (" +
|
" `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 '¼Ç¼ʱ¼ä'," +
|
" `dryInputState` int(11) NOT NULL DEFAULT '0' COMMENT '¸É½ÚµãÊäÈë״̬'," +
|
" `dryOutputState` int(11) NOT NULL DEFAULT '0' COMMENT '¸É½ÚµãÊä³ö״̬'," +
|
" `volOutputState` int(11) NOT NULL DEFAULT '0' COMMENT '¸É½ÚµãµçѹÊä³ö״̬'," +
|
" `sumOutputVolt` float NOT NULL DEFAULT '0' COMMENT '×ÜÊä³öµçѹ'," +
|
" `sumOutputCur` float NOT NULL DEFAULT '0' COMMENT '×ÜÊä³öµçÁ÷'," +
|
" `outputVolt1` float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçѹ1'," +
|
" `outputVolt2` float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçѹ2'," +
|
" `outputVolt3` float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçѹ3'," +
|
" `outputVolt4` float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçѹ4'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `index_dev_id` (`dev_id`) USING BTREE" +
|
") ENGINE=InnoDB 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();
|
}
|
|
}
|
|
/**
|
* ´´½¨Ä¸Áª×´Ì¬±í
|
* @param pool
|
* @param recreate
|
*/
|
private static void createFBS9100s_buscouple_state_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100s_buscouple_state_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100s_buscouple_state_Table + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `dev_id` int(11) NOT NULL DEFAULT '912000001' COMMENT 'É豸id'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `fanglei_state` int(11) NOT NULL DEFAULT '0' COMMENT '·ÀÀ×״̬:0:δÁ¬½Ó;1:Õý³£¹¤×÷;2ÐèÒª¸ü»»·ÀÀ×É豸'," +
|
" `workstate` int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷״̬'," +
|
" `rlayworkmode` int(11) NOT NULL DEFAULT '0' COMMENT '¿Õ¿ª²Ù×÷״̬'," +
|
" `rlyAstate` int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹ØÊäÈëON״̬'," +
|
" `rlyBstate` int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹ØÊäÈëOFF״̬'," +
|
" `stopreson` int(11) NOT NULL DEFAULT '0' COMMENT 'Í£Ö¹ÔÒò'," +
|
" `volt_m1` float NOT NULL DEFAULT '0' COMMENT 'µçѹ1'," +
|
" `volt_m2` float NOT NULL DEFAULT '0' COMMENT 'µçѹ2'," +
|
" `iout` float NOT NULL DEFAULT '0' COMMENT 'µçÁ÷'," +
|
" `curdir` int(11) NOT NULL DEFAULT '0' COMMENT 'µçÁ÷·½Ïò'," +
|
" `commustate` int(11) NOT NULL DEFAULT '0' COMMENT 'ͨÐÅ״̬'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `index_dev_id` (`dev_id`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=3 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();
|
}
|
|
}
|
|
|
|
}
|