From 41fd6a96aff9b69257ef21d55fa3eb73696da143 Mon Sep 17 00:00:00 2001 From: Administrator <1525436766@qq.com> Date: 星期六, 09 十月 2021 15:00:30 +0800 Subject: [PATCH] V1.79 edit at date 2021-10-09 1.新增'web_site.tb_peak_statistics'表的创建语句 --- BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java b/BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java index 2bad74c..ac034d1 100644 --- a/BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java +++ b/BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java @@ -62,7 +62,9 @@ createDatabase_Backup_Table(pool, recreate); //创建数据库备份表 - createTb_Eletmp_Table(pool, recreate); //创建模板表 + createTb_Eletmp_Table(pool, recreate); //创建模板表 + + createTb_Peak_Statistics_Table(pool, recreate); //创建消峰填谷计划统计表 } @@ -85,6 +87,32 @@ sql.close_con(); } } + private static void createTb_Peak_Statistics_Table(MysqlConnPool pool, boolean recreate) { + String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Peak_Statistics_Table; + String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Peak_Statistics_Table + " (" + + " `num` bigint(20) NOT NULL AUTO_INCREMENT," + + " `BattGroupId` int(11) NOT NULL DEFAULT '1000001' COMMENT '电池组ID'," + + " `record_time` date NOT NULL COMMENT '当前天的记录的时间'," + + " `electric` float NOT NULL DEFAULT '0' COMMENT '用电量(kwh)'," + + " `ele_price` float NOT NULL DEFAULT '0' COMMENT '电价'," + + " `test_record_count` int(11) NOT NULL DEFAULT '0' COMMENT '当前参考的记录数'," + + " `test_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '当前参考的测试记录的开始时间'," + + " `test_type` int(11) NOT NULL DEFAULT '0' COMMENT '当前参考数据的测试类型'," + + " `test_cap` float NOT NULL DEFAULT '0' COMMENT '当前参考的测试容量'," + + " 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(); + } + } /** -- Gitblit v1.9.1