-- ----------------------------
-- 系统管理用户表
-- ----------------------------
drop table if exists `train_exam`.`sys_user`;
CREATE TABLE `train_exam`.`sys_user`  (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录账号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户昵称',
`user_type` tinyint NULL DEFAULT 1 COMMENT '用户类型(0系统用户，1企业级用户，2部门级用户，3车间级(岗位)级，4其他，默认0)',
`phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '手机号码',
`sex` tinyint NULL DEFAULT 2 COMMENT '用户性别(0男，1女，2未知，默认2)',
`company_id` bigint(20) NULL DEFAULT NULL COMMENT '公司id',
`parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父级账号id',
`password` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
`status` tinyint NULL DEFAULT 0 COMMENT '账号状态(0正常，1停用，默认0)',
`del_flag` tinyint NULL DEFAULT 0 COMMENT '删除标志(0代表存在，2代表删除，默认0)',
`login_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '最后登录ip',
`login_date` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
`pwd_update_date` datetime NULL DEFAULT NULL COMMENT '密码最后更新时间',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`version` int NULL DEFAULT 0 COMMENT '乐观锁',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `index_username`(`username`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统管理用户表' ROW_FORMAT = Dynamic;

insert into sys_user values(1, 'admin', '国科鸿宇', 0, '15888888888', 0, null, '$2a$10$CrsAZufp851DxTmUBep7TOuUAESWdqlkrReAIR.4SHBIahl9exO6y',  0, 0, '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', sysdate(), '管理员',0);
