--
-- Table structure for table `sys_dept`
--
CREATE TABLE IF NOT EXISTS `sys_dept` (
  `dept_id` bigint NOT NULL AUTO_INCREMENT COMMENT '部门ID',
  `parent_id` bigint NULL DEFAULT 0 COMMENT '父部门ID 默认0',
  `ancestors` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '祖级列表',
  `dept_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '部门名称',
  `dept_sort` int NULL DEFAULT 0 COMMENT '显示顺序',
  `leader` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '负责人',
  `phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '联系电话',
  `email` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '邮箱',
  `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删除）',
  `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 '更新时间',
  PRIMARY KEY (`dept_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 200 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统_部门表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- COLUMN for sys_dept
-- ----------------------------
ALTER TABLE `sys_dept` DROP COLUMN `order_num`;
ALTER TABLE `sys_dept` DROP COLUMN `status`;
ALTER TABLE `sys_dept` MODIFY COLUMN `dept_id` bigint(20) NOT NULL COMMENT '部门ID' FIRST;
ALTER TABLE `sys_dept` MODIFY COLUMN `parent_id` bigint(20) NULL DEFAULT 0 COMMENT '父部门ID 默认0' AFTER `dept_id`;
ALTER TABLE `sys_dept` MODIFY COLUMN `ancestors` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '祖级列表' AFTER `parent_id`;
ALTER TABLE `sys_dept` MODIFY COLUMN `dept_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '部门名称' AFTER `ancestors`;
ALTER TABLE `sys_dept` ADD COLUMN `dept_sort` int(11) NULL DEFAULT 0 COMMENT '显示顺序' AFTER `dept_name`;
ALTER TABLE `sys_dept` MODIFY COLUMN `leader` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '负责人' AFTER `dept_sort`;
ALTER TABLE `sys_dept` MODIFY COLUMN `phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '联系电话' AFTER `leader`;
ALTER TABLE `sys_dept` MODIFY COLUMN `email` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '邮箱' AFTER `phone`;
ALTER TABLE `sys_dept` ADD COLUMN `status_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '部门状态（0停用 1正常）' AFTER `email`;
ALTER TABLE `sys_dept` 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_dept` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者' AFTER `del_flag`;
ALTER TABLE `sys_dept` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者' AFTER `create_time`;
ALTER TABLE `sys_dept` COMMENT = '系统_部门表';
ALTER TABLE `sys_dept` MODIFY COLUMN `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门ID';

-- ----------------------------
-- Data of sys_dept
-- ----------------------------
REPLACE INTO `sys_dept` VALUES (100, 0, '0', 'dept.root', 0, 'system', '', '', '1', '0', 'system', 1699348237468, 'system', 1699348237468);
REPLACE INTO `sys_dept` VALUES (101, 100, '0,100', 'dept.root.item1', 1, 'system', '', '', '1', '0', 'system', 1699348237468, 'system', 1699348237468);

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