package com.database_util;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class DB_web_site {
|
|
|
public static void init(MysqlConnPool pool, boolean recreate) {
|
createWeb_siteDB(pool); //´´½¨website Êý¾Ý¿â
|
|
createThread_utilTable(pool,recreate); //´´½¨Ï߳̿ØÖƱí
|
|
createPositiomapUsr_Table(pool,recreate); //´´½¨Ê×Ò³ÉÏÓû§ÖÐÐĵãÉèÖñí
|
|
createChartColor_Table(pool,recreate); //´´½¨Óû§ÊµÊ±¼à²âÒ³ÃæÖùÌåÑÕÉ«ÉèÖñí
|
|
createUserChart_Table(pool,recreate); //´´½¨°à×é¹ÜÀí±í
|
|
createProcessSurvey_Table(pool,recreate); //´´½¨Ïß³Ì¼à¿Ø±í
|
|
createEchartsUsr_Table(pool,recreate); //´´½¨Ê×Ò³±ý״ͼ¶¨ÖƱí
|
|
createDevstateUsr_Table(pool, recreate); //´´½¨Óû§·Åµç¼Ç¼±í
|
|
createCustomPage_Table(pool,recreate); //´´½¨µ¼º½Êý¾Ý±í
|
|
createAnnounce_Table(pool, recreate); //´´½¨¹«¸æ±í
|
|
createBattAttention_Table(pool, recreate); //´´½¨µç³Ø×éµ¥Ì幨ע±í
|
|
createBattpowerOff_Table(pool,recreate); //´´½¨»ú·¿Í£µç±í
|
|
createBadbattMon_Table(pool, recreate); //´´½¨Âäºóµ¥Ìå±í
|
|
createBadbattMonFlag_Table(pool, recreate); //´´½¨Âäºóµ¥Ìå°ïÖú¿ØÖƱí
|
|
createBattEndurance_Table(pool, recreate); //´´½¨»ú·¿Ðøº½
|
|
createBattParamLow_Table(pool, recreate); //´´½¨¸÷ÖÖÐøº½±í
|
|
createBattDischargeParam_Table(pool, recreate); //´´½¨·Åµç¼Æ»®²ÎÊý±í
|
|
createBattDischargePlan_Table(pool, recreate); //´´½¨·Åµç¼Æ»®±í
|
|
createAvoid_plan_Table_Table(pool, recreate); //´´½¨·Åµç¼Æ»®¹æ±Üʱ¼ä±í
|
|
createBattMapInformation_Table(pool, recreate); //´´½¨»ùÕ¾¶¨Î»±í
|
|
createBattDischarge_Table(pool,recreate); //´´½¨»ùÕ¾¹ÊÕϱí
|
|
createBattReplace_Table(pool,recreate); //´´½¨»ú·¿µç³Ø×é¸ü»»¼Ç¼±í
|
|
createDev_Restart_PlanTable(pool,recreate); //´´½¨Éè±¸ÖØÆô¼Æ»®±í
|
|
createVip_User_Table(pool, recreate); //´´½¨³¬¼¶Óû§±íÒÔ¼°Ìí¼ÓvipÓû§
|
|
createLicense_Table(pool, recreate); //´´½¨³¬¼¶Óû§±íÒÔ¼°Ìí¼ÓvipÓû§
|
|
createDatabase_Backup_Table(pool, recreate); //´´½¨Êý¾Ý¿â±¸·Ý±í
|
}
|
|
|
/**
|
* ´´½¨ web_site Êý¾Ý¿â
|
* @param pool
|
*/
|
public static void createWeb_siteDB(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.WEB_Site);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Ïß³ÌÊÖ¶¯Æô¶¯¹¤¾ß±í
|
*/
|
public static void createThread_utilTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ThreadUtil_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ThreadUtil_Table + " (" +
|
" `num` bigint(20) NOT NULL," +
|
" `thread_id` int(11) NOT NULL COMMENT 'Ïß³Ìid'," +
|
" `thread_name` varchar(64) NOT NULL DEFAULT 'Ïß³ÌÃû³Æ'," +
|
" `thread_starttime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'," +
|
" `thread_en` int(11) NOT NULL DEFAULT '0' COMMENT 'ÊÇ·ñÆô¶¯±êʶλ 0£ºÄ¬ÈÏ 1£ºÐèÒªÆô¶¯ 2:ÔËÐÐÍê³É'," +
|
" `note` varchar(256) NOT NULL DEFAULT ''," +
|
" UNIQUE KEY `unindex_thread_id` (`thread_id`)," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet rs = null;
|
try {
|
if(true == recreate) {
|
sql.sqlMysqlExecute(sql_str01);
|
}
|
sql.sqlMysqlExecute(sql_str02);
|
rs = sql.sqlMysqlQuery("SELECT * from web_site.tb_thread_util WHERE thread_id = 2019001");
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ThreadUtil_Table + " VALUES ('1', '2019001', '»ú·¿Ðøº½Ïß³Ì', '2019-01-08 10:44:28', '0', '')"); //Ìí¼Ó»ú·¿Ðøº½Ï̵߳ĿØÖƼǼ
|
}
|
rs = sql.sqlMysqlQuery("SELECT * from web_site.tb_thread_util WHERE thread_id = 2019002");
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ThreadUtil_Table + " VALUES ('2', '2019002', 'Âäºóµ¥ÌåÏß³Ì', '2019-01-08 10:44:28', '0', '')"); //Ìí¼Ó»ú·¿Ðøº½Ï̵߳ĿØÖƼǼ
|
}
|
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Óû§µØÍ¼ÖÐÐĵãλÖñí
|
*/
|
public static void createPositiomapUsr_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.PositiomapUsr_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.PositiomapUsr_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `map_longitude` float NOT NULL DEFAULT '116.405'," +
|
" `map_latitude` float NOT NULL DEFAULT '39.9149'," +
|
" `map_level` int(11) NOT NULL DEFAULT '10'," +
|
" `uid` int(11) NOT NULL DEFAULT '1002'," +
|
" `note` varchar(64) NOT NULL DEFAULT '±£Áô'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `index_uid` (`uid`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=62 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();
|
}
|
}
|
|
/**
|
* ´´½¨Óû§ÊµÊ±¼à²âÒ³ÃæÖùÌåÑÕÉ«ÉèÖñí
|
*/
|
public static void createChartColor_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ChartColor_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ChartColor_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `uid` int(11) NOT NULL DEFAULT '1001'," +
|
" `max_color` varchar(64) NOT NULL DEFAULT 'red'," +
|
" `min_color` varchar(64) NOT NULL DEFAULT 'green'," +
|
" `normal_color` varchar(64) NOT NULL DEFAULT '#5986BF'," +
|
" `change_color` varchar(64) NOT NULL DEFAULT '#BFA0D1'," +
|
" `warn_color` varchar(64) NOT NULL DEFAULT '#ffff00'," +
|
" `note` varchar(64) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `index_uid` (`uid`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=5 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();
|
}
|
}
|
/**
|
* ´´½¨°à×é¹ÜÀí±í
|
*/
|
public static void createUserChart_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.UserChart_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.UserChart_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `chart_name` varchar(64) NOT NULL DEFAULT 'ÌúËþ'," +
|
" `chart_file` varchar(64) NOT NULL DEFAULT 'whyc'," +
|
" `chart_logo` blob," + //Ê×Ò³logo
|
" `chart_normal` blob," + //Õý³£logo
|
" `chart_behind` blob," + //Âäºólogo
|
" `chart_warn` blob," + //¸æ¾¯logo
|
" `chart_timeout` blob," + //ÑÓ³Ùlogo
|
" `chart_online_charge` blob," + //ÔÚÏß³äµç
|
" `chart_pre_charge` blob," + //Ô¤³äµçlogo
|
" `chart_dev_alarm` blob," + //É豸¸æ¾¯
|
" `chart_nuclear_cap` blob," + //ºËÈݷŵç
|
" `Chart_poff` blob," + //Í£µçlogo
|
" `Chart_install` blob," + //δ°²×°logo
|
" `Chart_xuhang` blob," + //Ðøº½²»×ãlogo
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `unique_index_chart_file` (`chart_file`)" + //Ìí¼ÓΨһË÷Òý
|
") 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);
|
//Ìí¼ÓÔÚÏß³äµçÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='chart_online_charge'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `chart_online_charge` blob");
|
}
|
//Ìí¼ÓÔ¤³äµçÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='chart_pre_charge'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `chart_pre_charge` blob");
|
}
|
//Ìí¼ÓÉ豸¸æ¾¯ÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='chart_dev_alarm'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `chart_dev_alarm` blob");
|
}
|
//Ìí¼ÓºËÈݷŵçÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='chart_nuclear_cap'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `chart_nuclear_cap` blob");
|
}
|
//Ìí¼ÓÍ£µçÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='Chart_poff'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `Chart_poff` blob");
|
}
|
//Ìí¼Óδ°²×°ÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='Chart_install'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `Chart_install` blob");
|
}
|
//Ìí¼ÓÐøº½²»×ãÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_user_chart'"
|
+ " AND column_name='Chart_xuhang'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
|
+ " ADD COLUMN `Chart_xuhang` blob");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Ïß³Ì¼à¿Ø±í
|
*/
|
public static void createProcessSurvey_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ProcessSurvey_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ProcessSurvey_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `ProcessId` int(12) NOT NULL," + //½ø³Ìid
|
" `ProcessName` varchar(64) NOT NULL DEFAULT ' '," + //½ø³ÌÃû³Æ
|
" `ProcessTime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'," + //½ø³ÌÔËÐиüÐÂʱ¼ä
|
" `Process_starttime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'," + //½ø³Ì¿ªÊ¼Æô¶¯Ê±¼ä
|
" `ServerName` varchar(64) NOT NULL DEFAULT ' '," + //·þÎñÃû³Æ
|
" `ServerFlag` int(11) NOT NULL DEFAULT '1'," + //·þÎñ״̬ 0£ºÍ£Ö¹ 1£ºÕýÔÚÔËÐÐ 2½ûÓÃ
|
" `ProcessVersion` varchar(64) DEFAULT ' '," + //½ø³Ì°æ±¾
|
" `note` varchar(64) NOT NULL DEFAULT ' '," + //±¸×¢
|
" `OutTime` int(11) NOT NULL DEFAULT '60'," + //³¬Ê±Ê±³¤
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `ProcessId` (`ProcessId`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 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);
|
//Ìí¼ÓÖ÷³ÌÐò¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11001");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11001', 'BMS_FBSDEV', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV', '1', 'V1.585', 'Ö÷³ÌÐòÏß³Ì', '300');");
|
}
|
//Ìí¼Óµç³Ø¸æ¾¯½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11002");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11002', 'BMS_FBSDEV_ALARM_BATT', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_ALARM', '1', 'V1.109', 'µç³Ø¸æ¾¯Ïß³Ì', '300');");
|
}
|
//Ìí¼ÓÉ豸¸æ¾¯½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11003");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11003', 'BMS_FBSDEV_ALARM_DEV', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_ALARM', '1', 'V1.109', 'É豸¸æ¾¯Ïß³Ì', '300');");
|
}
|
//Ìí¼ÓÂäºóµ¥Ìå½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11004");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11004', 'BMS_FBSDEV_BADBATT_MON', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_BADBATT', '1', 'v2.303', 'Âäºóµ¥ÌåÏß³Ì', '300');");
|
}
|
//Ìí¼ÓÈÝÁ¿¸æ¾¯½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11005");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11005', 'BMS_FBSDEV_BADBATT_CAP', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_BADBATT', '1', 'v2.303', 'ÈÝÁ¿¸æ¾¯Ïß³Ì', '300');");
|
}
|
//Ìí¼Ó·Åµç¼Æ»®½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11006");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11006', 'BMS_FBSDEV_PLAN', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_PLAN', '2', ' ', '·Åµç¼Æ»®Ïß³Ì', '300');");
|
}
|
//Ìí¼Ó»ú·¿Í£µç½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11007");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11007', 'BMS_FBSDEV_POWER_FAIL', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_POWER_FAIL', '2', ' ', '»ú·¿Í£µçÏß³Ì', '300');");
|
}
|
//Ìí¼ÓÏß³Ì¼à¿Ø½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11008");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11008', 'BMS_FBSDEV_LISTEN', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_LISTEN', '1', 'V1.101', 'Ïß³Ì¼à¿ØÏß³Ì', '300');");
|
}
|
//Ìí¼Ó61850½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11009");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11009', 'BMS_FBS61850_BATT', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS61850_BATT', '2', 'V1.101', '61850ͨѶÏß³Ì', '300');");
|
}
|
//Ìí¼Ó9600½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11010");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11010', 'BMS_FBS9600_DISPLAY', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS9600_DISPLAY', '2', 'v1.101', '9600ÏÔʾģ¿éÏß³Ì', '300');");
|
}
|
//Ìí¼ÓFBS»ã¼¯Æ÷ͨѶ½ø³Ì¼Ç¼
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11011");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11011', 'BMS_FBS_CONCENTRATOR', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS_CONCENTRATOR', '2', 'v1.101', 'FBS»ã¼¯Æ÷ͨѶÏß³Ì', '300');");
|
}
|
//Ìí¼Ó9¶ÈͨѶÏß³Ì
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11012");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11012', 'BMS_LD9_MONITOR', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_LD9_MONITOR', '2', 'v1.101', '9¶ÈÉ豸ͨѶÏß³Ì', '300');");
|
}
|
|
//Ìí¼Ó6¶ÈͨѶÏß³Ì
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11013");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11013', 'BMS_LD6_MONITOR', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_LD6_MONITOR', '2', 'v1.101', '6¶ÈÉ豸ͨѶÏß³Ì', '300');");
|
}
|
//Ìí¼ÓBTSÐøº½Í³¼ÆÏß³Ì
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11014");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11014', 'BMS_BTS_ENDURANCE', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_BTS_ENDURANCE', '2', 'v1.101', 'BTSÐøº½Í³¼ÆÏß³Ì', '300');");
|
}
|
//Ìí¼ÓͨÐŵçԴͨѶ
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11015");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11015', 'BMS_COMM_POWER', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_COMM_POWER', '2', 'v1.101', 'ͨÐŵçԴͨѶÏß³Ì', '300');");
|
}
|
//Ìí¼ÓͨÐŵçԴͨѶ
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11016");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11016', 'BMS_POWER_MONITOR', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_POWER_MONITOR', '2', 'v1.100', 'ͨÐŵçÔ´¼à¿ØÏß³Ì', '300');");
|
}
|
//Ðîµç³Ø¸ºÔظüÐÂÏß³Ì
|
res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11017");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11017', 'BMS_BATT_LOADUPDATE', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_BATT_LOADUPDATE', '1', 'v1.100', 'Ðîµç³Ø¸ºÔظüÐÂÏß³Ì', '300');");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Óû§Ê×Ò³±ý״ͼ¶¨ÖÆÒ³Ãæ
|
*/
|
public static void createEchartsUsr_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.EchartsUsr_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.EchartsUsr_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `uid` int(11) NOT NULL DEFAULT '1002'," +
|
" `echarts1_enable` int(11) NOT NULL DEFAULT '1'," +
|
" `echarts2_enable` int(11) NOT NULL DEFAULT '1'," +
|
" `echarts3_enable` int(11) NOT NULL DEFAULT '1'," +
|
" `echarts4_enable` int(11) NOT NULL DEFAULT '1'," +
|
" `echarts5_enable` int(11) NOT NULL DEFAULT '0'," +
|
" `echarts6_enable` int(11) NOT NULL DEFAULT '0'," +
|
" `echarts7_enable` int(11) NOT NULL DEFAULT '0'," +
|
" `echarts8_enable` int(11) NOT NULL DEFAULT '0'," +
|
" `echarts9_enable` int(11) NOT NULL DEFAULT '0'," +
|
" `echarts10_enable` int(11) NOT NULL DEFAULT '0'," +
|
" `note` varchar(64) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `uid_index` (`uid`)" +
|
") 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();
|
}
|
}
|
|
/**
|
* ´´½¨Óû§·ÅµçÌí¼Ó¼Ç¼±í
|
*/
|
public static void createDevstateUsr_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.DevstateUsr_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.DevstateUsr_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `uid` int(11) NOT NULL DEFAULT '1001'," +
|
" `dev_id` int(11) NOT NULL DEFAULT '910000001'," +
|
" `battgroupid` int(11) NOT NULL DEFAULT '1000001'," +
|
" `note` varchar(64) NOT NULL DEFAULT ' '," +
|
" `batt_index` int(11) NOT NULL DEFAULT '0'," +
|
" `stationname` varchar(64) NOT NULL DEFAULT ''," +
|
" `battgroupname` varchar(64) NOT NULL DEFAULT ''," +
|
" 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);
|
|
//Çå¿ÕÌí¼Ó¹ý·Åµç¼Ç¼ÖеĻú·¿Ð޸Ĺý»ú·¿Ãû³ÆµÄ¼Ç¼
|
sql.sqlMysqlExecute(" DELETE FROM "+ Sql_Mysql.DevstateUsr_Table +" WHERE BattGroupId not in ( " +
|
" SELECT DISTINCT(BattGroupId) FROM " +Sql_Mysql.BattInf_Table +
|
" ) ");
|
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/**
|
* ´´½¨µ¼º½Êý¾Ý±í
|
*/
|
public static void createCustomPage_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.CustomPage_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.CustomPage_Table + " (" +
|
" `Num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `Navigate` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `Navigate_order` int(11) DEFAULT NULL," +
|
" `Submenu` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `Subflag` int(11) DEFAULT NULL," +
|
" `Sublink` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `SubEnable` int(11) DEFAULT NULL," +
|
" `SubName` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `Subjudge` int(11) DEFAULT NULL," +
|
" `page_order` int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (`Num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet res = null;
|
try {
|
if(true == recreate) {
|
//sql.sqlMysqlExecute(sql_str01);
|
}
|
sql.sqlMysqlExecute(sql_str02);
|
|
//Ìí¼Óµ¼º½Ë³ÐòÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_custompage'"
|
+ " AND column_name='page_order'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.CustomPage_Table
|
+ " ADD COLUMN `page_order` int(11) NOT NULL DEFAULT '0';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/**
|
* ´´½¨¹«¸æ±í
|
*/
|
public static void createAnnounce_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Announce_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Announce_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `usr_id` int(11) DEFAULT NULL," +
|
" `announce_time` datetime DEFAULT NULL," +
|
" `message` varchar(1024) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `note` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
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();
|
}
|
}
|
/**
|
* ´´½¨µç³Ø×éµ¥Ì幨ע±í
|
*/
|
public static void createBattAttention_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattAttention_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattAttention_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '0'," +
|
" `MonNum` int(11) NOT NULL DEFAULT '0'," +
|
" `note` varchar(64) NOT NULL DEFAULT ' '," +
|
" `Uid` int(11) NOT NULL DEFAULT '1001'," +
|
" 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();
|
}
|
}
|
/**
|
* ´´½¨»ú·¿Í£µç±í
|
*/
|
public static void createBattpowerOff_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattpowerOff_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattpowerOff_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `dev_id` int(11) NOT NULL," +
|
" `record_count` int(11) NOT NULL DEFAULT '0'," +
|
" `poweroff_starttime` timestamp NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" `poweroff_stoptime` timestamp NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" `power_state` int(11) NOT NULL DEFAULT '0'," +
|
" `timelong` int(11) NOT NULL DEFAULT '0'," +
|
" `note` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)," +
|
" 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();
|
}
|
}
|
/**
|
* ´´Âäºóµ¥Ìå±í
|
*/
|
public static void createBadbattMon_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BadbattMon_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BadbattMon_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `battgroupid` int(11) NOT NULL DEFAULT '0'," +
|
" `mon_num` int(11) NOT NULL DEFAULT '0'," +
|
" `record_num` int(11) NOT NULL DEFAULT '0'," +
|
" `test_starttime` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" `group_vol` float NOT NULL DEFAULT '0'," +
|
" `test_curr` float NOT NULL DEFAULT '0'," +
|
" `mon_vol` float NOT NULL DEFAULT '0'," +
|
" `real_cap` float NOT NULL DEFAULT '0'," +
|
" `stdcap` float NOT NULL DEFAULT '0'," +
|
" `note` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ' '," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_num` (`battgroupid`)" +
|
") 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();
|
}
|
}
|
/**
|
* ´´Âäºóµ¥Ìå¿ØÖÆ±í
|
*/
|
public static void createBadbattMonFlag_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BadbattMonFlag_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BadbattMonFlag_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `count` int(11) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=7 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();
|
}
|
}
|
|
/**
|
* ´´½¨»ú·¿Ðøº½±í
|
*/
|
public static void createBattEndurance_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattEndurance_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattEndurance_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `deviceid` int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" `stationid` varchar(64) NOT NULL DEFAULT '0' COMMENT '»ú·¿id'," +
|
" `real_cap` float NOT NULL DEFAULT '0' COMMENT 'ʵ¼ÊÈÝÁ¿'," +
|
" `moncapstd` float NOT NULL DEFAULT '0' COMMENT '±ê³ÆÈÝÁ¿'," +
|
" `real_curr` float NOT NULL DEFAULT '0' COMMENT 'ʵ¼ÊµçÁ÷'," +
|
" `endurance_theory_timelong` float NOT NULL DEFAULT '0' COMMENT 'ÀíÂÛÐøº½Ê±³¤(·ÖÖÓ)'," +
|
" `endurance_actual_timelong` float NOT NULL DEFAULT '0' COMMENT 'ƽ¾ùʵ¼ÊÐøº½Ê±³¤(·ÖÖÓ)'," +
|
" `endurance_actual_timelong_min` float NOT NULL DEFAULT '0' COMMENT '×îСʵ¼ÊÐøº½Ê±³¤(·ÖÖÓ)'," +
|
" `endurance_actual_timelong_max` float NOT NULL DEFAULT '0' COMMENT '×î´óʵ¼ÊÐøº½Ê±³¤(·ÖÖÓ)'," +
|
" `is_out_stand` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'ÊÇ·ñµôÕ¾'," +
|
" `note` varchar(64) NOT NULL DEFAULT '' COMMENT '±¸×¢'," +
|
" `real_cap_group1` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é1ʵ¼ÊÈÝÁ¿'," +
|
" `real_cap_group2` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é2ʵ¼ÊÈÝÁ¿'," +
|
" `real_cap_group3` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é3ʵ¼ÊÈÝÁ¿'," +
|
" `real_cap_group4` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é4ʵ¼ÊÈÝÁ¿'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `unique_index_deviceid` (`deviceid`)," +
|
" KEY `index_stationid` (`stationid`)" +
|
") 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);
|
|
/************************** Ìí¼Ó×î´óÐøº½Ê±³¤ÁÐ **************************************/
|
String sql_str1 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='endurance_actual_timelong_max'";
|
//System.out.println(sql_str3);
|
ResultSet rs = sql.sqlMysqlQuery(sql_str1);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `endurance_actual_timelong_max` int(11) NOT NULL DEFAULT '0' COMMENT '×î´óʵ¼ÊÐøº½Ê±³¤(·ÖÖÓ)' AFTER `endurance_actual_timelong`;");
|
}
|
|
/************************** Ìí¼Ó×îÐ¡Ðøº½Ê±³¤ÁÐ **************************************/
|
String sql_str2 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='endurance_actual_timelong_min'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str2);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `endurance_actual_timelong_min` int(11) NOT NULL DEFAULT '0' COMMENT '×îСʵ¼ÊÐøº½Ê±³¤(·ÖÖÓ)' AFTER `endurance_actual_timelong`;");
|
}
|
|
/************************** Ìí¼Ó µç³Ø×é1ʵ¼ÊÈÝÁ¿ **************************************/
|
String sql_str3 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='real_cap_group1'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str3);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `real_cap_group1` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é1ʵ¼ÊÈÝÁ¿';");
|
}
|
/************************** Ìí¼Ó µç³Ø×é2ʵ¼ÊÈÝÁ¿ **************************************/
|
String sql_str4 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='real_cap_group2'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str4);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `real_cap_group2` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é2ʵ¼ÊÈÝÁ¿';");
|
}
|
/************************** Ìí¼Ó µç³Ø×é3ʵ¼ÊÈÝÁ¿ **************************************/
|
String sql_str5 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='real_cap_group3'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str5);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `real_cap_group3` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é3ʵ¼ÊÈÝÁ¿';");
|
}
|
/************************** Ìí¼Ó µç³Ø×é4ʵ¼ÊÈÝÁ¿ **************************************/
|
String sql_str6 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='real_cap_group4'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str6);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `real_cap_group4` float NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é4ʵ¼ÊÈÝÁ¿';");
|
}
|
/************************** Ìí¼Ó µç³Ø×éµÄ±ê³ÆÈÝÁ¿ **************************************/
|
String sql_str7 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='batts_moncapstd'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str7);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `batts_moncapstd` varchar(64) NOT NULL DEFAULT '' COMMENT 'µç³Ø×éµÄ±ê³ÆÈÝÁ¿';");
|
}
|
/************************** Ìí¼Ó µç³Ø×éµÄºËÈÝʱ¼ä **************************************/
|
String sql_str8 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='batts_teststarttime'";
|
rs = sql.sqlMysqlQuery(sql_str8);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `batts_teststarttime` varchar(250) NOT NULL DEFAULT '' COMMENT 'µç³Ø×éµÄºËÈÝʱ¼ä';");
|
}
|
/************************** Ìí¼Ó µç³Ø×éµÄ×éÊý **************************************/
|
String sql_str9 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_endurance' "
|
+ " AND column_name='groupcount'";
|
rs = sql.sqlMysqlQuery(sql_str9);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattEndurance_Table
|
+ " ADD COLUMN `groupcount` int NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éµÄ×éÊý';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨¸÷ÖÖ·§Öµ²ÎÊý±í
|
*/
|
public static void createBattParamLow_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattParamLow_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattParamLow_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `low_type` int(11) DEFAULT NULL," +
|
" `Low_nametype` int(11) DEFAULT NULL," +
|
" `Low_value` float DEFAULT NULL," +
|
" `low_method` int(11) DEFAULT NULL," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
if(true == recreate) {
|
sql.sqlMysqlExecute(sql_str01);
|
sql.sqlMysqlExecute(sql_str02);
|
}else {
|
sql.sqlMysqlUseDB(Sql_Mysql.WEB_Site);
|
if(sql.sqlMysqlCheckIfTableExist("tb_batt_param_low")) {
|
sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.BattParamLow_Table);
|
}
|
sql.sqlMysqlExecute(sql_str02);
|
}
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('1', '1', '0', '0.8', '1');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('2', '1', '1', '0.9', '1');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('3', '2', '0', '0.01', '0');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('4', '2', '1', '0.1', '0');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('5', '2', '2', '0.4', '0');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('6', '2', '3', '0.5', '0');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('7', '3', '2', '0.94', '1');");
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.BattParamLow_Table+" VALUES ('8', '3', '3', '0.01', '1');");
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨·Åµç¼Æ»®²ÎÊý±í
|
*/
|
public static void createBattDischargeParam_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattDischargeParam_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattDischargeParam_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `preset_time` int(11) DEFAULT NULL," +
|
" `preset_cap` float NOT NULL DEFAULT '0'," +
|
" `preset_monvol` float NOT NULL DEFAULT '0'," +
|
" `preset_groupvol` float NOT NULL DEFAULT '0'," +
|
" `note` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT ' '," +
|
" `param_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `preset_mon` int(11) NOT NULL DEFAULT '0'," +
|
" `preset_curr` float NOT NULL DEFAULT '0'," +
|
" `chargecurrset` float NOT NULL DEFAULT '0'," +
|
" `dcvolhighlimit` float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_num` (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
if(true == recreate) {
|
//sql.sqlMysqlExecute(sql_str01);
|
//sql.sqlMysqlExecute(sql_str02);
|
}else {
|
|
}
|
sql.sqlMysqlExecute(sql_str02); //´´½¨·Åµç¼Æ»®²ÎÊý±í
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨·Åµç¼Æ»®±í
|
*/
|
public static void createBattDischargePlan_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattDischargePlan_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattDischargePlan_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `battgroupid` int(11) NOT NULL DEFAULT '0'," +
|
" `discharge_starttime` timestamp NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" `discharge_stoptime` timestamp NOT NULL DEFAULT '1982-01-01 00:00:00'," +
|
" `discharge_state` int(11) NOT NULL DEFAULT '0'," +
|
" `discharge_reason` varchar(128) COLLATE utf8_unicode_ci NOT NULL DEFAULT ''," +
|
" `note` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT ''," +
|
" `discharge_cleartype` int(11) NOT NULL DEFAULT '1'," +
|
" `BattIndexInFbs` int(11) NOT NULL DEFAULT '0'," +
|
" `preset_time` int(11) NOT NULL DEFAULT '0'," +
|
" `preset_cap` float NOT NULL DEFAULT '0'," +
|
" `preset_monvol` float NOT NULL DEFAULT '0'," +
|
" `preset_groupvol` float NOT NULL DEFAULT '0'," +
|
" `preset_mon` int(11) NOT NULL DEFAULT '0'," +
|
" `preset_curr` float NOT NULL DEFAULT '0'," +
|
" `dcvolhighlimit` float NOT NULL DEFAULT '0'," +
|
" `chargecurrset` float NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_num` (`num`)" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
if(true == recreate) {
|
//sql.sqlMysqlExecute(sql_str01);
|
//sql.sqlMysqlExecute(sql_str02);
|
}else {
|
}
|
sql.sqlMysqlExecute(sql_str02); //´´½¨·Åµç¼Æ»®±í
|
|
//Ìí¼Ó·Åµç¼Æ»®ÖÜÆÚÁÐ
|
ResultSet res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_battdischarge_plan'"
|
+ " AND column_name='plan_circle'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattDischargePlan_Table
|
+ " ADD COLUMN `plan_circle` int NOT NULL DEFAULT '0';");
|
}
|
|
//Ìí¼Ó·Åµç·Åµç´ÎÊýÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_battdischarge_plan'"
|
+ " AND column_name='plan_rate'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattDischargePlan_Table
|
+ " ADD COLUMN `plan_rate` int NOT NULL DEFAULT '0';");
|
}
|
//Ìí¼ÓÒѷŵç´ÎÊýÁÐ
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_battdischarge_plan'"
|
+ " AND column_name='already_count'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattDischargePlan_Table
|
+ " ADD COLUMN `already_count` int NOT NULL DEFAULT '0';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨·Åµç¼Æ»®¹æ±Üʱ¼ä±í
|
* @param pool
|
* @param recreate
|
*/
|
private static void createAvoid_plan_Table_Table(MysqlConnPool pool, boolean recreate) {
|
String str_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Avoid_plan_Table+" (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `start_time` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `start_month` int(11) NOT NULL DEFAULT '1'," +
|
" `start_day` int(11) NOT NULL DEFAULT '1'," +
|
" `stop_time` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `stop_month` int(11) NOT NULL DEFAULT '1'," +
|
" `stop_day` int(11) NOT NULL DEFAULT '1'," +
|
" `note` varchar(64) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str_str);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
}
|
|
|
/**
|
* ´´½¨»ùÕ¾¶¨Î»±í
|
*/
|
public static void createBattMapInformation_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattMapInformation_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattMapInformation_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `stationId` varchar(128) NOT NULL," +
|
" `stationName` varchar(128) NOT NULL," +
|
" `stationName3` varchar(128) DEFAULT ''," +
|
" `address` varchar(128) NOT NULL," +
|
" `longitude` double(11,8) NOT NULL DEFAULT '0.00000000'," +
|
" `latitude` double(11,8) NOT NULL DEFAULT '0.00000000'," +
|
" `information` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `stationId_num` (`stationId`) USING BTREE," +
|
" KEY `index_num` (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet rs = null;
|
try {
|
if(true == recreate) {
|
//sql.sqlMysqlExecute(sql_str01);
|
//sql.sqlMysqlExecute(sql_str02);
|
}else {
|
}
|
sql.sqlMysqlExecute(sql_str02); //´´½¨»ùÕ¾¶¨Î»±í
|
/************************** Ìí¼Ó stationName3 ×Ö¶Î **************************************/
|
String sql_str03 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_battmap_information' "
|
+ " AND column_name='stationName3'";
|
rs = sql.sqlMysqlQuery(sql_str03);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattMapInformation_Table
|
+ " ADD COLUMN `stationName3` varchar(128) NOT NULL DEFAULT '';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨¹ÊÕÏ»ùÕ¾±í
|
*/
|
public static void createBattDischarge_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattDischarge_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.BattDischarge_Table+" (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `uid` int(11) NOT NULL DEFAULT '1002'," +
|
" `dev_id` int(11) NOT NULL DEFAULT '910000001'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `note` varchar(64) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `unique_dev_id_index` (`dev_id`) USING BTREE" +
|
") 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);
|
}
|
sql.sqlMysqlExecute(sql_str02); //´´½¨»ùÕ¾¹ÊÕϱí
|
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Êý¾Ý¿â±¸·Ý±í web_site.tb_database_backup
|
*/
|
public static void createDatabase_Backup_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Database_Backup_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Database_Backup_Table+" (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `database_name` varchar(64) NOT NULL," +
|
" `table_name` varchar(64) NOT NULL," +
|
" `backup_en` int(11) NOT NULL DEFAULT '0'," +
|
" `backup_flag` int(11) NOT NULL DEFAULT '0'," +
|
" `note` varchar(64) NOT NULL DEFAULT '±£Áô'," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=128 DEFAULT CHARSET=utf8;" +
|
"";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
if(true == recreate) {
|
//sql.sqlMysqlExecute(sql_str01);
|
//sql.sqlMysqlExecute(sql_str02);
|
}
|
sql.sqlMysqlExecute(sql_str02); //´´½¨»ùÕ¾¹ÊÕϱí
|
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨µç³Ø×é¸ü»»¼Ç¼±í
|
*/
|
public static void createBattReplace_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattReplace_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.BattReplace_Table+" (" +
|
" num int(11) NOT NULL AUTO_INCREMENT," +
|
" stationid varchar(64) NOT NULL DEFAULT ''," +
|
" replaced_producer varchar(64) NOT NULL DEFAULT ''," +
|
" replaced_moncapstd int(11) NOT NULL DEFAULT '0'," +
|
" replaced_monvolstd float NOT NULL DEFAULT '0'," +
|
" replaced_moncount int(11) NOT NULL DEFAULT '0'," +
|
" replaced_time datetime NOT NULL DEFAULT '2018-01-01 00:00:00'," +
|
" replaced_uid int(11) NOT NULL DEFAULT '0'," +
|
" replaced_reason varchar(256) NOT NULL DEFAULT ''," +
|
" note varchar(64) NOT NULL DEFAULT ''," +
|
" replace_date date DEFAULT '2020-04-20'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `stationid_index` (`stationid`)" +
|
") 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);
|
}
|
sql.sqlMysqlExecute(sql_str02); //´´½¨µç³Ø×é¸ü»»¼Ç¼±í
|
/************************** Ìí¼Ó replace_date ×Ö¶Î **************************************/
|
String sql_str03 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_replace' "
|
+ " AND column_name='replace_date'";
|
ResultSet rs = sql.sqlMysqlQuery(sql_str03);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.BattReplace_Table
|
+ " ADD COLUMN replace_date date DEFAULT '2020-04-20';");
|
}
|
/************************** Ìí¼Ó GroupIndexInFBSDevice ×ֶαíÃ÷ÊÇÄÇÒ»×éµç³Ø **************************************/
|
sql_str03 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'web_site' "
|
+ " AND table_name='tb_batt_replace' "
|
+ " AND column_name='GroupIndexInFBSDevice'";
|
rs = sql.sqlMysqlQuery(sql_str03);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.BattReplace_Table
|
+ " ADD COLUMN GroupIndexInFBSDevice int(11) NOT NULL DEFAULT '0';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Éè±¸ÖØÆô¼Æ»®±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createDev_Restart_PlanTable(MysqlConnPool pool, boolean recreate) {
|
String sql_str_del = " DROP TABLE IF EXISTS "+Sql_Mysql.Dev_Restart_Plan_Table;
|
String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_Restart_Plan_Table + " (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" restart_starttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT 'ÖØÆô¿ªÊ¼Ê±¼ä'," +
|
" restart_cycle int(11) NOT NULL DEFAULT '1' COMMENT 'ÖØÆôÖÜÆÚ'," +
|
" restart_en int(11) NOT NULL DEFAULT '0' COMMENT 'ÖØÆôʹÄÜ 0:²»ÆôÓà £»1:ÆôÓÃ'," +
|
" note varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" 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());
|
ResultSet res = null;
|
try {
|
if(recreate) {
|
sql.sqlMysqlExecute(sql_str_del);
|
}
|
sql.sqlMysqlExecute(sql_str);
|
//Ìí¼ÓÉÏÒ»´ÎÖØÆôʱ¼ä×Ö¶Î
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_dev_restart_plan'"
|
+ " AND column_name='last_restarttime'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Dev_Restart_Plan_Table
|
+ " ADD COLUMN last_restarttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT 'ÉÏÒ»´ÎÖØÆôʱ¼ä';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(res != null) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨Ð°汾ƽ̨ע²áÐÅÏ¢±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createLicense_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str_del = " DROP TABLE IF EXISTS "+Sql_Mysql.License_Table;
|
String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.License_Table + " (" +
|
" `id` int(11) NOT NULL AUTO_INCREMENT," +
|
" `serialNumber` varchar(255) NOT NULL DEFAULT ''," +
|
" `duration` varchar(255) NOT NULL DEFAULT '0'," +
|
" `timeInUse` varchar(255) NOT NULL DEFAULT '0'," +
|
" PRIMARY KEY (`id`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet res = null;
|
try {
|
if(recreate) {
|
sql.sqlMysqlExecute(sql_str_del);
|
}
|
sql.sqlMysqlExecute(sql_str);
|
//ÐÞ¸Ä×¢²áʱ³¤ÐÅÏ¢
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_license'"
|
+ " AND column_name='duration'"
|
+ " AND DATA_TYPE = 'varchar'");
|
if(false == res.next()) {
|
//System.out.println("###############");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.License_Table
|
+ " modify COLUMN `duration` varchar(255) NOT NULL DEFAULT '0';");
|
}
|
res =null;
|
//ÐÞ¸ÄÒÑÓÃʱ³¤×Ö¶Î
|
res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
+ " WHERE table_schema='web_site'"
|
+ " AND table_name='tb_license'"
|
+ " AND column_name='timeInUse'"
|
+ " AND DATA_TYPE = 'varchar'");
|
if(false == res.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.License_Table
|
+ " modify COLUMN `timeInUse` varchar(255) NOT NULL DEFAULT '0';");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(res != null) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨³¬¼¶Óû§±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createVip_User_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str_del = " DROP TABLE IF EXISTS "+Sql_Mysql.Vip_User_Table;
|
String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Vip_User_Table + " (" +
|
" `num` int(11) NOT NULL AUTO_INCREMENT," +
|
" `vipname` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `vipSnid` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" `vipPassword` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
String sql_str_sel = "SELECT * FROM "+Sql_Mysql.Vip_User_Table+" WHERE vipname = 'vip';";
|
ResultSet res = null;
|
try {
|
if(recreate) {
|
sql.sqlMysqlExecute(sql_str_del);
|
}
|
sql.sqlMysqlExecute(sql_str);
|
//Ìí¼ÓÉÏÒ»´ÎÖØÆôʱ¼ä×Ö¶Î
|
res = sql.sqlMysqlQuery(sql_str_sel);
|
if(false == res.next()) {
|
//²»´æÔÚĬÈÏvipÕ˺ÅÔò
|
sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.Vip_User_Table+"(vipname,vipSnid,vipPassword) VALUES ('vip', 'vip', '232059cb5361a9336ccf1b8c2ba7657a');");
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
if(res != null) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
|
/**
|
* ÉèÖÃÖ¸¶¨µÄÏß³ÌÖØÆô[ ¸æ¾¯Ïß³Ì; ]
|
*/
|
public static void setUpThreadRestart(MysqlConnPool conn_pool) {
|
//ÖØÆô¸æ¾¯Ïß³Ì
|
String sql_str = "UPDATE " + Sql_Mysql.ProcessSurvey_Table
|
+ " SET ServerFlag = 0 "
|
+ " WHERE ProcessId = 11002 AND ServerFlag != 2";
|
Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
MysqlConnPool pool = new MysqlConnPool("123.207.82.239", 3360, 10);
|
DB_web_site website = new DB_web_site();
|
//website.createBattReplace_Table(pool, false);
|
website.createAvoid_plan_Table_Table(pool, false);
|
|
}
|
}
|