| | |
| | | |
| | | createTb_Resset_Station_Table(pool, recreate); //创建内阻测试计划表 |
| | | |
| | | createTb_Badld9_Mon_Table(pool, recreate); //创建LD9落后单体信息表 |
| | | |
| | | System.out.println(" DB_web_site init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | } |
| | | |
| | |
| | | String station_id = res.getString("StationId"); |
| | | sql.sqlMysqlExecute("INSERT INTO web_site.tb_resset_station(stationid) VALUES("+station_id+");"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | /** |
| | | * 创建LD9落后单体信息表 |
| | | * @param pool |
| | | * @param recreate |
| | | */ |
| | | private static void createTb_Badld9_Mon_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Badld9_Mon_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Badld9_Mon_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 ' '," + |
| | | " `flag` int(11) DEFAULT '4' COMMENT '1:损坏,2:劣化,3:优秀时(note 1),4,无法判断'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_num` (`battgroupid`)" + |
| | | ") ENGINE=InnoDB 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); |
| | | //添加tb_badld9_mon |
| | | String sql_str1 = " SELECT * FROM information_schema.columns " |
| | | + " WHERE table_schema= 'web_site' " |
| | | + " AND table_name='tb_badld9_mon' " |
| | | + " AND column_name='flag'"; |
| | | res = sql.sqlMysqlQuery(sql_str1); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute(" ALTER TABLE " + Sql_Mysql.Tb_Badld9_Mon_Table |
| | | + " ADD COLUMN `flag` int(11) DEFAULT '4' COMMENT '1:损坏,2:劣化,3:优秀时(note 1),4,无法判断';"); |
| | | } |
| | | |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | |
| | | " `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 ' '," + |
| | | " `flag` int(11) DEFAULT '4'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_num` (`battgroupid`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=1 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); |
| | | |
| | | String sql_str2 = " SELECT * FROM information_schema.columns " |
| | | + " WHERE table_schema= 'web_site' " |
| | | + " AND table_name='tb_badbatt_mon' " |
| | | + " AND column_name='flag'"; |
| | | //System.out.println(sql_str3); |
| | | rs = sql.sqlMysqlQuery(sql_str2); |
| | | if(false == rs.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BadbattMon_Table |
| | | + " ADD COLUMN `flag` int(11) DEFAULT '4' COMMENT '1:损坏,2:劣化,3:优秀时(note 1),4,无法判断';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |