From dc8172e6dd21fc51486376f64f2f5ca5a0bc373f Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期四, 24 八月 2023 10:34:04 +0800
Subject: [PATCH] 2.表'web_site.tb_workflow_main'新增字段 		`process_level` varchar(45) DEFAULT NULL COMMENT '流程所在层级',

---
 BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 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 0b9c897..82ba79a 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
@@ -101,6 +101,8 @@
 		
 		createFbs9100_SetParam_Temp_Table(pool, recreate);			//本年度二次核容放电参数
 		
+		createFault_Upload_Application_Table(pool, recreate);		//故障隐患上传表,用于故障隐患考核
+		
 		System.out.println(" DB_web_site init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
 	}
 	
@@ -4979,6 +4981,7 @@
 				"  `end_time` datetime DEFAULT NULL COMMENT '归档时间'," + 
 				"  `task_level` int(11) DEFAULT NULL COMMENT '任务级别'," + 
 				"  `is_in_time` tinyint(4) DEFAULT NULL COMMENT '是否及时'," + 
+				"  `process_level` varchar(45) DEFAULT NULL COMMENT '流程所在层级'," + 
 				"  `alarm_order_id` int(11) DEFAULT NULL COMMENT '告警工单id'," + 
 				"  `status` tinyint(4) DEFAULT NULL COMMENT '工单状态 0:自动派单,2:人工派单,3:工单T1处理中,4:工单T2处理中,5:归档'," + 
 				"  `file_name` varchar(45) DEFAULT NULL COMMENT '附件名称'," + 
@@ -4991,11 +4994,31 @@
 				"  PRIMARY KEY (`id`)" + 
 				") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流主表';";
 		Sql_Mysql sql = new Sql_Mysql(pool.getConn());
+		ResultSet res = null;
 		try {
 			sql.sqlMysqlExecute(str_str);
+			
+			
+			/************************** 添加 process_level 字段 **************************************/
+			String sql_str03 = " SELECT * FROM information_schema.columns  "
+					+ " WHERE table_schema= 'web_site' "
+					+ " AND table_name='tb_workflow_main' "
+					+ " AND column_name='process_level'";
+			res = sql.sqlMysqlQuery(sql_str03);
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Workflow_Main_Table 
+								+ " ADD COLUMN `process_level` varchar(45) DEFAULT NULL COMMENT '流程所在层级';");
+			}
 		} catch (SQLException e) {
 			e.printStackTrace();
 		} finally {
+			if(null != res) {
+				try {
+					res.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
+				}
+			}
 			sql.close_con();
 		}
 		
@@ -5639,6 +5662,53 @@
 		}
 	}
 	
+	/**
+	 * 	故障隐患上传表
+	 * @param pool
+	 * @param recreate
+	 */
+	public static void createFault_Upload_Application_Table(MysqlConnPool pool, boolean recreate) {
+		String sql_str_del = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Fault_Upload_Application_Table;
+		String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Fault_Upload_Application_Table + " (" + 
+				" `id` int(11) NOT NULL AUTO_INCREMENT," + 
+				"  `alarm_num` int(11) DEFAULT NULL COMMENT '告警实时表的id'," + 
+				"  `alarm_type` int(11) DEFAULT NULL COMMENT '告警分类:1-电池,2-设备,3-电源'," + 
+				"  `station_id` int(11) DEFAULT NULL," + 
+				"  `type` int(11) DEFAULT NULL," + 
+				"  `description` varchar(500) DEFAULT NULL," + 
+				"  `upload_user_id` int(11) DEFAULT NULL," + 
+				"  `confirm_user_id` int(11) DEFAULT NULL," + 
+				"  `confirm_description` varchar(500) DEFAULT NULL," + 
+				"  `confirm_time` datetime DEFAULT NULL," + 
+				"  `status` tinyint(4) DEFAULT NULL COMMENT '0:待确认,1确认属实,-1确认不属实'," + 
+				"  `create_time` datetime DEFAULT NULL," + 
+				"  `main_id` int(11) DEFAULT NULL," + 
+				"  PRIMARY KEY (`id`)" + 
+				") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='故障隐患上传表,用于故障隐患考核';";
+		Sql_Mysql sql = new Sql_Mysql(pool.getConn());
+		ResultSet res = null;
+		
+		try {
+			if(recreate) {
+				sql.sqlMysqlExecute(sql_str_del);
+			}
+			sql.sqlMysqlExecute(sql_str);
+			
+			
+		} catch (SQLException e) {
+			e.printStackTrace();
+		} finally {
+			if(null != res) {
+				try {
+					res.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
+				}
+			}			
+			sql.close_con();
+		}
+	}
+	
 	
 	/**
 	 *	设置指定的线程重启[ 告警线程; ]

--
Gitblit v1.9.1