From 9ecd2bf82d543e86b12a10d8e33b0085111cdd1d Mon Sep 17 00:00:00 2001 From: whycrzg <ruanzhigang@whycst.com> Date: 星期一, 06 十二月 2021 12:04:20 +0800 Subject: [PATCH] V1.95 edit at date 2021-12-6 1:新增`db_app_sys`.`tb_page_param2` 模板表创建并初始化数据,db_user.tb_user_inf表下添加字段 --- BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java | 66 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 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 43badfd..fbe02e7 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 @@ -1000,6 +1000,72 @@ sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1002', '1', 'superuser', '1234567', '100010000', '12345678', '15346259512', '123456789@qq.com', '', '1990-04-20', '2016-03-28', '男', '湖北省', '软件工程师', 'authority111', '默认班组', 'dutie', '完成软件的研发工作', '0', 'note', 'c4ca4238a0b923820dcc509a6f75849b', '', '', '14031C0F0136063E', '27', '','0');"); } } + + + //添加old_password + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='old_password'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `old_password` varchar(64) DEFAULT NULL COMMENT '旧的密码';"); + } + //添加type + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='type'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `type` tinyint(1) DEFAULT '1' COMMENT '账号类型 1:长期,2:临时 ';"); + } + //添加status + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='status'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `status` tinyint(1) DEFAULT '1' COMMENT '账号状态 1:激活,2:休眠,3:锁定,0:注销';"); + } + //添加expiration_time + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='expiration_time'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `expiration_time` datetime DEFAULT NULL COMMENT '临时账号的到期时间';"); + } + //添加last_login_time + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='last_login_time'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间';"); + } + //添加password_update_time + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='password_update_time'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `password_update_time` datetime DEFAULT NULL COMMENT '密码更新时间,至少3个月一次';"); + } + + //添加create_time + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_user'" + + " AND table_name='tb_user_inf'" + + " AND column_name='create_time'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_UserInf + + " ADD COLUMN `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间';"); + } } catch (SQLException e) { e.printStackTrace(); } finally { -- Gitblit v1.9.1