From ab1ec6fb619da42450df4c10fce694e2c810cffb Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期二, 08 六月 2021 11:46:47 +0800
Subject: [PATCH] V1.56 edit at date 2021-06-08 	1.新增用户登陆限制表'db_user.tb_user_limit' 	2.用户表新增'login_type'[登陆状态]字段 	3.新增南京送检蓄电池告警表'db_ram_db.tb_batt_rtalarm'和'db_ram_db.tb_batt_rsalarm'表的建表语句

---
 BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java b/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
index cd0842f..acfe8e2 100644
--- a/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
+++ b/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
@@ -55,13 +55,7 @@
 		
 		createUser_Battgroup_Baojigroup_Table(pool, recreate);
 		
-		
-	
-	
-	
-	
-	
-	
+		createUser_Limit_Table(pool, recreate);	
 	
 	
 	
@@ -846,6 +840,32 @@
 		}
 	}
 	
+	
+	/**
+	 * 
+	 */
+	public static void createUser_Limit_Table(MysqlConnPool pool, boolean recreate) {
+		String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.User_Limit_Table;
+		String sql_str02 = "CREATE TABLE  IF NOT EXISTS " + Sql_Mysql.User_Limit_Table + " (" + 
+				"  `id` int(11) NOT NULL AUTO_INCREMENT," + 
+				"  `userId` int(11) DEFAULT NULL," + 
+				"  `limitDuration` int(3) DEFAULT NULL COMMENT '限制时间,单位:秒'," + 
+				"  `loginTime` datetime DEFAULT NULL COMMENT '登录时间'," + 
+				"  PRIMARY KEY (`id`)" + 
+				") ENGINE=InnoDB AUTO_INCREMENT=36 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();
+		}
+	}
+	
 	/**
 	 * 创建线程手动启动工具表
 	 */
@@ -948,6 +968,15 @@
 				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf 
 								+ " ADD COLUMN `license` text DEFAULT NULL;");
 			}
+			//添加login_type[登陆状态]
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_user'"
+					+ " AND table_name='tb_user_inf'"
+					+ " AND column_name='login_type'");
+			if(false == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf 
+								+ " ADD COLUMN `login_type` tinyint(1) DEFAULT '1' COMMENT '登录类型:1-密码,2-人脸';");
+			}
 			res = sql.sqlMysqlQuery("SELECT COUNT(*) as num_count FROM " + Sql_Mysql.TB_UserInf);
 			if(res.next()) {
 				int count = res.getInt("num_count");

--
Gitblit v1.9.1