蓄电池监控管理平台数据库初始化程序
DELL
2024-01-10 bd00843666fc46a112d885a6b629d4020b597149
V1.92 edit at date 2024-01-10
1.新增数据库'db_pwrdev_data_rt.tb_pwrdev_rt_info'
CREATE TABLE `tb_pwrdev_rt_info` (
`num` bigint(20) NOT NULL AUTO_INCREMENT,
`PowerDeviceId` bigint(20) NOT NULL DEFAULT '0',
`record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
`CommTxCount` int(11) NOT NULL DEFAULT '0',
`CommSuccessCount` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`num`),
KEY `index_powerdev_id` (`PowerDeviceId`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
2.表'db_pwrdev_data_rt.tb_pwrdev_acdcdata'新增字段
`chargLimitCurr` float NOT NULL DEFAULT '0',
`junChargeVol` float NOT NULL DEFAULT '0',
`floatChargeVol` float NOT NULL DEFAULT '0',
`acVolH_Limit` float NOT NULL DEFAULT '0',
`acVolL_Limit` float NOT NULL DEFAULT '0',
`dcOutVolH_Limit` float NOT NULL DEFAULT '0',
`dcOutVolL_Limit` float NOT NULL DEFAULT '0',
`acInUseCount` tinyint(4) NOT NULL DEFAULT '0',
6个文件已修改
152 ■■■■■ 已修改文件
BattMonitor_DB_Builder/bin/com/database_util/DB_Pwrdev_Data_Rt.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/version_inf/version_inf.txt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/version_inf/version_inf.txt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/database_util/DB_Pwrdev_Data_Rt.class
Binary files differ
BattMonitor_DB_Builder/bin/com/version_inf/version_inf.txt
@@ -1,6 +1,26 @@
蓄电池监控平台建表程序
    注意:1.新增电源机房时需要重新运行
    
V1.92 edit at date 2024-01-10
    1.新增数据库'db_pwrdev_data_rt.tb_pwrdev_rt_info'
        CREATE TABLE `tb_pwrdev_rt_info` (
          `num` bigint(20) NOT NULL AUTO_INCREMENT,
          `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0',
          `record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
          `CommTxCount` int(11) NOT NULL DEFAULT '0',
          `CommSuccessCount` int(11) NOT NULL DEFAULT '0',
          PRIMARY KEY (`num`),
          KEY `index_powerdev_id` (`PowerDeviceId`)
        ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
    2.表'db_pwrdev_data_rt.tb_pwrdev_acdcdata'新增字段
        `chargLimitCurr` float NOT NULL DEFAULT '0',
        `junChargeVol` float NOT NULL DEFAULT '0',
        `floatChargeVol` float NOT NULL DEFAULT '0',
        `acVolH_Limit` float NOT NULL DEFAULT '0',
        `acVolL_Limit` float NOT NULL DEFAULT '0',
        `dcOutVolH_Limit` float NOT NULL DEFAULT '0',
        `dcOutVolL_Limit` float NOT NULL DEFAULT '0',
        `acInUseCount` tinyint(4) NOT NULL DEFAULT '0',
    
V1.91 edit at date 2023-11-25
    1.新增数据库'db_upspwrdev_data_history'用于存储UPS历史是实时数据记录
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java
@@ -31,6 +31,8 @@
        createUpspower_Simulate_Table(pool,recreate);
        createPwrdev_Rt_Info_Table(pool,recreate);
        System.out.println(" db_pwrdev_data_rt init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
@@ -2149,7 +2151,85 @@
                        + " ADD COLUMN `acIn2_switch_st` int(11) NOT NULL DEFAULT '0' COMMENT '交流输入2分合闸状态    :0---未知(用于兼容以前的),1-分闸,2-合闸,3-脱扣';");
            }
          
            //添加chargLimitCurr字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='chargLimitCurr'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `chargLimitCurr` float NOT NULL DEFAULT '0';");
            }
            //添加junChargeVol字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='junChargeVol'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `junChargeVol` float NOT NULL DEFAULT '0';");
            }
            //添加floatChargeVol字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='floatChargeVol'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `floatChargeVol` float NOT NULL DEFAULT '0';");
            }
            //添加acVolH_Limit字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='acVolH_Limit'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `acVolH_Limit` float NOT NULL DEFAULT '0';");
            }
            //添加acVolL_Limit字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='acVolL_Limit'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `acVolL_Limit` float NOT NULL DEFAULT '0';");
            }
            //添加dcOutVolH_Limit字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='dcOutVolH_Limit'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `dcOutVolH_Limit` float NOT NULL DEFAULT '0';");
            }
            //添加dcOutVolL_Limit字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='dcOutVolL_Limit'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `dcOutVolL_Limit` float NOT NULL DEFAULT '0';");
            }
            //添加acInUseCount字段
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_pwrdev_data_rt'"
                    + " AND table_name='tb_pwrdev_acdcdata'"
                    + " AND column_name='acInUseCount'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
                        + " ADD COLUMN `acInUseCount` tinyint(4) NOT NULL DEFAULT '0';");
            }
            
            
        } catch (SQLException e) {
@@ -2300,6 +2380,35 @@
    }
    
    /**
     *     创建   tb_pwrdev_rt_info 表
     * @param pool
     * @param recreate
     */
    public static void createPwrdev_Rt_Info_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Pwrdev_Rt_Info_Table;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Pwrdev_Rt_Info_Table+ " (" +
                "  `num` bigint(20) NOT NULL AUTO_INCREMENT," +
                "  `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0'," +
                "  `record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00'," +
                "  `CommTxCount` int(11) NOT NULL DEFAULT '0'," +
                "  `CommSuccessCount` int(11) NOT NULL DEFAULT '0'," +
                "  PRIMARY KEY (`num`)," +
                "  KEY `index_powerdev_id` (`PowerDeviceId`)" +
                ") ENGINE=InnoDB 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();
        }
    }
    /**
     *     创建   tb_upspower_simulate 表
     * @param pool
     * @param recreate
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -348,6 +348,7 @@
    public final static String Pwrdev_Event_Table = DB_PWRDEV_DATA_RT + ".`tb_pwrdev_event`";
    public final static String Upspower_Sinal_Table = DB_PWRDEV_DATA_RT + ".`tb_upspower_sinal`";                    //UPS遥信和告警实时状态表
    public final static String Upspower_Simulate_Table = DB_PWRDEV_DATA_RT + ".`tb_upspower_simulate`";                //UPS遥测信息实时状态表
    public final static String Pwrdev_Rt_Info_Table = DB_PWRDEV_DATA_RT + ".`tb_pwrdev_rt_info`";                //UPS遥测信息实时状态表
    
    
    
BattMonitor_DB_Builder/src/com/version_inf/version_inf.txt
@@ -1,6 +1,26 @@
蓄电池监控平台建表程序
    注意:1.新增电源机房时需要重新运行
    
V1.92 edit at date 2024-01-10
    1.新增数据库'db_pwrdev_data_rt.tb_pwrdev_rt_info'
        CREATE TABLE `tb_pwrdev_rt_info` (
          `num` bigint(20) NOT NULL AUTO_INCREMENT,
          `PowerDeviceId` bigint(20) NOT NULL DEFAULT '0',
          `record_datetime` datetime NOT NULL DEFAULT '2005-01-01 00:00:00',
          `CommTxCount` int(11) NOT NULL DEFAULT '0',
          `CommSuccessCount` int(11) NOT NULL DEFAULT '0',
          PRIMARY KEY (`num`),
          KEY `index_powerdev_id` (`PowerDeviceId`)
        ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
    2.表'db_pwrdev_data_rt.tb_pwrdev_acdcdata'新增字段
        `chargLimitCurr` float NOT NULL DEFAULT '0',
        `junChargeVol` float NOT NULL DEFAULT '0',
        `floatChargeVol` float NOT NULL DEFAULT '0',
        `acVolH_Limit` float NOT NULL DEFAULT '0',
        `acVolL_Limit` float NOT NULL DEFAULT '0',
        `dcOutVolH_Limit` float NOT NULL DEFAULT '0',
        `dcOutVolL_Limit` float NOT NULL DEFAULT '0',
        `acInUseCount` tinyint(4) NOT NULL DEFAULT '0',
    
V1.91 edit at date 2023-11-25
    1.新增数据库'db_upspwrdev_data_history'用于存储UPS历史是实时数据记录
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java
@@ -34,7 +34,7 @@
    /**************************************************************************/
    /**************************************************************************/
    public final static boolean app_debug = false;
    public final static float m_VersionNum = (float) 1.91;
    public final static float m_VersionNum = (float) 1.92;
    public final static String m_Version = "Welcome To Use BTS DB BUILDER V" + m_VersionNum + " RC_20180908";
    /**************************************************************************/
    /**************************************************************************/