package com.sql.util;
|
|
import java.sql.SQLException;
|
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class Db_Lithium_Testdata {
|
public static void init(MysqlConnPool pool) {
|
createDb_Lithium_Testdata(pool);
|
|
createBattTestdata_Inf_Table(pool);
|
}
|
|
|
public static void createDb_Lithium_Testdata(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute("CREATE SCHEMA IF NOT EXISTS " + Sql_Mysql.DB_LITHIUM_TESTDATA + " AUTHORIZATION sysdba");
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
|
|
/**
|
* ´´½¨ db_lithium_testdata.tb_batttestdata_inf Êý¾Ý¿â±í
|
* @param conn
|
*/
|
public static void createBattTestdata_Inf_Table(MysqlConnPool pool)
|
{
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
String sql_str_auto = "CREATE SEQUENCE IF NOT EXISTS " + Sql_Mysql.BattTestdata_Inf_Table + "_auto" +
|
" INCREMENT 1" +
|
" MINVALUE 1" +
|
" MAXVALUE 9223372036854775807" +
|
" START 1" +
|
" CACHE 1;";
|
//´´½¨×ÔÔöÐòÁÐ
|
sql.sqlMysqlExecute(sql_str_auto);
|
|
String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattTestdata_Inf_Table + " "
|
+ "(num bigint NOT NULL DEFAULT nextval('" + Sql_Mysql.BattTestdata_Inf_Table + "_auto'::regclass)," +
|
" dev_id integer NOT NULL DEFAULT 1," +
|
" batt_idx integer NOT NULL DEFAULT 0," +
|
" test_type integer NOT NULL DEFAULT 2," +
|
" test_record_count integer NOT NULL DEFAULT 1," +
|
" record_num integer NOT NULL DEFAULT 1," +
|
" test_starttime timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
|
" test_timelong integer NOT NULL DEFAULT 0," +
|
" record_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
|
" test_stoptype integer NOT NULL DEFAULT 0," +
|
" group_vol double precision NOT NULL DEFAULT 0," +
|
" test_curr double precision NOT NULL DEFAULT 0," +
|
" test_cap double precision NOT NULL DEFAULT 0," +
|
" max_monvol double precision NOT NULL DEFAULT 0," +
|
" max_monvolnum integer NOT NULL DEFAULT 1," +
|
" min_monvol double precision NOT NULL DEFAULT 0," +
|
" min_monvolnum integer NOT NULL DEFAULT 1," +
|
" mon_vol_high double precision NOT NULL DEFAULT 0," +
|
" testcurr_limit double precision NOT NULL DEFAULT 0," +
|
" battery_number integer NOT NULL DEFAULT 1," +
|
" char_voltage double precision NOT NULL DEFAULT 0," +
|
" save_inverter integer NOT NULL DEFAULT 10," +
|
" max_temp double precision NOT NULL DEFAULT 0," +
|
" min_temp double precision NOT NULL DEFAULT 0," +
|
" battery_name character varying NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
|
" mon_vol_low double precision NOT NULL DEFAULT 0," +
|
" group_vol_low double precision NOT NULL DEFAULT 0," +
|
" vol_threshold double precision NOT NULL DEFAULT 0," +
|
" batt_type integer NOT NULL DEFAULT 0," +
|
" stop_type_reason character varying NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
|
" PRIMARY KEY (num)" +
|
")";
|
sql.sqlMysqlExecute(sql_str);
|
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattTestdata_Inf_Table + " OWNER TO sysdba;");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".num IS '×ÔÔöÖ÷¼ü';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".dev_id IS 'É豸ID';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".batt_idx IS 'µç³Ø×é±àºÅ[0-×é1 1-×é2 ... 4-×é4]';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_type IS '²âÊÔÀàÐÍ[2-³äµç²âÊÔ 3-·Åµç²âÊÔ 4-¾ùºâ²âÊÔ]';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_record_count IS '²âÊԼǼ´ÎÊý';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".record_num IS '¼Ç¼±ÊÊý';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_starttime IS '²âÊÔ¿ªÊ¼Ê±¼ä';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_timelong IS '²âÊÔʱ³¤';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".record_time IS '¼Ç¼ʱ¼ä';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_stoptype IS 'Í£Ö¹ÔÒò';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".group_vol IS '×é¶Ëµçѹ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_curr IS '²âÊÔµçÁ÷';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".test_cap IS '²âÊÔÈÝÁ¿';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".max_monvol IS '×î´óµ¥Ìåµçѹ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".max_monvolnum IS '×î´óµ¥Ìåµçѹ±àºÅ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".min_monvol IS '×îСµ¥Ìåµçѹ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".min_monvolnum IS '×îСµ¥Ìåµçѹ±àºÅ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".mon_vol_high IS 'µ¥´®ÉÏÏÞ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".testcurr_limit IS 'µçÁ÷ãÐÖµ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".battery_number IS 'µçо´®Êý';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".char_voltage IS '³äµçÏÞѹ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".save_inverter IS '²É¼¯ÆµÂÊ(Ãë)';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".max_temp IS '×î¸ßζÈ(¡æ)';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".min_temp IS '×îµÍζÈ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".battery_name IS 'PACK/Ä£×éºÅ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".mon_vol_low IS 'µ¥´®ÏÂÏÞ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".group_vol_low IS '×é¶ËµçѹÏÂÏÞ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".vol_threshold IS 'µçѹãÐÖµ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".batt_type IS 'µç³ØÀàÐÍ[0-Ìúï® 1-ÈýÔªï® 2-îÑËá﮵ç 3-ÃÌËáï®]';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.BattTestdata_Inf_Table + ".stop_type_reason IS 'Í£Ö¹ÔÒò×Ö·û´®';");
|
sql.sqlMysqlExecute("COMMENT ON TABLE " + Sql_Mysql.BattTestdata_Inf_Table + " IS 'µç³Ø×éÀúÊ·Êý¾Ý×ܱí';");
|
} catch (Exception e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
}
|