蓄电池监控管理平台数据库初始化程序
LiJun
2018-11-16 a47761ab730e6219bd8caedb11249b9a1554e07a
添加电池参数表
7个文件已修改
104 ■■■■■ 已修改文件
BattMonitor_DB_Builder/bin/.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/Sql_Mysql.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/main/main_BTS_DB_Builder.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/.gitignore
@@ -1 +1,2 @@
/com/
/main/
BattMonitor_DB_Builder/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/Sql_Mysql.class
Binary files differ
BattMonitor_DB_Builder/bin/main/main_BTS_DB_Builder.class
Binary files differ
BattMonitor_DB_Builder/src/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.java
@@ -314,5 +314,77 @@
        }
    }
    /**
     *    创建GPRS状态表
     * @param conn_pool
     * @param recreate_tb
     */
    public static void createBTSGPRSState_Table(MysqlConnPool conn_pool, boolean recreate_tb) {
        String str1 = "DROP TABLE IF EXISTS "+Sql_Mysql.BTSGPRSState_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSGPRSState_Table
                + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                + "`op_cmd` INT NOT NULL DEFAULT 0, "
                + "`AT_cmd` varchar(20) NOT NULL DEFAULT '', "
                + "`ack_inf` varchar(50) NOT NULL DEFAULT '', "
                + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
                + " PRIMARY KEY (`num`) ) "
                + " ENGINE=InnoDB DEFAULT CHARSET=utf8";
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            if(true == recreate_tb) {
                sql.sqlMysqlExecute(str1);
            }else{
                //sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.BTSGPRSState_Table);
            }
            sql.sqlMysqlExecute(str2);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     *     创建电池参数表
     */
    public static void createBattParam_Table(MysqlConnPool conn_pool, boolean recreate_tb) {
        String str1 = "DROP TABLE IF EXISTS "+Sql_Mysql.FBS9100BattParam_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100BattParam_Table
            + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
            + "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
            + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
            + "`op_cmd` INT NOT NULL DEFAULT 0, "
            + "`STD_CAP` INT NOT NULL DEFAULT 0, "
            + "`STD_RES` INT NOT NULL DEFAULT 0, "
            + "`BattGroupCount` INT NOT NULL DEFAULT 0, "
            + "`EachGroupBattCount` INT NOT NULL DEFAULT 0, "
            + "`MonomerVol` FLOAT NOT NULL DEFAULT 0, "
            + "`GroupVol` FLOAT NOT NULL DEFAULT 0, "
            + "`BattTemp` FLOAT NOT NULL DEFAULT 0, "
            + "`FloatChargeVol` FLOAT NOT NULL DEFAULT 0, "
            + "`FloatChargeCurr` FLOAT NOT NULL DEFAULT 0, "
            + "`OnlineVolLow` FLOAT NOT NULL DEFAULT 0, "
            + "`GroupConnType` INT NOT NULL DEFAULT 0, "
            + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
            + " PRIMARY KEY (`num`) ) "
            + " ENGINE=MEMORY DEFAULT CHARSET=utf8";
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try {
            if(true == recreate_tb) {
                sql.sqlMysqlExecute(str1);
            }
            sql.sqlMysqlExecute(str2);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    public static void main(String[] args) {
        MysqlConnPool conn_pool = new MysqlConnPool("123.207.82.239",3360,5);
        createBattParam_Table(conn_pool,false);
    }
}
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -77,7 +77,11 @@
    
    public final static String BTSStationState_Table = DB_RamDB + ".`tb_bts_station_state`";                        //机房状态表
    
    public final static String FBS9100SysParam_Table = DB_RamDB + ".`tb_fbs9100_sysparam`";                            //
    public final static String FBS9100SysParam_Table = DB_RamDB + ".`tb_fbs9100_sysparam`";                            //系统参数表
    public final static String BTSGPRSState_Table = DB_RamDB + ".`tb_bts_gprs_state`";                                //gprs 信息表
    public final static String FBS9100BattParam_Table = DB_RamDB + ".`tb_fbs9100_battparam`";                        //电池组参数表
    //--------------------------------------------------------------------------------------------//
    //--------------------------------------------------------------------------------------------//
    public final static String AppSys_Table = DB_AppSys + ".`tb_app_sys`";
@@ -249,16 +253,26 @@
                "  `record_time` datetime NOT NULL DEFAULT '2018-01-01 00:00:00'," + 
                "  `error_descript` longtext NOT NULL," + 
                "  `uid` int(11) NOT NULL DEFAULT '1002'," + 
                        "  `uname` varchar(64) NOT NULL DEFAULT ''," +
                "  `error_en` int(11) NOT NULL DEFAULT '0'," + 
                        "  `error_dispose` longtext NOT NULL," +
                "  `note` varchar(64) NOT NULL DEFAULT ''," + 
                "  `picture_one` blob," +
                "  `picture_two` blob," +
                "  `picture_three` blob," +
                "  `picture_four` blob," +
                        "  `picture_one` longblob," +
                        "  `picture_two` longblob," +
                        "  `picture_three` longblob," +
                        "  `picture_four` longblob," +
                "  `picture_num` int(11) NOT NULL DEFAULT '0'," + 
                        "  `solve_picture_one` longblob," +
                        "  `solve_picture_two` longblob," +
                        "  `solve_picture_three` longblob," +
                        "  `solve_picture_four` longblob," +
                        "  `solve_picture_num` int(11) NOT NULL DEFAULT '0'," +
                        "  `solve_uid` int(11) NOT NULL DEFAULT '1002'," +
                        "  `solve_uname` varchar(64) NOT NULL DEFAULT ''," +
                        "  `solve_record_time` datetime NOT NULL DEFAULT '2018-01-01 00:00:00'," +
                "  PRIMARY KEY (`num`)," + 
                "  KEY `stationid_index` (`stationid`)" + 
                ") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
                        ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        
        String table_3 = "CREATE TABLE IF NOT EXISTS " + BattMainInf_Table
                        + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java
@@ -66,6 +66,11 @@
        //创建tb_server_state表并且设置表中的值
        BattData_RT_RamDB_Thread_SQL.createServerState_RamDB_Table(GB_MysqlConnPool, recreate_tb);
        
        //创建tb_bts_gprs_state表
        BattData_RT_RamDB_Thread_SQL.createBTSGPRSState_Table(GB_MysqlConnPool, recreate_tb);
        //创建tb_fbs9100_battparam表
        BattData_RT_RamDB_Thread_SQL.createBattParam_Table(GB_MysqlConnPool, recreate_tb);
        
        /*********************************************************************************/
        System.out.println("Recreate RamDB Tables State Is '" + recreate_tb + "'");