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); //´´½¨·Åµç¼Æ»®±í
|
|
createBattMapInformation_Table(pool, recreate); //´´½¨»ùÕ¾¶¨Î»±í
|
|
createBattDischarge_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=11 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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('1', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('2', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('3', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('4', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('5', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('6', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('7', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('8', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('9', '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 + "(num,ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('10', '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');");
|
}
|
|
} 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);
|
} 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);
|
} 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); //´´½¨·Åµç¼Æ»®±í
|
} 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," +
|
" `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());
|
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 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();
|
}
|
}
|
|
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.createThread_utilTable(pool, false);
|
}
|
}
|