| | |
| | | public static void createLd9_Setparam_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Ld9_Setparam_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Ld9_Setparam_Table + " (" + |
| | | " num bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " dev_id int(11) NOT NULL DEFAULT '401900001'," + |
| | | " op_cmd int(11) NOT NULL DEFAULT '0'," + |
| | | " param_teststart_batt_num int(11) NOT NULL DEFAULT '0'," + |
| | | " param_cap int(11) NOT NULL DEFAULT '1'," + |
| | | " param_discharge_curr float NOT NULL DEFAULT '0.001'," + |
| | | " param_mon_curr_high float NOT NULL DEFAULT '0.001'," + |
| | | " param_charge_curr float NOT NULL DEFAULT '0.001'," + |
| | | " param_mon_curr_low float NOT NULL DEFAULT '0.001'," + |
| | | " param_online_vol float NOT NULL DEFAULT '0.01'," + |
| | | " param_charge_curr_low float NOT NULL DEFAULT '0.001'," + |
| | | " param_charge_cap_low float NOT NULL DEFAULT '0.1'," + |
| | | " param_online_vol_recover int(11) NOT NULL DEFAULT '0'," + |
| | | " param_module_address int(11) NOT NULL DEFAULT '1'," + |
| | | " param_junheng_model int(11) NOT NULL DEFAULT '0'," + |
| | | " param_cap_low float NOT NULL DEFAULT '0'," + |
| | | " param_datasource int(11) NOT NULL DEFAULT '0'," + |
| | | " param_res_args int(11) NOT NULL DEFAULT '0'," + |
| | | " param_tmp_high float NOT NULL DEFAULT '0'," + |
| | | " param_res_high float NOT NULL DEFAULT '0'," + |
| | | " PRIMARY KEY (num)," + |
| | | " UNIQUE KEY index_dev_id (dev_id)" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '401900001'," + |
| | | " `op_cmd` int(11) NOT NULL DEFAULT '0'," + |
| | | " `param_teststart_batt_num` int(11) NOT NULL DEFAULT '0' COMMENT '测试起始电池序号'," + |
| | | " `param_cap` int(11) NOT NULL DEFAULT '1' COMMENT '标称容量'," + |
| | | " `param_discharge_curr` float NOT NULL DEFAULT '0.001' COMMENT '放电电流'," + |
| | | " `param_mon_curr_high` float NOT NULL DEFAULT '0.001' COMMENT '单体下限'," + |
| | | " `param_charge_curr` float NOT NULL DEFAULT '0.001' COMMENT '充电电流'," + |
| | | " `param_mon_curr_low` float NOT NULL DEFAULT '0.001' COMMENT '单体上限'," + |
| | | " `param_online_vol` float NOT NULL DEFAULT '0.01' COMMENT '在线电压阈值'," + |
| | | " `param_charge_curr_low` float NOT NULL DEFAULT '0.001' COMMENT '充电电流下限阈值'," + |
| | | " `param_charge_cap_low` float NOT NULL DEFAULT '0.1' COMMENT '充电容量下限阈值'," + |
| | | " `param_online_vol_recover` int(11) NOT NULL DEFAULT '0' COMMENT '在线电压恢复阈值'," + |
| | | " `param_module_address` int(11) NOT NULL DEFAULT '1' COMMENT '模块地址'," + |
| | | " `param_junheng_model` int(11) NOT NULL DEFAULT '0' COMMENT '均衡功能的启用或禁用'," + |
| | | " `param_cap_low` float NOT NULL DEFAULT '0' COMMENT '容量下限'," + |
| | | " `param_datasource` int(11) NOT NULL DEFAULT '0' COMMENT '数据来源0-本机;1-汇集器'," + |
| | | " `param_res_args` int(11) NOT NULL DEFAULT '0' COMMENT '内阻测试系数[1-100]'," + |
| | | " `param_tmp_high` float NOT NULL DEFAULT '0' COMMENT '温度上限'," + |
| | | " `param_res_high` float NOT NULL DEFAULT '0' COMMENT '内阻上限'," + |
| | | " `param_testtime` int(11) NOT NULL DEFAULT '0' COMMENT '放电时间(分钟)[0-5940]'," + |
| | | " `param_mon_vol` float NOT NULL DEFAULT '0' COMMENT '标称单体电压'," + |
| | | " `param_jh_vol` float NOT NULL DEFAULT '0' COMMENT '均衡电压偏移'," + |
| | | " `param_jhtest_interval` int(11) NOT NULL DEFAULT '0' COMMENT '均衡测试间隔(分钟)[1-120]'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " UNIQUE KEY `index_dev_id` (`dev_id`)" + |
| | | ") 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); |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | |
| | | //param_testtime 放电时间(分钟)[0-5940] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_ld9_setparam'" |
| | | + " AND column_name='param_testtime'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Ld9_Setparam_Table |
| | | + " ADD COLUMN `param_testtime` int(11) NOT NULL DEFAULT '0' COMMENT '放电时间(分钟)[0-5940]';"); |
| | | } |
| | | res = null; |
| | | //param_mon_vol 标称单体电压 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_ld9_setparam'" |
| | | + " AND column_name='param_mon_vol'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Ld9_Setparam_Table |
| | | + " ADD COLUMN `param_mon_vol` float NOT NULL DEFAULT '0' COMMENT '标称单体电压';"); |
| | | } |
| | | |
| | | //param_jh_vol 均衡电压偏移 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_ld9_setparam'" |
| | | + " AND column_name='param_jh_vol'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Ld9_Setparam_Table |
| | | + " ADD COLUMN `param_jh_vol` float NOT NULL DEFAULT '0' COMMENT '均衡电压偏移';"); |
| | | } |
| | | |
| | | //param_jhtest_interval 均衡测试间隔(分钟)[1-120] |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_ld9_setparam'" |
| | | + " AND column_name='param_jhtest_interval'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Ld9_Setparam_Table |
| | | + " ADD COLUMN `param_jhtest_interval` int(11) NOT NULL DEFAULT '0' COMMENT '均衡测试间隔(分钟)[1-120]';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |