SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for SYSTEM_DICT
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_DICT`;
CREATE TABLE `SYSTEM_DICT` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `CODE` varchar(50) NOT NULL COMMENT '字典编码',
  `NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典名称',
  `REMARK` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='字典';

-- ----------------------------
-- Table structure for SYSTEM_DICT_DATA
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_DICT_DATA`;
CREATE TABLE `SYSTEM_DICT_DATA` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `DICT_ID` int NOT NULL COMMENT '所属字典',
  `CODE` varchar(50) NOT NULL COMMENT '数据值',
  `LABEL` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据标签',
  `SORT` int NOT NULL DEFAULT '0' COMMENT '排序',
  `DISABLED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否禁用',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='字典数据';

-- ----------------------------
-- Table structure for SYSTEM_JOB
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_JOB`;
CREATE TABLE `SYSTEM_JOB` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `JOB_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'JOB名称',
  `JOB_DESCRIPTION` varchar(500) DEFAULT NULL COMMENT 'JOB描述',
  `HANDLER` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务处理器类',
  `DISTRIBUTE_HANDLER` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '数据分发处理器',
  `DISTRIBUTE_LIMIT` int DEFAULT NULL COMMENT '分发数限制',
  `DISALLOW_CONCURRENT` tinyint(1) NOT NULL COMMENT '是否禁用并发执行',
  `DISABLED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否禁用',
  `WITH_ASYNC` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否开启异步执行',
  `WITH_LOG` tinyint(1) NOT NULL COMMENT '是否记录日志',
  `CRON_EXPRESSION` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'CRON表达式',
  `ALLOW_SERVER_IPS` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '服务器白名单',
  `STATUS` tinyint DEFAULT NULL COMMENT '状态（-1暂停，0准备，1运行中）',
  `NEXT_FIRE_TIME` datetime DEFAULT NULL COMMENT '预计下一次执行时间',
  `LOCK_NUMBER` int NOT NULL DEFAULT '0' COMMENT '锁编号',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COMMENT='系统定时任务';

-- ----------------------------
-- Records of SYSTEM_JOB
-- ----------------------------
BEGIN;
INSERT INTO `SYSTEM_JOB` VALUES (1, '测试任务1', '测试任务', 'commonTestJob', NULL, NULL, 1, 0, 1, 1, '0/10 * * * * ?', '', 0, '2022-04-30 10:22:10', 4147, 1, '2022-02-20 20:13:20', 1, '2022-04-29 11:15:05', 0);
INSERT INTO `SYSTEM_JOB` VALUES (2, '测试任务2', '带分片的任务', 'distributableTestJob', 'distributableTestJobDistributer', 10, 1, 0, 0, 1, '0/10 * * * * ?', '', 0, '2022-04-30 10:22:10', 11157, 1, '2022-02-28 22:05:14', 1, '2022-04-29 11:24:38', 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_JOB_LOG
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_JOB_LOG`;
CREATE TABLE `SYSTEM_JOB_LOG` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `JOB_ID` int NOT NULL COMMENT '定时任务ID',
  `JOB_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务名称',
  `JOB_DISTRIBUTE_GROUP` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '分发组',
  `SNIPPET_ID` int DEFAULT NULL COMMENT '分片ID',
  `SNIPPET_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '分片编码',
  `BUSINESS_TIME` datetime DEFAULT NULL COMMENT '业务时间戳',
  `RUN_TIME_START` datetime NOT NULL COMMENT '执行开始时间',
  `RUN_TIME_END` datetime DEFAULT NULL COMMENT '执行结束时间',
  `RUN_SPEND_TIME` int DEFAULT NULL COMMENT '耗时',
  `PARAMETERS` longtext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '执行参数',
  `HANDLE_TOTAL_SIZE` int DEFAULT NULL COMMENT '处理总数',
  `HANDLE_SUCCESS_SIZE` int DEFAULT NULL COMMENT '处理成功数',
  `SERVER_IP` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '执行任务的服务器IP',
  `STATUS` tinyint NOT NULL COMMENT '状态（0执行失败，1执行成功，2跳过，-1执行中）',
  `CONTEXT` longtext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '任务执行上下文',
  `TRIGGER_TYPE` varchar(10) NOT NULL COMMENT '触发类型，SYSTEM-系统定时触发，MANUAL-手动触发',
  `REMARK` longtext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '备注',
  `CREATE_TIME` datetime NOT NULL COMMENT '日志创建时间',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统定时任务日志';

-- ----------------------------
-- Table structure for SYSTEM_JOB_SNIPPET
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_JOB_SNIPPET`;
CREATE TABLE `SYSTEM_JOB_SNIPPET` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `JOB_ID` int NOT NULL COMMENT '定时任务ID',
  `JOB_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'JOB名称',
  `JOB_DISTRIBUTE_GROUP` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分发组',
  `JOB_BUSINESS_TIME` datetime NOT NULL COMMENT '任务执行业务时间',
  `HANDLER` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分片处理器类',
  `DISTRIBUTE_HANDLER` varchar(200) DEFAULT NULL COMMENT '数据分发处理器',
  `DISTRIBUTE_LIMIT` int DEFAULT NULL COMMENT '分发数限制',
  `SNIPPET_INDEX` int NOT NULL COMMENT '分片索引',
  `SNIPPET_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分片编号',
  `SNIPPET_DATA` longtext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '分片数据',
  `SNIPPET_DATA_SIZE` int DEFAULT '0' COMMENT '分片数据数量',
  `WITH_LOG` tinyint(1) NOT NULL COMMENT '是否记录日志',
  `ALLOW_SERVER_IPS` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '服务器白名单',
  `STATUS` tinyint NOT NULL COMMENT '分片状态（0准备，1运行中，2已完成）',
  `LOCK_NUMBER` int NOT NULL DEFAULT '0' COMMENT '锁编号',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='定时任务片段';

-- ----------------------------
-- Table structure for SYSTEM_MENU
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_MENU`;
CREATE TABLE `SYSTEM_MENU` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `PARENT_ID` int DEFAULT NULL COMMENT '上一级菜单',
  `NAME` varchar(50) NOT NULL COMMENT '菜单名称',
  `PATH` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单访问路径',
  `REMARK` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
  `ICON` varchar(50) DEFAULT NULL COMMENT '图标',
  `DISABLED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否禁用',
  `SORT` int DEFAULT NULL COMMENT '排序',
  `FIXED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为固定菜单',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='系统菜单';

-- ----------------------------
-- Records of SYSTEM_MENU
-- ----------------------------
BEGIN;
INSERT INTO `SYSTEM_MENU` VALUES (1, NULL, '首页', '/index', '系统初始化创建', 'el-icon-s-home', 0, 0, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (2, NULL, '系统管理', '', '系统初始化创建', 'el-icon-setting', 0, 1, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (3, 2, '用户管理', '/system/user', '系统初始化创建', 'el-icon-user-solid', 0, 0, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (4, 2, '角色管理', '/system/role', '系统初始化创建', 'eva-icon-role', 0, 1, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (5, 2, '权限管理', '/system/permission', '系统初始化创建', 'eva-icon-permission', 0, 2, 1, 1,CURRENT_TIMESTAMP,  NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (9, NULL, '系统运维', '', '系统初始化创建', 'el-icon-umbrella', 0, 2, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (10, 9, '菜单管理', '/system/menu', '系统初始化创建', 'el-icon-menu', 0, 0, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (11, 9, '服务监测', '/system/monitor', '系统初始化创建', 'eva-icon-listener', 0, 0, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (12, 9, '字典管理', '/system/dict', '系统初始化创建', 'eva-icon-dictionary', 0, 1, 0, 0, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (14, 9, '定时任务', '', '系统初始化创建', 'el-icon-alarm-clock', 0, 4, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (15, 14, '任务管理', '/system/job', '系统初始化创建', 'el-icon-alarm-clock', 0, 0, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (16, 14, '分片管理', '/system/snippet', '系统初始化创建', 'el-icon-timer', 0, 1, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (17, 14, '任务日志', '/system/job-log', '系统初始化创建', 'eva-icon-log', 0, 2, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (19, 9, '日志管理', '', '系统初始化创建', 'eva-icon-log', 0, 6, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (20, 19, '操作日志', '/system/trace-log', '系统初始化创建', 'eva-icon-log-opera', 0, 0, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_MENU` VALUES (21, 19, '登录日志', '/system/login-log', '系统初始化创建', 'eva-icon-log-login', 0, 1, 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_PERMISSION
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_PERMISSION`;
CREATE TABLE `SYSTEM_PERMISSION` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '权限CODE',
  `NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '权限名称',
  `MODULE` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '模块',
  `REMARK` varchar(500) DEFAULT NULL COMMENT '权限备注',
  `FIXED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为固定权限',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='系统权限';

-- ----------------------------
-- Records of SYSTEM_PERMISSION
-- ----------------------------
BEGIN;
INSERT INTO `SYSTEM_PERMISSION` VALUES (1, 'system:permission:query', '查询权限', '权限管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (2, 'system:permission:create', '创建权限', '权限管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (3, 'system:permission:update', '修改权限', '权限管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (4, 'system:permission:delete', '删除权限', '权限管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (5, 'system:menu:query', '查询菜单', '菜单管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (6, 'system:menu:create', '创建菜单', '菜单管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (7, 'system:menu:update', '修改菜单', '菜单管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (8, 'system:menu:delete', '删除菜单', '菜单管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (9, 'system:menu:sort', '菜单排序', '菜单管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (10, 'system:role:query', '查询角色', '角色管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (11, 'system:role:create', '创建角色', '角色管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (12, 'system:role:update', '修改角色', '角色管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (13, 'system:role:delete', '删除角色', '角色管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (14, 'system:role:createRoleMenu', '配置角色菜单', '角色管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (15, 'system:role:createRolePermission', '配置角色权限', '角色管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (16, 'system:user:query', '查询用户', '系统用户管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (17, 'system:user:create', '创建用户', '系统用户管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (18, 'system:user:update', '更新用户', '系统用户管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (19, 'system:user:delete', '删除用户', '系统用户管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (20, 'system:user:createUserRole', '配置用户角色', '系统用户管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (21, 'system:user:resetPwd', '重置用户密码', '系统用户管理', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (22, 'system:monitor:query', '查询服务监测', '服务监测', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (33, 'system:dict:create', '创建字典', '字典管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (34, 'system:dict:delete', '删除字典', '字典管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (35, 'system:dict:update', '修改字典', '字典管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (36, 'system:dict:query', '查询字典', '字典管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (37, 'system:traceLog:query', '查询操作日志', '日志管理/操作日志', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (38, 'system:loginLog:query', '查询登录日志', '日志管理/登录日志', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (50, 'system:job:trigger', '手动触发任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (51, 'system:job:create', '创建任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (52, 'system:job:delete', '删除任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (53, 'system:job:update', '修改任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (54, 'system:job:query', '查询任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (55, 'system:job:snippet:delete', '删除分片任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (56, 'system:job:snippet:query', '查询分片任务', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_PERMISSION` VALUES (57, 'system:job:log:query', '查询任务日志', '任务管理', '系统初始化创建', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_ROLE
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_ROLE`;
CREATE TABLE `SYSTEM_ROLE` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色CODE',
  `NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称',
  `REMARK` varchar(500) DEFAULT NULL COMMENT '角色备注',
  `FIXED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为固定角色',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='系统角色';

-- ----------------------------
-- Records of SYSTEM_ROLE
-- ----------------------------
BEGIN;
INSERT INTO `SYSTEM_ROLE` VALUES (1, 'admin', '超级管理员', '系统初始化创建', 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_ROLE_MENU
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_ROLE_MENU`;
CREATE TABLE `SYSTEM_ROLE_MENU` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `ROLE_ID` int NOT NULL COMMENT '角色ID',
  `MENU_ID` int NOT NULL COMMENT '菜单ID',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL,
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='角色菜单关联';

-- ----------------------------
-- Records of SYSTEM_ROLE_MENU
-- ----------------------------
BEGIN;
-- 超级管理员角色菜单
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (1, 1, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (2, 1, 2, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (3, 1, 3, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (4, 1, 4, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (5, 1, 5, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (9, 1, 9, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (10, 1, 10, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (11, 1, 11, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (12, 1, 12, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (14, 1, 14, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (15, 1, 15, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (16, 1, 16, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (17, 1, 17, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (19, 1, 19, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (20, 1, 20, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_MENU` VALUES (21, 1, 21, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_ROLE_PERMISSION
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_ROLE_PERMISSION`;
CREATE TABLE `SYSTEM_ROLE_PERMISSION` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `ROLE_ID` int NOT NULL COMMENT '角色ID',
  `PERMISSION_ID` int NOT NULL COMMENT '权限ID',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='角色权限关联';

-- ----------------------------
-- Records of SYSTEM_ROLE_PERMISSION
-- ----------------------------
BEGIN;
-- 超级管理员权限
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (1, 1, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (2, 1, 2, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (3, 1, 3, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (4, 1, 4, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (5, 1, 5, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (6, 1, 6, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (7, 1, 7, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (8, 1, 8, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (9, 1, 9, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (10, 1, 10, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (11, 1, 11, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (12, 1, 12, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (13, 1, 13, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (14, 1, 14, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (15, 1, 15, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (16, 1, 16, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (17, 1, 17, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (18, 1, 18, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (19, 1, 19, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (20, 1, 20, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (21, 1, 21, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (22, 1, 22, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (33, 1, 33, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (34, 1, 34, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (35, 1, 35, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (36, 1, 36, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (37, 1, 37, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (38, 1, 38, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (50, 1, 50, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (51, 1, 51, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (52, 1, 52, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (53, 1, 53, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (54, 1, 54, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (55, 1, 55, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (56, 1, 56, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_ROLE_PERMISSION` VALUES (57, 1, 57, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_USER
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_USER`;
CREATE TABLE `SYSTEM_USER` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户名',
  `REALNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '真实姓名',
  `EMP_NO` varchar(50) DEFAULT NULL COMMENT '工号',
  `BIRTHDAY` date DEFAULT NULL COMMENT '生日',
  `SEX` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '性别',
  `EMAIL` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱',
  `MOBILE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '手机号码',
  `AVATAR` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像',
  `PASSWORD` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码',
  `SALT` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码盐',
  `FIXED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为固定用户',
  `CREATE_USER` int DEFAULT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='系统用户';

-- ----------------------------
-- Records of SYSTEM_USER
-- ----------------------------
BEGIN;
INSERT INTO `SYSTEM_USER` VALUES (1, 'admin', '伊娃', NULL, NULL, '1', NULL, NULL, '/avatar/man.png', '5ca1f224ef123998d99d8738e7727253', 'kl38c6', 1, NULL, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_USER_ROLE
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_USER_ROLE`;
CREATE TABLE `SYSTEM_USER_ROLE` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `USER_ID` int NOT NULL COMMENT '用户ID',
  `ROLE_ID` int NOT NULL COMMENT '角色ID',
  `CREATE_USER` int NOT NULL COMMENT '创建人',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_USER` int DEFAULT NULL COMMENT '更新人',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `DELETED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COMMENT='用户角色关联';

-- ----------------------------
-- Records of SYSTEM_USER_ROLE
-- ----------------------------
BEGIN;
INSERT INTO `SYSTEM_USER_ROLE` VALUES (1, 1, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `SYSTEM_USER_ROLE` VALUES (2, 2, 2, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for SYSTEM_TRACE_LOG
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_TRACE_LOG`;
CREATE TABLE `SYSTEM_TRACE_LOG` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `USER_ID` int DEFAULT NULL COMMENT '用户',
  `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '固化用户名',
  `USER_REALNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '固化用户姓名',
  `USER_ROLES` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '固化用户角色',
  `USER_PERMISSIONS` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '固化用户权限',
  `OPERA_MODULE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作模块',
  `OPERA_TYPE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作类型',
  `OPERA_REMARK` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作备注',
  `OPERA_TIME` datetime NOT NULL COMMENT '操作开始时间',
  `OPERA_SPEND_TIME` int DEFAULT NULL COMMENT '耗时',
  `REQUEST_METHOD` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '请求方式',
  `REQUEST_URI` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '请求地址',
  `REQUEST_PARAMS` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '请求参数',
  `REQUEST_RESULT` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '请求结果',
  `STATUS` tinyint NOT NULL DEFAULT '-1' COMMENT '状态（0操作失败，1操作成功，-1未得到处理）',
  `EXCEPTION_LEVEL` tinyint DEFAULT NULL COMMENT '异常等级',
  `EXCEPTION_STACK` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '异常信息',
  `SERVER_IP` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '服务器IP',
  `SYSTEM_VERSION` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '接口版本',
  `PLATFORM` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作平台',
  `IP` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户IP',
  `CLIENT_INFO` varchar(500) DEFAULT NULL COMMENT '客户端信息',
  `OS_INFO` varchar(500) DEFAULT NULL COMMENT '系统信息',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跟踪日志';

-- ----------------------------
-- Table structure for SYSTEM_LOGIN_LOG
-- ----------------------------
DROP TABLE IF EXISTS `SYSTEM_LOGIN_LOG`;
CREATE TABLE `SYSTEM_LOGIN_LOG` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `USER_ID` int DEFAULT NULL COMMENT '登录用户ID',
  `LOGIN_USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '登录用户名',
  `IP` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '登录IP',
  `LOCATION` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '登录地址',
  `CLIENT_INFO` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '客户端',
  `OS_INFO` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '操作系统',
  `PLATFORM` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '登录平台',
  `SYSTEM_VERSION` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '系统版本',
  `SERVER_IP` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '服务器IP',
  `SUCCESS` tinyint(1) DEFAULT NULL COMMENT '是否登录成功',
  `REASON` varchar(200) DEFAULT NULL COMMENT '失败原因',
  `LOGIN_TIME` datetime NOT NULL COMMENT '登录时间',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='登录日志';

SET FOREIGN_KEY_CHECKS = 1;
