--
-- Table structure for table `sys_user`
--

CREATE TABLE IF NOT EXISTS `sys_user` (
  `user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `dept_id` bigint NULL DEFAULT 0 COMMENT '部门ID',
  `user_name` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户账号',
  `nick_name` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户昵称',
  `email` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户邮箱',
  `phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '手机号码',
  `sex` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '用户性别（0未选择 1男 2女）',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '头像地址',
  `password` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '密码',
  `user_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'System' COMMENT '用户类型（System系统用户）',
  `user_source` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '#' COMMENT '用户来源UID (系统#)',
  `status_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '账号状态（0停用 1正常）',
  `del_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标记（0存在 1删除）',
  `password_update_time` bigint NULL DEFAULT 0 COMMENT '密码更新时间',
  `login_count` bigint NULL DEFAULT 0 COMMENT '登录次数',
  `login_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '最后登录IP',
  `login_time` bigint NULL DEFAULT 0 COMMENT '最后登录时间',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` bigint NULL DEFAULT 0 COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` bigint NULL DEFAULT 0 COMMENT '更新时间',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统_用户信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- COLUMN for sys_user
-- ----------------------------
ALTER TABLE `sys_user` MODIFY COLUMN `user_name` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户账号' AFTER `dept_id`;
ALTER TABLE `sys_user` MODIFY COLUMN `nick_name` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户昵称' AFTER `user_name`;
ALTER TABLE `sys_user` ADD COLUMN `phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '手机号码' AFTER `email`;
ALTER TABLE `sys_user` MODIFY COLUMN `sex` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '用户性别（0未选择 1男 2女）' AFTER `phone`;
ALTER TABLE `sys_user` MODIFY COLUMN `password` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '密码' AFTER `avatar`;
ALTER TABLE `sys_user` ADD COLUMN `status_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '账号状态（0停用 1正常）' AFTER `password`;
ALTER TABLE `sys_user` MODIFY COLUMN `del_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标记（0存在 1删除）' AFTER `status_flag`;
ALTER TABLE `sys_user` ADD COLUMN `password_update_time` bigint(20) NULL DEFAULT 0 COMMENT '密码更新时间' AFTER `del_flag`;
ALTER TABLE `sys_user` ADD COLUMN `login_count` bigint(20) NULL DEFAULT 0 COMMENT '登录次数' AFTER `password_update_time`;
ALTER TABLE `sys_user` ADD COLUMN `login_time` bigint(20) NULL DEFAULT 0 COMMENT '最后登录时间' AFTER `login_ip`;
ALTER TABLE `sys_user` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者' AFTER `login_time`;
ALTER TABLE `sys_user` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者' AFTER `create_time`;
ALTER TABLE `sys_user` MODIFY COLUMN `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `update_time`;
ALTER TABLE `sys_user` ADD COLUMN `user_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'System' COMMENT '用户类型（System系统用户）' AFTER `password`;
ALTER TABLE `sys_user` ADD COLUMN `user_source` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '#' COMMENT '用户来源UID (系统#)' AFTER `user_type`;
ALTER TABLE `sys_user` COMMENT = '系统_用户信息表';

-- ----------------------------
-- Data for sys_user
-- ----------------------------
INSERT IGNORE INTO `sys_user` VALUES (1, 100, 'supervisor', 'supervisor', '', '', '0', '', '$2a$10$QgIcp6yuOEGrEU0TNU12K.uQRLbcufesEU7hiRYlRSSdUO7OAkoTq', 'System', '#', '1', '0', 0, 0, '127.0.0.1', 0, 'system', 0, '', 0, '');
INSERT IGNORE INTO `sys_user` VALUES (2, 100, 'admin', 'admin', '', '', '0', '', '$2a$10$QgIcp6yuOEGrEU0TNU12K.uQRLbcufesEU7hiRYlRSSdUO7OAkoTq', 'System', '#', '1', '0', 0, 0, '127.0.0.1', 0, 'system', 0, '', 0, '');
INSERT IGNORE INTO `sys_user` VALUES (3, 100, 'manager', 'manager', '', '', '0', '', '$2a$10$RND3fUw9Ai.WcggYSI57tu.u3OIlktdPxFzlWkmiHC1paV038t0I2', 'System', '#', '1', '0', 0, 0, '127.0.0.1', 0, 'system', 0, '', 0, '');
INSERT IGNORE INTO `sys_user` VALUES (4, 100, 'monitor', 'monitor', '', '', '0', '', '$2a$10$t3zpKQ0olECotFyI1yO43.tCoS0EXoSRBDcqwl09xvrsmn14qFHHy', 'System', '#', '1', '0', 0, 0, '127.0.0.1', 0, 'system', 0, '', 0, '');
UPDATE `sys_user` SET `status_flag` = '1', `user_type` = 'System', `user_source` = '#' WHERE `user_id` in (1,2,3,4);


-- Dump completed on 2025-02-14 15:26:56
