package com.database_util;
|
|
import java.sql.SQLException;
|
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class DB_Batt_TestData {
|
|
|
public static void init(MysqlConnPool pool, boolean recreate) {
|
//´´½¨Êý¾Ý¿â
|
createDB_Batt_TestData(pool);
|
|
createBatttestdata_Inf_Table(pool, recreate);
|
|
}
|
|
/**
|
* ´´½¨ tb_batttestdata_inf
|
* @param pool
|
* @param recreate
|
*/
|
public static void createBatttestdata_Inf_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Batttestdata_Inf_Table;
|
String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Batttestdata_Inf_Table + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '×ÔÔöÖ÷¼ü'," +
|
" `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT 'É豸ID'," +
|
" `batt_idx` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×é±àºÅ[0-×é1 1-×é2 ... 4-×é4]'," +
|
" `test_type` int(11) NOT NULL DEFAULT '0' COMMENT '²âÊÔÀàÐÍ'," +
|
" `test_record_count` int(11) NOT NULL DEFAULT '0' COMMENT '²âÊԼǼ´ÎÊý'," +
|
" `record_num` int(11) NOT NULL DEFAULT '0' COMMENT '¼Ç¼±ÊÊý'," +
|
" `test_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '²âÊÔ¿ªÊ¼Ê±¼ä'," +
|
" `test_timelong` bigint(20) NOT NULL DEFAULT '0' COMMENT '²âÊÔʱ³¤'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `test_stoptype` int(11) NOT NULL DEFAULT '0' COMMENT 'Í£Ö¹ÔÒò'," +
|
" `group_vol` float NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ'," +
|
" `test_curr` float NOT NULL DEFAULT '0' COMMENT '²âÊÔµçÁ÷'," +
|
" `test_cap` float NOT NULL DEFAULT '0' COMMENT '²âÊÔÈÝÁ¿'," +
|
" `max_monvol` float NOT NULL DEFAULT '0' COMMENT '×î´óµ¥Ìåµçѹ'," +
|
" `max_monvolnum` int(11) NOT NULL DEFAULT '0' COMMENT '×î´óµ¥Ìåµçѹ±àºÅ'," +
|
" `min_monvol` float NOT NULL DEFAULT '0' COMMENT '×îСµ¥Ìåµçѹ'," +
|
" `min_monvolnum` int(11) NOT NULL DEFAULT '0' COMMENT '×îСµ¥Ìåµçѹ±àºÅ'," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `idx_dev_id` (`dev_id`) USING BTREE," +
|
" KEY `idx_test_record_count` (`test_record_count`) USING BTREE," +
|
" KEY `idx_batt_idx` (`batt_idx`) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='µç³Ø×éÀúÊ·Êý¾Ý×ܱí';";
|
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 createDB_Batt_TestData(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_BATT_TESTDATA);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
}
|