From 4c3d8b9cebc0aae5a16d45f13321c8303ae6cda8 Mon Sep 17 00:00:00 2001 From: Uncarbon <75737767+uncarbon97@users.noreply.github.com> Date: Sat, 27 Jul 2024 16:29:29 +0800 Subject: [PATCH] =?UTF-8?q?bump:=20=E5=8F=91=E5=B8=832.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit details see: https://helio.uncarbon.cc/#/i18n/zh-CN/appendix/change-log --- attachments/db/MySQL/helio_boot.sql | 1009 ++++----- .../db/MySQL/upgrade/2.0.0_to_2.1.0.sql | 35 + attachments/db/PostgreSQL/helio_boot.sql | 1982 ++++++++--------- .../db/PostgreSQL/upgrade/2.0.0_to_2.1.0.sql | 64 + pom.xml | 4 +- .../model/response/SelectOptionItemVO.java | 2 + .../web/sys/AdminSysDataDictController.java | 100 +- .../entity/SysDataDictClassifiedEntity.java | 50 + .../module/sys/entity/SysDataDictEntity.java | 59 - .../sys/entity/SysDataDictItemEntity.java | 62 + .../mapper/SysDataDictClassifiedMapper.java | 31 + ...Mapper.java => SysDataDictItemMapper.java} | 6 +- .../AdminInsertOrUpdateSysDataDictDTO.java | 65 - ...ysDataDictClassifiedInsertOrUpdateDTO.java | 53 + ...=> AdminSysDataDictClassifiedListDTO.java} | 17 +- ...AdminSysDataDictItemInsertOrUpdateDTO.java | 65 + .../request/AdminSysDataDictItemListDTO.java | 31 + ...ctBO.java => SysDataDictClassifiedBO.java} | 42 +- .../sys/model/response/SysDataDictItemBO.java | 67 + .../sys/service/SysDataDictService.java | 279 ++- src/main/resources/application.yml | 2 + .../cc/uncarbon/test/ExampleUnitTest.java | 6 +- 22 files changed, 2273 insertions(+), 1758 deletions(-) create mode 100644 attachments/db/MySQL/upgrade/2.0.0_to_2.1.0.sql create mode 100644 attachments/db/PostgreSQL/upgrade/2.0.0_to_2.1.0.sql create mode 100644 src/main/java/cc/uncarbon/module/sys/entity/SysDataDictClassifiedEntity.java delete mode 100644 src/main/java/cc/uncarbon/module/sys/entity/SysDataDictEntity.java create mode 100644 src/main/java/cc/uncarbon/module/sys/entity/SysDataDictItemEntity.java create mode 100644 src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictClassifiedMapper.java rename src/main/java/cc/uncarbon/module/sys/mapper/{SysDataDictMapper.java => SysDataDictItemMapper.java} (50%) delete mode 100644 src/main/java/cc/uncarbon/module/sys/model/request/AdminInsertOrUpdateSysDataDictDTO.java create mode 100644 src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedInsertOrUpdateDTO.java rename src/main/java/cc/uncarbon/module/sys/model/request/{AdminListSysDataDictDTO.java => AdminSysDataDictClassifiedListDTO.java} (50%) create mode 100644 src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemInsertOrUpdateDTO.java create mode 100644 src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemListDTO.java rename src/main/java/cc/uncarbon/module/sys/model/response/{SysDataDictBO.java => SysDataDictClassifiedBO.java} (61%) create mode 100644 src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictItemBO.java diff --git a/attachments/db/MySQL/helio_boot.sql b/attachments/db/MySQL/helio_boot.sql index 679501c..dce42f4 100644 --- a/attachments/db/MySQL/helio_boot.sql +++ b/attachments/db/MySQL/helio_boot.sql @@ -1,501 +1,508 @@ -SET NAMES utf8mb4; -SET -FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for 数据表模板 --- ---------------------------- -DROP TABLE IF EXISTS `数据表模板`; -CREATE TABLE `数据表模板` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据表注释'; - --- ---------------------------- --- Records of 数据表模板 --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_data_dict --- ---------------------------- -DROP TABLE IF EXISTS `sys_data_dict`; -CREATE TABLE `sys_data_dict` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `camel_case_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '驼峰式键名', - `under_case_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '下划线式键名', - `pascal_case_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '帕斯卡式键名', - `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键值', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '描述', - `unit` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位', - `value_range` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '取值范围', - `alias_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '别称键名', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典'; - --- ---------------------------- --- Records of sys_data_dict --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_dept --- ---------------------------- -DROP TABLE IF EXISTS `sys_dept`; -CREATE TABLE `sys_dept` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', - `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '上级ID(根节点设置为0)', - `sort` int(11) NOT NULL DEFAULT 1 COMMENT '排序', - `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '部门'; - --- ---------------------------- --- Records of sys_dept --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_log --- ---------------------------- -DROP TABLE IF EXISTS `sys_log`; -CREATE TABLE `sys_log` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', - `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户账号', - `operation` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作内容', - `method` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求方法', - `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求参数', - `ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IP地址', - `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(参考SysLogStatusEnum)', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台操作日志'; - --- ---------------------------- --- Records of sys_log --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_menu --- ---------------------------- -DROP TABLE IF EXISTS `sys_menu`; -CREATE TABLE `sys_menu` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', - `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '上级菜单ID(根节点设置为0)', - `type` int(11) NOT NULL DEFAULT 1 COMMENT '菜单类型(参考MenuTypeEnum)', - `permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限标识', - `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标', - `sort` int(11) NULL DEFAULT 1 COMMENT '排序', - `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', - `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件', - `external_link` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '外链地址', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台菜单'; - --- ---------------------------- --- Records of sys_menu --- ---------------------------- -BEGIN; -INSERT INTO `sys_menu` -VALUES (1, 0, 1, 0, '2021-06-01 17:16:48', NULL, '2021-06-02 17:14:16', NULL, '系统管理', 0, 0, 'Sys', - 'ant-design:setting-outlined', 3, 1, 'LAYOUT', ''), - (2, 0, 1, 0, '2021-06-01 17:13:13', NULL, '2021-07-18 00:10:33', 'admin', '中控台', 0, 0, 'Dashboard', - 'ant-design:appstore-outlined', 1, 1, 'LAYOUT', ''), - (3, 0, 1, 0, '2021-06-01 17:14:22', NULL, '2021-06-02 11:24:38', NULL, '分析页(后台登录后默认首页)', 2, 1, - 'Dashboard:analysis', 'ant-design:fund-outlined', 1, 1, '/dashboard/analysis/index', ''), - (4, 0, 1, 0, '2021-06-01 17:14:47', NULL, '2021-06-02 11:32:23', NULL, '工作台', 2, 1, 'Dashboard:workbench', - 'ant-design:database-outlined', 2, 1, '/dashboard/workbench/index', ''), - (5, 0, 1, 0, '2021-06-01 17:15:38', NULL, '2021-07-15 23:56:43', 'admin', '关于', 0, 1, 'About', - 'ant-design:eye-outlined', 2, 1, '/sys/about/index', ''), - (6, 0, 1, 0, '2021-06-02 16:06:58', NULL, '2021-07-17 23:55:52', 'admin', '学(mo)习(yu)', 2, 3, '', - 'ant-design:zhihu-outlined', 3, 1, 'https://www.zhihu.com/', 'https://www.zhihu.com/'), - (7, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '部门管理', 1, 1, 'SysDept', - 'ant-design:flag-outlined', 1, 1, '/sys/SysDept/index', ''), - (8, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '查询', 7, 2, 'SysDept:retrieve', NULL, 1, - 1, NULL, ''), - (9, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '新增', 7, 2, 'SysDept:create', NULL, 2, 1, - NULL, ''), - (10, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '删除', 7, 2, 'SysDept:delete', NULL, 3, 1, - NULL, ''), - (11, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 7, 2, 'SysDept:update', NULL, 4, 1, - NULL, ''), - (12, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '角色管理', 1, 1, 'SysRole', - 'ant-design:usergroup-add-outlined', 2, 1, '/sys/SysRole/index', ''), - (13, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '查询', 12, 2, 'SysRole:retrieve', NULL, 1, - 1, NULL, ''), - (14, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '新增', 12, 2, 'SysRole:create', NULL, 2, - 1, NULL, ''), - (15, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '删除', 12, 2, 'SysRole:delete', NULL, 3, - 1, NULL, ''), - (16, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 12, 2, 'SysRole:update', NULL, 4, - 1, NULL, ''), - (17, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '后台用户', 1, 1, 'SysUser', - 'ant-design:user-outlined', 3, 1, '/sys/SysUser/index', ''), - (18, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '查询', 17, 2, 'SysUser:retrieve', NULL, 1, - 1, NULL, ''), - (19, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '新增', 17, 2, 'SysUser:create', NULL, 2, - 1, NULL, ''), - (20, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '删除', 17, 2, 'SysUser:delete', NULL, 3, - 1, NULL, ''), - (21, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '编辑', 17, 2, 'SysUser:update', NULL, 4, - 1, NULL, ''), - (22, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '菜单管理', 1, 1, 'SysMenu', - 'ant-design:align-left-outlined', 4, 1, '/sys/SysMenu/index', ''), - (23, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '查询', 22, 2, 'SysMenu:retrieve', NULL, 1, - 1, NULL, ''), - (24, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '新增', 22, 2, 'SysMenu:create', NULL, 2, - 1, NULL, ''), - (25, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '删除', 22, 2, 'SysMenu:delete', NULL, 3, - 1, NULL, ''), - (26, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '编辑', 22, 2, 'SysMenu:update', NULL, 4, - 1, NULL, ''), - (27, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '参数管理', 1, 1, 'SysParam', - 'ant-design:ant-design-outlined', 5, 1, '/sys/SysParam/index', ''), - (28, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 27, 2, 'SysParam:retrieve', NULL, - 1, 1, NULL, ''), - (29, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '新增', 27, 2, 'SysParam:create', NULL, 2, - 1, NULL, ''), - (30, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '删除', 27, 2, 'SysParam:delete', NULL, 3, - 1, NULL, ''), - (31, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '编辑', 27, 2, 'SysParam:update', NULL, 4, - 1, NULL, ''), - (32, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '租户管理', 1, 1, 'SysTenant', - 'ant-design:aliyun-outlined', 6, 1, '/sys/SysTenant/index', ''), - (33, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 32, 2, 'SysTenant:retrieve', NULL, - 1, 1, NULL, ''), - (34, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '新增', 32, 2, 'SysTenant:create', NULL, 2, - 1, NULL, ''), - (35, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '删除', 32, 2, 'SysTenant:delete', NULL, 3, - 1, NULL, ''), - (36, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '编辑', 32, 2, 'SysTenant:update', NULL, 4, - 1, NULL, ''), - (37, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '数据字典', 1, 1, 'SysDataDict', - 'ant-design:field-string-outlined', 7, 1, '/sys/SysDataDict/index', ''), - (38, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '查询', 37, 2, 'SysDataDict:retrieve', - NULL, 1, 1, NULL, ''), - (39, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '新增', 37, 2, 'SysDataDict:create', NULL, - 2, 1, NULL, ''), - (40, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '删除', 37, 2, 'SysDataDict:delete', NULL, - 3, 1, NULL, ''), - (41, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '编辑', 37, 2, 'SysDataDict:update', NULL, - 4, 1, NULL, ''), - (42, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '系统日志', 1, 1, 'SysLog', - 'ant-design:edit-twotone', 8, 1, '/sys/SysLog/index', ''), - (43, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '查询', 42, 2, 'SysLog:retrieve', NULL, 1, - 1, NULL, ''), - (44, 0, 1, 0, '2021-07-17 23:37:26', 'admin', '2021-07-17 23:38:28', 'admin', '修改当前用户密码', 1, 1, '', - 'ant-design:compass-outlined', 9, 1, '/sys/SysUser/change-password/index', ''), - (45, 0, 1, 0, '2021-07-17 23:39:41', 'admin', '2021-07-17 23:39:41', 'admin', '重置某用户密码', 17, 2, - 'SysUser:resetPassword', 'ant-design:redo-outlined', 5, 1, NULL, ''), - (46, 0, 1, 0, '2021-07-17 23:40:26', 'admin', '2021-07-17 23:40:26', 'admin', '绑定用户与角色关联关系', 17, 2, - 'SysUser:bindRoles', 'ant-design:share-alt-outlined', 6, 1, NULL, ''), - (47, 0, 1, 0, '2021-07-17 23:40:47', 'admin', '2021-07-17 23:41:15', 'admin', '踢某用户下线', 17, 2, 'SysUser:kickOut', - 'ant-design:disconnect-outlined', 7, 1, 'LAYOUT', ''), - (48, 0, 1, 0, '2022-06-29 17:35:26', 'admin', '2022-06-29 17:35:26', 'admin', '绑定角色与菜单关联关系', 12, 2, 'SysRole:bindMenus', - 'ant-design:share-alt-outlined', 5, 1, NULL, ''); -COMMIT; - --- ---------------------------- --- Table structure for sys_param --- ---------------------------- -DROP TABLE IF EXISTS `sys_param`; -CREATE TABLE `sys_param` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键名', - `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键值', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '描述', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统参数'; - --- ---------------------------- --- Records of sys_param --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_role --- ---------------------------- -DROP TABLE IF EXISTS `sys_role`; -CREATE TABLE `sys_role` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', - `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台角色'; - --- ---------------------------- --- Records of sys_role --- ---------------------------- -BEGIN; -INSERT INTO `sys_role` -VALUES (1, 0, 1, 0, '2021-04-17 02:34:30', NULL, '2021-06-07 16:22:28', 'admin', '超级管理员(代码中固定拥有所有菜单的权限)', 'SuperAdmin'); -COMMIT; - --- ---------------------------- --- Table structure for sys_role_menu_relation --- ---------------------------- -DROP TABLE IF EXISTS `sys_role_menu_relation`; -CREATE TABLE `sys_role_menu_relation` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `role_id` bigint(20) NOT NULL COMMENT '角色ID', - `menu_id` bigint(20) NOT NULL COMMENT '菜单ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台角色-可见菜单关联'; - --- ---------------------------- --- Records of sys_role_menu_relation --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_tenant --- ---------------------------- -DROP TABLE IF EXISTS `sys_tenant`; -CREATE TABLE `sys_tenant` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', - `tenant_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户名', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', - `tenant_admin_user_id` bigint(20) NULL DEFAULT NULL COMMENT '租户管理员用户ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统租户'; - --- ---------------------------- --- Records of sys_tenant --- ---------------------------- -BEGIN; -INSERT INTO `sys_tenant` -VALUES (1, 1, 0, '2021-05-11 16:06:47', '', '2021-06-10 16:29:32', 'admin', '可无视SQL拦截器', '超级租户', 0, 1, 1); -COMMIT; - --- ---------------------------- --- Table structure for sys_user --- ---------------------------- -DROP TABLE IF EXISTS `sys_user`; -CREATE TABLE `sys_user` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `pin` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账号', - `pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码', - `salt` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '盐', - `nickname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '昵称', - `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', - `gender` int(11) NULL DEFAULT 0 COMMENT '性别', - `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '邮箱', - `phone_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', - `last_login_at` datetime NULL DEFAULT NULL COMMENT '最后登录时刻', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台用户'; - --- ---------------------------- --- Records of sys_user --- ---------------------------- -BEGIN; -INSERT INTO `sys_user` -VALUES (1, 0, 1, 0, '2021-04-06 09:56:02', NULL, '2021-06-28 16:37:07', 'admin', 'admin', - 'b7f6692251833658a56ff2d09e9835b91384d203721bf27a544586d3c9a379ff', '6a8e9339-dfd1-4cfe-80cb-30ca9fc3d81e', - '超级管理员', 1, 0, 'admin@example.com', '17874585544', '2021-07-18 00:32:08'); -COMMIT; - --- ---------------------------- --- Table structure for sys_user_dept_relation --- ---------------------------- -DROP TABLE IF EXISTS `sys_user_dept_relation`; -CREATE TABLE `sys_user_dept_relation` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `user_id` bigint(20) NOT NULL COMMENT '用户ID', - `dept_id` bigint(20) NOT NULL COMMENT '部门ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台用户-部门关联'; - --- ---------------------------- --- Records of sys_user_dept_relation --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_user_role_relation --- ---------------------------- -DROP TABLE IF EXISTS `sys_user_role_relation`; -CREATE TABLE `sys_user_role_relation` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `user_id` bigint(20) NOT NULL COMMENT '用户ID', - `role_id` bigint(20) NOT NULL COMMENT '角色ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台用户-角色关联'; - --- ---------------------------- --- Records of sys_user_role_relation --- ---------------------------- -BEGIN; -INSERT INTO `sys_user_role_relation` -VALUES (1, 0, 1, 0, '2021-01-01 18:22:12', NULL, '2021-01-01 18:22:12', NULL, 1, 1); -COMMIT; - -SET -FOREIGN_KEY_CHECKS = 1; - - --- v1.7.2 - Uncarbon - 默认内置文件上传功能 --- 建表 oss_file_info -DROP TABLE IF EXISTS `oss_file_info`; -CREATE TABLE `oss_file_info` -( - `id` bigint(20) NOT NULL COMMENT '主键ID', - `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', - `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', - `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', - `created_at` datetime(0) NOT NULL COMMENT '创建时刻', - `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', - `updated_at` datetime(0) NOT NULL COMMENT '更新时刻', - `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', - `storage_platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储平台', - `storage_base_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '基础存储路径', - `storage_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储路径', - `storage_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储文件名', - `original_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '原始文件名', - `extend_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '扩展名', - `file_size` bigint(20) NOT NULL COMMENT '文件大小', - `md5` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'MD5', - `classified` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件类别', - `direct_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对象存储直链', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传文件信息' ROW_FORMAT = Dynamic; - --- v1.7.2 - Uncarbon - 新增上传文件信息后台管理菜单 -INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, - `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, - `external_link`) -VALUES (20220922152710, NULL, 1, 0, '2022-12-25 23:09:30', 'admin', '2022-12-26 22:02:31', 'admin', '文件管理', 0, 0, - 'Oss', 'ant-design:file-outlined', 4, 1, NULL, ''); -INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, - `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, - `external_link`) -VALUES (20220922152714, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-12-26 22:03:14', 'admin', - '上传文件信息管理', 20220922152710, 1, 'OssFileInfo', 'ant-design:save-twotone', 1, 1, '/oss/OssFileInfo/index', - ''); -INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, - `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, - `external_link`) -VALUES (20220922152715, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-12-26 22:01:58', 'admin', '查询', - 20220922152714, 2, 'OssFileInfo:retrieve', NULL, 1, 1, NULL, ''); -INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, - `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, - `external_link`) -VALUES (20220922152718, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-12-26 22:02:09', 'admin', '删除', - 20220922152714, 2, 'OssFileInfo:delete', NULL, 2, 1, NULL, ''); - --- v1.8.0 - Uncarbon - 新增错误原因堆栈、用户UA、IP属地字段;表注释更新 -ALTER TABLE sys_log - ADD COLUMN error_stacktrace varchar(3000) NOT NULL DEFAULT '' COMMENT '错误原因堆栈' AFTER status, - ADD COLUMN user_agent varchar(255) NOT NULL DEFAULT '' COMMENT '用户UA' AFTER error_stacktrace, - ADD COLUMN ip_location_region_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-国家或地区名' AFTER user_agent, - ADD COLUMN ip_location_province_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-省级行政区名' AFTER ip_location_region_name, - ADD COLUMN ip_location_city_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-市级行政区名' AFTER ip_location_province_name, - ADD COLUMN ip_location_district_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-县级行政区名' AFTER ip_location_city_name; -ALTER TABLE sys_log COMMENT = '系统日志'; +SET NAMES utf8mb4; +SET +FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for 数据表模板 +-- ---------------------------- +DROP TABLE IF EXISTS `数据表模板`; +CREATE TABLE `数据表模板` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据表注释'; + +-- ---------------------------- +-- Records of 数据表模板 +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_data_dict_classified & sys_data_dict_item +-- ---------------------------- +CREATE TABLE `sys_data_dict_classified` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类编码', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '分类描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典分类' ROW_FORMAT = Dynamic; + +CREATE TABLE `sys_data_dict_item` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `classified_id` bigint(20) NOT NULL COMMENT '所属分类ID', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典项编码', + `label` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典项标签', + `value` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典项值', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态', + `sort` int(11) NOT NULL DEFAULT 1 COMMENT '排序', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典项' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dept`; +CREATE TABLE `sys_dept` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '上级ID(根节点设置为0)', + `sort` int(11) NOT NULL DEFAULT 1 COMMENT '排序', + `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '部门'; + +-- ---------------------------- +-- Records of sys_dept +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_log`; +CREATE TABLE `sys_log` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户账号', + `operation` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作内容', + `method` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求方法', + `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求参数', + `ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IP地址', + `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(参考SysLogStatusEnum)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台操作日志'; + +-- ---------------------------- +-- Records of sys_log +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '上级菜单ID(根节点设置为0)', + `type` int(11) NOT NULL DEFAULT 1 COMMENT '菜单类型(参考MenuTypeEnum)', + `permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限标识', + `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标', + `sort` int(11) NULL DEFAULT 1 COMMENT '排序', + `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', + `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件', + `external_link` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '外链地址', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台菜单'; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +BEGIN; +INSERT INTO `sys_menu` +VALUES (1, 0, 1, 0, '2021-06-01 17:16:48', NULL, '2021-06-02 17:14:16', NULL, '系统管理', 0, 0, 'Sys', + 'ant-design:setting-outlined', 3, 1, 'LAYOUT', ''), + (2, 0, 1, 0, '2021-06-01 17:13:13', NULL, '2021-07-18 00:10:33', 'admin', '中控台', 0, 0, 'Dashboard', + 'ant-design:appstore-outlined', 1, 1, 'LAYOUT', ''), + (3, 0, 1, 0, '2021-06-01 17:14:22', NULL, '2021-06-02 11:24:38', NULL, '分析页(后台登录后默认首页)', 2, 1, + 'Dashboard:analysis', 'ant-design:fund-outlined', 1, 1, '/dashboard/analysis/index', ''), + (4, 0, 1, 0, '2021-06-01 17:14:47', NULL, '2021-06-02 11:32:23', NULL, '工作台', 2, 1, 'Dashboard:workbench', + 'ant-design:database-outlined', 2, 1, '/dashboard/workbench/index', ''), + (5, 0, 1, 0, '2021-06-01 17:15:38', NULL, '2021-07-15 23:56:43', 'admin', '关于', 0, 1, 'About', + 'ant-design:eye-outlined', 2, 1, '/sys/about/index', ''), + (6, 0, 1, 0, '2021-06-02 16:06:58', NULL, '2021-07-17 23:55:52', 'admin', '学(mo)习(yu)', 2, 3, '', + 'ant-design:zhihu-outlined', 3, 1, 'https://www.zhihu.com/', 'https://www.zhihu.com/'), + (7, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '部门管理', 1, 1, 'SysDept', + 'ant-design:flag-outlined', 1, 1, '/sys/SysDept/index', ''), + (8, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '查询', 7, 2, 'SysDept:retrieve', NULL, 1, + 1, NULL, ''), + (9, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '新增', 7, 2, 'SysDept:create', NULL, 2, 1, + NULL, ''), + (10, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '删除', 7, 2, 'SysDept:delete', NULL, 3, 1, + NULL, ''), + (11, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 7, 2, 'SysDept:update', NULL, 4, 1, + NULL, ''), + (12, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '角色管理', 1, 1, 'SysRole', + 'ant-design:usergroup-add-outlined', 2, 1, '/sys/SysRole/index', ''), + (13, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '查询', 12, 2, 'SysRole:retrieve', NULL, 1, + 1, NULL, ''), + (14, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '新增', 12, 2, 'SysRole:create', NULL, 2, + 1, NULL, ''), + (15, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '删除', 12, 2, 'SysRole:delete', NULL, 3, + 1, NULL, ''), + (16, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 12, 2, 'SysRole:update', NULL, 4, + 1, NULL, ''), + (17, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '后台用户', 1, 1, 'SysUser', + 'ant-design:user-outlined', 3, 1, '/sys/SysUser/index', ''), + (18, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '查询', 17, 2, 'SysUser:retrieve', NULL, 1, + 1, NULL, ''), + (19, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '新增', 17, 2, 'SysUser:create', NULL, 2, + 1, NULL, ''), + (20, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '删除', 17, 2, 'SysUser:delete', NULL, 3, + 1, NULL, ''), + (21, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '编辑', 17, 2, 'SysUser:update', NULL, 4, + 1, NULL, ''), + (22, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '菜单管理', 1, 1, 'SysMenu', + 'ant-design:align-left-outlined', 4, 1, '/sys/SysMenu/index', ''), + (23, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '查询', 22, 2, 'SysMenu:retrieve', NULL, 1, + 1, NULL, ''), + (24, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '新增', 22, 2, 'SysMenu:create', NULL, 2, + 1, NULL, ''), + (25, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '删除', 22, 2, 'SysMenu:delete', NULL, 3, + 1, NULL, ''), + (26, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '编辑', 22, 2, 'SysMenu:update', NULL, 4, + 1, NULL, ''), + (27, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '参数管理', 1, 1, 'SysParam', + 'ant-design:ant-design-outlined', 5, 1, '/sys/SysParam/index', ''), + (28, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 27, 2, 'SysParam:retrieve', NULL, + 1, 1, NULL, ''), + (29, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '新增', 27, 2, 'SysParam:create', NULL, 2, + 1, NULL, ''), + (30, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '删除', 27, 2, 'SysParam:delete', NULL, 3, + 1, NULL, ''), + (31, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '编辑', 27, 2, 'SysParam:update', NULL, 4, + 1, NULL, ''), + (32, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '租户管理', 1, 1, 'SysTenant', + 'ant-design:aliyun-outlined', 6, 1, '/sys/SysTenant/index', ''), + (33, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 32, 2, 'SysTenant:retrieve', NULL, + 1, 1, NULL, ''), + (34, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '新增', 32, 2, 'SysTenant:create', NULL, 2, + 1, NULL, ''), + (35, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '删除', 32, 2, 'SysTenant:delete', NULL, 3, + 1, NULL, ''), + (36, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '编辑', 32, 2, 'SysTenant:update', NULL, 4, + 1, NULL, ''), + (37, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '数据字典', 1, 1, 'SysDataDict', + 'ant-design:field-string-outlined', 7, 1, '/sys/SysDataDict/index', ''), + (38, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '查询', 37, 2, 'SysDataDict:retrieve', + NULL, 1, 1, NULL, ''), + (39, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '新增', 37, 2, 'SysDataDict:create', NULL, + 2, 1, NULL, ''), + (40, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '删除', 37, 2, 'SysDataDict:delete', NULL, + 3, 1, NULL, ''), + (41, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '编辑', 37, 2, 'SysDataDict:update', NULL, + 4, 1, NULL, ''), + (42, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '系统日志', 1, 1, 'SysLog', + 'ant-design:edit-twotone', 8, 1, '/sys/SysLog/index', ''), + (43, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '查询', 42, 2, 'SysLog:retrieve', NULL, 1, + 1, NULL, ''), + (44, 0, 1, 0, '2021-07-17 23:37:26', 'admin', '2021-07-17 23:38:28', 'admin', '修改当前用户密码', 1, 1, '', + 'ant-design:compass-outlined', 9, 1, '/sys/SysUser/change-password/index', ''), + (45, 0, 1, 0, '2021-07-17 23:39:41', 'admin', '2021-07-17 23:39:41', 'admin', '重置某用户密码', 17, 2, + 'SysUser:resetPassword', 'ant-design:redo-outlined', 5, 1, NULL, ''), + (46, 0, 1, 0, '2021-07-17 23:40:26', 'admin', '2021-07-17 23:40:26', 'admin', '绑定用户与角色关联关系', 17, 2, + 'SysUser:bindRoles', 'ant-design:share-alt-outlined', 6, 1, NULL, ''), + (47, 0, 1, 0, '2021-07-17 23:40:47', 'admin', '2021-07-17 23:41:15', 'admin', '踢某用户下线', 17, 2, 'SysUser:kickOut', + 'ant-design:disconnect-outlined', 7, 1, 'LAYOUT', ''), + (48, 0, 1, 0, '2022-06-29 17:35:26', 'admin', '2022-06-29 17:35:26', 'admin', '绑定角色与菜单关联关系', 12, 2, 'SysRole:bindMenus', + 'ant-design:share-alt-outlined', 5, 1, NULL, ''); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_param +-- ---------------------------- +DROP TABLE IF EXISTS `sys_param`; +CREATE TABLE `sys_param` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键名', + `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键值', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统参数'; + +-- ---------------------------- +-- Records of sys_param +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台角色'; + +-- ---------------------------- +-- Records of sys_role +-- ---------------------------- +BEGIN; +INSERT INTO `sys_role` +VALUES (1, 0, 1, 0, '2021-04-17 02:34:30', NULL, '2021-06-07 16:22:28', 'admin', '超级管理员(代码中固定拥有所有菜单的权限)', 'SuperAdmin'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_role_menu_relation +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_menu_relation`; +CREATE TABLE `sys_role_menu_relation` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + `menu_id` bigint(20) NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台角色-可见菜单关联'; + +-- ---------------------------- +-- Records of sys_role_menu_relation +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_tenant +-- ---------------------------- +DROP TABLE IF EXISTS `sys_tenant`; +CREATE TABLE `sys_tenant` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `tenant_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户名', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', + `tenant_admin_user_id` bigint(20) NULL DEFAULT NULL COMMENT '租户管理员用户ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统租户'; + +-- ---------------------------- +-- Records of sys_tenant +-- ---------------------------- +BEGIN; +INSERT INTO `sys_tenant` +VALUES (1, 1, 0, '2021-05-11 16:06:47', '', '2021-06-10 16:29:32', 'admin', '可无视SQL拦截器', '超级租户', 0, 1, 1); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `pin` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账号', + `pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码', + `salt` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '盐', + `nickname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '昵称', + `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(0=禁用 1=启用)', + `gender` int(11) NULL DEFAULT 0 COMMENT '性别', + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '邮箱', + `phone_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', + `last_login_at` datetime NULL DEFAULT NULL COMMENT '最后登录时刻', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台用户'; + +-- ---------------------------- +-- Records of sys_user +-- ---------------------------- +BEGIN; +INSERT INTO `sys_user` +VALUES (1, 0, 1, 0, '2021-04-06 09:56:02', NULL, '2021-06-28 16:37:07', 'admin', 'admin', + 'b7f6692251833658a56ff2d09e9835b91384d203721bf27a544586d3c9a379ff', '6a8e9339-dfd1-4cfe-80cb-30ca9fc3d81e', + '超级管理员', 1, 0, 'admin@example.com', '17874585544', '2021-07-18 00:32:08'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_dept_relation +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_dept_relation`; +CREATE TABLE `sys_user_dept_relation` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `dept_id` bigint(20) NOT NULL COMMENT '部门ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台用户-部门关联'; + +-- ---------------------------- +-- Records of sys_user_dept_relation +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_role_relation +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_role_relation`; +CREATE TABLE `sys_user_role_relation` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '后台用户-角色关联'; + +-- ---------------------------- +-- Records of sys_user_role_relation +-- ---------------------------- +BEGIN; +INSERT INTO `sys_user_role_relation` +VALUES (1, 0, 1, 0, '2021-01-01 18:22:12', NULL, '2021-01-01 18:22:12', NULL, 1, 1); +COMMIT; + +SET +FOREIGN_KEY_CHECKS = 1; + + +-- v1.7.2 - Uncarbon - 默认内置文件上传功能 +-- 建表 oss_file_info +DROP TABLE IF EXISTS `oss_file_info`; +CREATE TABLE `oss_file_info` +( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime(0) NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime(0) NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `storage_platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储平台', + `storage_base_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '基础存储路径', + `storage_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储路径', + `storage_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储文件名', + `original_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '原始文件名', + `extend_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '扩展名', + `file_size` bigint(20) NOT NULL COMMENT '文件大小', + `md5` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'MD5', + `classified` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件类别', + `direct_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对象存储直链', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传文件信息' ROW_FORMAT = Dynamic; + +-- v1.7.2 - Uncarbon - 新增上传文件信息后台管理菜单 +INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, + `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, + `external_link`) +VALUES (20220922152710, NULL, 1, 0, '2022-12-25 23:09:30', 'admin', '2022-12-26 22:02:31', 'admin', '文件管理', 0, 0, + 'Oss', 'ant-design:file-outlined', 4, 1, NULL, ''); +INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, + `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, + `external_link`) +VALUES (20220922152714, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-12-26 22:03:14', 'admin', + '上传文件信息管理', 20220922152710, 1, 'OssFileInfo', 'ant-design:save-twotone', 1, 1, '/oss/OssFileInfo/index', + ''); +INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, + `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, + `external_link`) +VALUES (20220922152715, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-12-26 22:01:58', 'admin', '查询', + 20220922152714, 2, 'OssFileInfo:retrieve', NULL, 1, 1, NULL, ''); +INSERT INTO `sys_menu` (`id`, `tenant_id`, `revision`, `del_flag`, `created_at`, `created_by`, `updated_at`, + `updated_by`, `title`, `parent_id`, `type`, `permission`, `icon`, `sort`, `status`, `component`, + `external_link`) +VALUES (20220922152718, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-12-26 22:02:09', 'admin', '删除', + 20220922152714, 2, 'OssFileInfo:delete', NULL, 2, 1, NULL, ''); + +-- v1.8.0 - Uncarbon - 新增错误原因堆栈、用户UA、IP属地字段;表注释更新 +ALTER TABLE sys_log + ADD COLUMN error_stacktrace varchar(3000) NOT NULL DEFAULT '' COMMENT '错误原因堆栈' AFTER status, + ADD COLUMN user_agent varchar(255) NOT NULL DEFAULT '' COMMENT '用户UA' AFTER error_stacktrace, + ADD COLUMN ip_location_region_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-国家或地区名' AFTER user_agent, + ADD COLUMN ip_location_province_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-省级行政区名' AFTER ip_location_region_name, + ADD COLUMN ip_location_city_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-市级行政区名' AFTER ip_location_province_name, + ADD COLUMN ip_location_district_name varchar(100) NOT NULL DEFAULT '' COMMENT 'IP地址属地-县级行政区名' AFTER ip_location_city_name; +ALTER TABLE sys_log COMMENT = '系统日志'; diff --git a/attachments/db/MySQL/upgrade/2.0.0_to_2.1.0.sql b/attachments/db/MySQL/upgrade/2.0.0_to_2.1.0.sql new file mode 100644 index 0000000..382e808 --- /dev/null +++ b/attachments/db/MySQL/upgrade/2.0.0_to_2.1.0.sql @@ -0,0 +1,35 @@ +-- 重构数据字典,拆分为`sys_data_dict_classified`(数据字典分类)和`sys_data_dict_item`(数据字典项),并重新设计字段 +CREATE TABLE `sys_data_dict_classified` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类编码', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '分类描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典分类' ROW_FORMAT = Dynamic; + +CREATE TABLE `sys_data_dict_item` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID', + `revision` bigint(20) NOT NULL DEFAULT 1 COMMENT '乐观锁', + `del_flag` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '逻辑删除标识', + `created_at` datetime NOT NULL COMMENT '创建时刻', + `created_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者', + `updated_at` datetime NOT NULL COMMENT '更新时刻', + `updated_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者', + `classified_id` bigint(20) NOT NULL COMMENT '所属分类ID', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典项编码', + `label` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典项标签', + `value` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典项值', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态', + `sort` int(11) NOT NULL DEFAULT 1 COMMENT '排序', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典项' ROW_FORMAT = Dynamic; diff --git a/attachments/db/PostgreSQL/helio_boot.sql b/attachments/db/PostgreSQL/helio_boot.sql index d4c6745..b361a63 100644 --- a/attachments/db/PostgreSQL/helio_boot.sql +++ b/attachments/db/PostgreSQL/helio_boot.sql @@ -1,993 +1,989 @@ --- ---------------------------- --- Table structure for sys_data_dict --- ---------------------------- -DROP TABLE IF EXISTS "sys_data_dict"; -CREATE TABLE "sys_data_dict" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "camel_case_key" varchar(100) NOT NULL, - "under_case_key" varchar(100) NOT NULL, - "pascal_case_key" varchar(100) NOT NULL, - "value" varchar(255) NOT NULL, - "description" varchar(255) NOT NULL, - "unit" varchar(30), - "value_range" varchar(255), - "alias_key" varchar(100) -) -; -COMMENT -ON COLUMN "sys_data_dict"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_data_dict"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_data_dict"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_data_dict"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_data_dict"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_data_dict"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_data_dict"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_data_dict"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_data_dict"."camel_case_key" IS '驼峰式键名'; -COMMENT -ON COLUMN "sys_data_dict"."under_case_key" IS '下划线式键名'; -COMMENT -ON COLUMN "sys_data_dict"."pascal_case_key" IS '帕斯卡式键名'; -COMMENT -ON COLUMN "sys_data_dict"."value" IS '键值'; -COMMENT -ON COLUMN "sys_data_dict"."description" IS '描述'; -COMMENT -ON COLUMN "sys_data_dict"."unit" IS '单位'; -COMMENT -ON COLUMN "sys_data_dict"."value_range" IS '取值范围'; -COMMENT -ON COLUMN "sys_data_dict"."alias_key" IS '别称键名'; -COMMENT -ON TABLE "sys_data_dict" IS '数据字典'; - --- ---------------------------- --- Records of sys_data_dict --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_dept --- ---------------------------- -DROP TABLE IF EXISTS "sys_dept"; -CREATE TABLE "sys_dept" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "title" varchar(50) NOT NULL, - "parent_id" int8 NOT NULL, - "sort" int4 NOT NULL, - "status" int4 NOT NULL -) -; -COMMENT -ON COLUMN "sys_dept"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_dept"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_dept"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_dept"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_dept"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_dept"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_dept"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_dept"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_dept"."title" IS '名称'; -COMMENT -ON COLUMN "sys_dept"."parent_id" IS '上级ID(根节点设置为0)'; -COMMENT -ON COLUMN "sys_dept"."sort" IS '排序'; -COMMENT -ON COLUMN "sys_dept"."status" IS '状态(0=禁用 1=启用)'; -COMMENT -ON TABLE "sys_dept" IS '部门'; - --- ---------------------------- --- Records of sys_dept --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_log --- ---------------------------- -DROP TABLE IF EXISTS "sys_log"; -CREATE TABLE "sys_log" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "user_id" int8, - "username" varchar(50), - "operation" varchar(255), - "method" varchar(500), - "params" text, - "ip" varchar(128), - "status" int4 NOT NULL -) -; -COMMENT -ON COLUMN "sys_log"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_log"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_log"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_log"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_log"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_log"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_log"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_log"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_log"."user_id" IS '用户ID'; -COMMENT -ON COLUMN "sys_log"."username" IS '用户账号'; -COMMENT -ON COLUMN "sys_log"."operation" IS '操作内容'; -COMMENT -ON COLUMN "sys_log"."method" IS '请求方法'; -COMMENT -ON COLUMN "sys_log"."params" IS '请求参数'; -COMMENT -ON COLUMN "sys_log"."ip" IS 'IP地址'; -COMMENT -ON COLUMN "sys_log"."status" IS '状态(参考SysLogStatusEnum)'; -COMMENT -ON TABLE "sys_log" IS '后台操作日志'; - --- ---------------------------- --- Records of sys_log --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_menu --- ---------------------------- -DROP TABLE IF EXISTS "sys_menu"; -CREATE TABLE "sys_menu" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "title" varchar(50) NOT NULL, - "parent_id" int8 NOT NULL, - "type" int4 NOT NULL, - "permission" varchar(255) NOT NULL, - "icon" varchar(255), - "sort" int4, - "status" int4 NOT NULL, - "component" varchar(255), - "external_link" varchar(255) -) -; -COMMENT -ON COLUMN "sys_menu"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_menu"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_menu"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_menu"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_menu"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_menu"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_menu"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_menu"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_menu"."title" IS '名称'; -COMMENT -ON COLUMN "sys_menu"."parent_id" IS '上级菜单ID(根节点设置为0)'; -COMMENT -ON COLUMN "sys_menu"."type" IS '菜单类型(参考MenuTypeEnum)'; -COMMENT -ON COLUMN "sys_menu"."permission" IS '权限标识'; -COMMENT -ON COLUMN "sys_menu"."icon" IS '图标'; -COMMENT -ON COLUMN "sys_menu"."sort" IS '排序'; -COMMENT -ON COLUMN "sys_menu"."status" IS '状态(0=禁用 1=启用)'; -COMMENT -ON COLUMN "sys_menu"."component" IS '组件'; -COMMENT -ON COLUMN "sys_menu"."external_link" IS '外链地址'; -COMMENT -ON TABLE "sys_menu" IS '后台菜单'; - --- ---------------------------- --- Records of sys_menu --- ---------------------------- -BEGIN; -INSERT INTO "sys_menu" -VALUES (1, 0, 1, 0, '2021-06-01 17:16:48', NULL, '2021-06-02 17:14:16', NULL, '系统管理', 0, 0, 'Sys', - 'ant-design:setting-outlined', 3, 1, 'LAYOUT', ''); -INSERT INTO "sys_menu" -VALUES (2, 0, 1, 0, '2021-06-01 17:13:13', NULL, '2021-07-18 00:10:33', 'admin', '中控台', 0, 0, 'Dashboard', - 'ant-design:appstore-outlined', 1, 1, 'LAYOUT', ''); -INSERT INTO "sys_menu" -VALUES (3, 0, 1, 0, '2021-06-01 17:14:22', NULL, '2021-06-02 11:24:38', NULL, '分析页(后台登录后默认首页)', 2, 1, - 'Dashboard:analysis', 'ant-design:fund-outlined', 1, 1, '/dashboard/analysis/index', ''); -INSERT INTO "sys_menu" -VALUES (4, 0, 1, 0, '2021-06-01 17:14:47', NULL, '2021-06-02 11:32:23', NULL, '工作台', 2, 1, 'Dashboard:workbench', - 'ant-design:database-outlined', 2, 1, '/dashboard/workbench/index', ''); -INSERT INTO "sys_menu" -VALUES (5, 0, 1, 0, '2021-06-01 17:15:38', NULL, '2021-07-15 23:56:43', 'admin', '关于', 0, 1, 'About', - 'ant-design:eye-outlined', 2, 1, '/sys/about/index', ''); -INSERT INTO "sys_menu" -VALUES (6, 0, 1, 0, '2021-06-02 16:06:58', NULL, '2021-07-17 23:55:52', 'admin', '学(mo)习(yu)', 2, 3, '', - 'ant-design:zhihu-outlined', 3, 1, 'https://www.zhihu.com/', 'https://www.zhihu.com/'); -INSERT INTO "sys_menu" -VALUES (7, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '部门管理', 1, 1, 'SysDept', - 'ant-design:flag-outlined', 1, 1, '/sys/SysDept/index', ''); -INSERT INTO "sys_menu" -VALUES (8, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '查询', 7, 2, 'SysDept:retrieve', NULL, 1, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (9, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '新增', 7, 2, 'SysDept:create', NULL, 2, 1, - NULL, ''); -INSERT INTO "sys_menu" -VALUES (10, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '删除', 7, 2, 'SysDept:delete', NULL, 3, 1, - NULL, ''); -INSERT INTO "sys_menu" -VALUES (11, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 7, 2, 'SysDept:update', NULL, 4, 1, - NULL, ''); -INSERT INTO "sys_menu" -VALUES (12, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '角色管理', 1, 1, 'SysRole', - 'ant-design:usergroup-add-outlined', 2, 1, '/sys/SysRole/index', ''); -INSERT INTO "sys_menu" -VALUES (13, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '查询', 12, 2, 'SysRole:retrieve', NULL, 1, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (14, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '新增', 12, 2, 'SysRole:create', NULL, 2, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (15, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '删除', 12, 2, 'SysRole:delete', NULL, 3, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (16, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 12, 2, 'SysRole:update', NULL, 4, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (17, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '后台用户', 1, 1, 'SysUser', - 'ant-design:user-outlined', 3, 1, '/sys/SysUser/index', ''); -INSERT INTO "sys_menu" -VALUES (18, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '查询', 17, 2, 'SysUser:retrieve', NULL, 1, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (19, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '新增', 17, 2, 'SysUser:create', NULL, 2, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (20, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '删除', 17, 2, 'SysUser:delete', NULL, 3, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (21, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '编辑', 17, 2, 'SysUser:update', NULL, 4, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (22, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '菜单管理', 1, 1, 'SysMenu', - 'ant-design:align-left-outlined', 4, 1, '/sys/SysMenu/index', ''); -INSERT INTO "sys_menu" -VALUES (23, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '查询', 22, 2, 'SysMenu:retrieve', NULL, 1, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (24, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '新增', 22, 2, 'SysMenu:create', NULL, 2, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (25, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '删除', 22, 2, 'SysMenu:delete', NULL, 3, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (26, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '编辑', 22, 2, 'SysMenu:update', NULL, 4, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (27, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '参数管理', 1, 1, 'SysParam', - 'ant-design:ant-design-outlined', 5, 1, '/sys/SysParam/index', ''); -INSERT INTO "sys_menu" -VALUES (28, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 27, 2, 'SysParam:retrieve', NULL, - 1, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (29, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '新增', 27, 2, 'SysParam:create', NULL, 2, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (30, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '删除', 27, 2, 'SysParam:delete', NULL, 3, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (31, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '编辑', 27, 2, 'SysParam:update', NULL, 4, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (32, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '租户管理', 1, 1, 'SysTenant', - 'ant-design:aliyun-outlined', 6, 1, '/sys/SysTenant/index', ''); -INSERT INTO "sys_menu" -VALUES (33, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 32, 2, 'SysTenant:retrieve', NULL, - 1, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (34, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '新增', 32, 2, 'SysTenant:create', NULL, 2, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (35, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '删除', 32, 2, 'SysTenant:delete', NULL, 3, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (36, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '编辑', 32, 2, 'SysTenant:update', NULL, 4, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (37, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '数据字典', 1, 1, 'SysDataDict', - 'ant-design:field-string-outlined', 7, 1, '/sys/SysDataDict/index', ''); -INSERT INTO "sys_menu" -VALUES (38, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '查询', 37, 2, 'SysDataDict:retrieve', - NULL, 1, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (39, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '新增', 37, 2, 'SysDataDict:create', NULL, - 2, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (40, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '删除', 37, 2, 'SysDataDict:delete', NULL, - 3, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (41, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '编辑', 37, 2, 'SysDataDict:update', NULL, - 4, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (42, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '系统日志', 1, 1, 'SysLog', - 'ant-design:edit-twotone', 8, 1, '/sys/SysLog/index', ''); -INSERT INTO "sys_menu" -VALUES (43, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '查询', 42, 2, 'SysLog:retrieve', NULL, 1, - 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (44, 0, 1, 0, '2021-07-17 23:37:26', 'admin', '2021-07-17 23:38:28', 'admin', '修改当前用户密码', 1, 1, '', - 'ant-design:compass-outlined', 9, 1, '/sys/SysUser/change-password/index', ''); -INSERT INTO "sys_menu" -VALUES (45, 0, 1, 0, '2021-07-17 23:39:41', 'admin', '2021-07-17 23:39:41', 'admin', '重置某用户密码', 17, 2, - 'SysUser:resetPassword', 'ant-design:redo-outlined', 5, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (46, 0, 1, 0, '2021-07-17 23:40:26', 'admin', '2021-07-17 23:40:26', 'admin', '绑定用户与角色关联关系', 17, 2, - 'SysUser:bindRoles', 'ant-design:share-alt-outlined', 6, 1, NULL, ''); -INSERT INTO "sys_menu" -VALUES (47, 0, 1, 0, '2021-07-17 23:40:47', 'admin', '2021-07-17 23:41:15', 'admin', '踢某用户下线', 17, 2, 'SysUser:kickOut', - 'ant-design:disconnect-outlined', 7, 1, 'LAYOUT', ''); -INSERT INTO "sys_menu" -VALUES (48, 0, 1, 0, '2022-06-29 17:35:26', 'admin', '2022-06-29 17:35:26', 'admin', '绑定角色与菜单关联关系', 12, 2, 'SysRole:bindMenus', - 'ant-design:share-alt-outlined', 5, 1, NULL, ''); -COMMIT; - --- ---------------------------- --- Table structure for sys_param --- ---------------------------- -DROP TABLE IF EXISTS "sys_param"; -CREATE TABLE "sys_param" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "name" varchar(50) NOT NULL, - "value" varchar(255) NOT NULL, - "description" varchar(255) NOT NULL -) -; -COMMENT -ON COLUMN "sys_param"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_param"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_param"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_param"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_param"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_param"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_param"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_param"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_param"."name" IS '键名'; -COMMENT -ON COLUMN "sys_param"."value" IS '键值'; -COMMENT -ON COLUMN "sys_param"."description" IS '描述'; -COMMENT -ON TABLE "sys_param" IS '系统参数'; - --- ---------------------------- --- Records of sys_param --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_role --- ---------------------------- -DROP TABLE IF EXISTS "sys_role"; -CREATE TABLE "sys_role" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "title" varchar(50) NOT NULL, - "value" varchar(100) NOT NULL -) -; -COMMENT -ON COLUMN "sys_role"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_role"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_role"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_role"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_role"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_role"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_role"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_role"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_role"."title" IS '名称'; -COMMENT -ON COLUMN "sys_role"."value" IS '值'; -COMMENT -ON TABLE "sys_role" IS '后台角色'; - --- ---------------------------- --- Records of sys_role --- ---------------------------- -BEGIN; -INSERT INTO "sys_role" -VALUES (1, 0, 1, 0, '2021-04-17 02:34:30', NULL, '2021-06-07 16:22:28', 'admin', '超级管理员(代码中固定拥有所有菜单的权限)', 'SuperAdmin'); -COMMIT; - --- ---------------------------- --- Table structure for sys_role_menu_relation --- ---------------------------- -DROP TABLE IF EXISTS "sys_role_menu_relation"; -CREATE TABLE "sys_role_menu_relation" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "role_id" int8 NOT NULL, - "menu_id" int8 NOT NULL -) -; -COMMENT -ON COLUMN "sys_role_menu_relation"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_role_menu_relation"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_role_menu_relation"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_role_menu_relation"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_role_menu_relation"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_role_menu_relation"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_role_menu_relation"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_role_menu_relation"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_role_menu_relation"."role_id" IS '角色ID'; -COMMENT -ON COLUMN "sys_role_menu_relation"."menu_id" IS '菜单ID'; -COMMENT -ON TABLE "sys_role_menu_relation" IS '后台角色-可见菜单关联'; - --- ---------------------------- --- Records of sys_role_menu_relation --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_tenant --- ---------------------------- -DROP TABLE IF EXISTS "sys_tenant"; -CREATE TABLE "sys_tenant" -( - "id" int8 NOT NULL, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "remark" varchar(255), - "tenant_name" varchar(50) NOT NULL, - "tenant_id" int8, - "status" int4 NOT NULL, - "tenant_admin_user_id" int8 -) -; -COMMENT -ON COLUMN "sys_tenant"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_tenant"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_tenant"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_tenant"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_tenant"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_tenant"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_tenant"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_tenant"."remark" IS '备注'; -COMMENT -ON COLUMN "sys_tenant"."tenant_name" IS '租户名'; -COMMENT -ON COLUMN "sys_tenant"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_tenant"."status" IS '状态(0=禁用 1=启用)'; -COMMENT -ON COLUMN "sys_tenant"."tenant_admin_user_id" IS '租户管理员用户ID'; -COMMENT -ON TABLE "sys_tenant" IS '系统租户'; - --- ---------------------------- --- Records of sys_tenant --- ---------------------------- -BEGIN; -INSERT INTO "sys_tenant" -VALUES (1, 1, 0, '2021-05-11 16:06:47', '', '2021-06-10 16:29:32', 'admin', '可无视SQL拦截器', '超级租户', 0, 1, 1); -COMMIT; - --- ---------------------------- --- Table structure for sys_user --- ---------------------------- -DROP TABLE IF EXISTS "sys_user"; -CREATE TABLE "sys_user" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "pin" varchar(20) NOT NULL, - "pwd" varchar(255) NOT NULL, - "salt" varchar(64) NOT NULL, - "nickname" varchar(20) NOT NULL, - "status" int4 NOT NULL, - "gender" int4, - "email" varchar(255), - "phone_no" varchar(20), - "last_login_at" timestamp(6) -) -; -COMMENT -ON COLUMN "sys_user"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_user"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_user"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_user"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_user"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_user"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_user"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_user"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_user"."pin" IS '账号'; -COMMENT -ON COLUMN "sys_user"."pwd" IS '密码'; -COMMENT -ON COLUMN "sys_user"."salt" IS '盐'; -COMMENT -ON COLUMN "sys_user"."nickname" IS '昵称'; -COMMENT -ON COLUMN "sys_user"."status" IS '状态(0=禁用 1=启用)'; -COMMENT -ON COLUMN "sys_user"."gender" IS '性别'; -COMMENT -ON COLUMN "sys_user"."email" IS '邮箱'; -COMMENT -ON COLUMN "sys_user"."phone_no" IS '手机号'; -COMMENT -ON COLUMN "sys_user"."last_login_at" IS '最后登录时刻'; -COMMENT -ON TABLE "sys_user" IS '后台用户'; - --- ---------------------------- --- Records of sys_user --- ---------------------------- -BEGIN; -INSERT INTO "sys_user" -VALUES (1, 0, 1, 0, '2021-04-06 09:56:02', NULL, '2021-06-28 16:37:07', 'admin', 'admin', - 'b7f6692251833658a56ff2d09e9835b91384d203721bf27a544586d3c9a379ff', '6a8e9339-dfd1-4cfe-80cb-30ca9fc3d81e', - '超级管理员', 1, 0, 'admin@example.com', '17874585544', '2021-07-18 00:32:08'); -COMMIT; - --- ---------------------------- --- Table structure for sys_user_dept_relation --- ---------------------------- -DROP TABLE IF EXISTS "sys_user_dept_relation"; -CREATE TABLE "sys_user_dept_relation" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "user_id" int8 NOT NULL, - "dept_id" int8 NOT NULL -) -; -COMMENT -ON COLUMN "sys_user_dept_relation"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_user_dept_relation"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_user_dept_relation"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_user_dept_relation"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_user_dept_relation"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_user_dept_relation"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_user_dept_relation"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_user_dept_relation"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_user_dept_relation"."user_id" IS '用户ID'; -COMMENT -ON COLUMN "sys_user_dept_relation"."dept_id" IS '部门ID'; -COMMENT -ON TABLE "sys_user_dept_relation" IS '后台用户-部门关联'; - --- ---------------------------- --- Records of sys_user_dept_relation --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Table structure for sys_user_role_relation --- ---------------------------- -DROP TABLE IF EXISTS "sys_user_role_relation"; -CREATE TABLE "sys_user_role_relation" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "user_id" int8 NOT NULL, - "role_id" int8 NOT NULL -) -; -COMMENT -ON COLUMN "sys_user_role_relation"."id" IS '主键ID'; -COMMENT -ON COLUMN "sys_user_role_relation"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "sys_user_role_relation"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "sys_user_role_relation"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "sys_user_role_relation"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "sys_user_role_relation"."created_by" IS '创建者'; -COMMENT -ON COLUMN "sys_user_role_relation"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "sys_user_role_relation"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "sys_user_role_relation"."user_id" IS '用户ID'; -COMMENT -ON COLUMN "sys_user_role_relation"."role_id" IS '角色ID'; -COMMENT -ON TABLE "sys_user_role_relation" IS '后台用户-角色关联'; - --- ---------------------------- --- Records of sys_user_role_relation --- ---------------------------- -BEGIN; -INSERT INTO "sys_user_role_relation" -VALUES (1, 0, 1, 0, '2021-01-01 18:22:12', NULL, '2021-01-01 18:22:12', NULL, 1, 1); -COMMIT; - --- ---------------------------- --- Table structure for 数据表模板 --- ---------------------------- -DROP TABLE IF EXISTS "数据表模板"; -CREATE TABLE "数据表模板" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255) -) -; -COMMENT -ON COLUMN "数据表模板"."id" IS '主键ID'; -COMMENT -ON COLUMN "数据表模板"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "数据表模板"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "数据表模板"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "数据表模板"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "数据表模板"."created_by" IS '创建者'; -COMMENT -ON COLUMN "数据表模板"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "数据表模板"."updated_by" IS '更新者'; -COMMENT -ON TABLE "数据表模板" IS '数据表注释'; - --- ---------------------------- --- Records of 数据表模板 --- ---------------------------- -BEGIN; -COMMIT; - --- ---------------------------- --- Primary Key structure for table sys_data_dict --- ---------------------------- -ALTER TABLE "sys_data_dict" - ADD CONSTRAINT "sys_data_dict_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_dept --- ---------------------------- -ALTER TABLE "sys_dept" - ADD CONSTRAINT "sys_dept_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_log --- ---------------------------- -ALTER TABLE "sys_log" - ADD CONSTRAINT "sys_log_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_menu --- ---------------------------- -ALTER TABLE "sys_menu" - ADD CONSTRAINT "sys_menu_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_param --- ---------------------------- -ALTER TABLE "sys_param" - ADD CONSTRAINT "sys_param_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_role --- ---------------------------- -ALTER TABLE "sys_role" - ADD CONSTRAINT "sys_role_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_role_menu_relation --- ---------------------------- -ALTER TABLE "sys_role_menu_relation" - ADD CONSTRAINT "sys_role_menu_relation_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_tenant --- ---------------------------- -ALTER TABLE "sys_tenant" - ADD CONSTRAINT "sys_tenant_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_user --- ---------------------------- -ALTER TABLE "sys_user" - ADD CONSTRAINT "sys_user_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_user_dept_relation --- ---------------------------- -ALTER TABLE "sys_user_dept_relation" - ADD CONSTRAINT "sys_user_dept_relation_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table sys_user_role_relation --- ---------------------------- -ALTER TABLE "sys_user_role_relation" - ADD CONSTRAINT "sys_user_role_relation_pkey" PRIMARY KEY ("id"); - --- ---------------------------- --- Primary Key structure for table 数据表模板 --- ---------------------------- -ALTER TABLE "数据表模板" - ADD CONSTRAINT "数据表模板_pkey" PRIMARY KEY ("id"); - - --- v1.7.2 - Uncarbon - 默认内置文件上传功能 --- 建表 oss_file_info -DROP TABLE IF EXISTS "oss_file_info"; -CREATE TABLE "oss_file_info" -( - "id" int8 NOT NULL, - "tenant_id" int8, - "revision" int8 NOT NULL DEFAULT 1, - "del_flag" int2 NOT NULL DEFAULT 0, - "created_at" timestamp(6) NOT NULL, - "created_by" varchar(255), - "updated_at" timestamp(6) NOT NULL, - "updated_by" varchar(255), - "storage_platform" varchar(50) NOT NULL, - "storage_base_path" varchar(255) NOT NULL, - "storage_path" varchar(512) NOT NULL, - "storage_filename" varchar(255) NOT NULL, - "original_filename" varchar(255) NOT NULL, - "extend_name" varchar(16) NOT NULL, - "file_size" int8 NOT NULL, - "md5" varchar(32) NOT NULL, - "classified" varchar(50), - "direct_url" varchar(512) -) -; -COMMENT -ON COLUMN "oss_file_info"."id" IS '主键ID'; -COMMENT -ON COLUMN "oss_file_info"."tenant_id" IS '租户ID'; -COMMENT -ON COLUMN "oss_file_info"."revision" IS '乐观锁'; -COMMENT -ON COLUMN "oss_file_info"."del_flag" IS '逻辑删除标识'; -COMMENT -ON COLUMN "oss_file_info"."created_at" IS '创建时刻'; -COMMENT -ON COLUMN "oss_file_info"."created_by" IS '创建者'; -COMMENT -ON COLUMN "oss_file_info"."updated_at" IS '更新时刻'; -COMMENT -ON COLUMN "oss_file_info"."updated_by" IS '更新者'; -COMMENT -ON COLUMN "oss_file_info"."storage_platform" IS '存储平台'; -COMMENT -ON COLUMN "oss_file_info"."storage_base_path" IS '基础存储路径'; -COMMENT -ON COLUMN "oss_file_info"."storage_path" IS '存储路径'; -COMMENT -ON COLUMN "oss_file_info"."storage_filename" IS '存储文件名'; -COMMENT -ON COLUMN "oss_file_info"."original_filename" IS '原始文件名'; -COMMENT -ON COLUMN "oss_file_info"."extend_name" IS '扩展名'; -COMMENT -ON COLUMN "oss_file_info"."file_size" IS '文件大小'; -COMMENT -ON COLUMN "oss_file_info"."md5" IS 'MD5'; -COMMENT -ON COLUMN "oss_file_info"."classified" IS '文件类别'; -COMMENT -ON COLUMN "oss_file_info"."direct_url" IS '对象存储直链'; -COMMENT -ON TABLE "oss_file_info" IS '上传文件信息'; - --- 主键 -ALTER TABLE "oss_file_info" - ADD CONSTRAINT "oss_file_info_pkey" PRIMARY KEY ("id"); - - --- v1.7.2 - Uncarbon - 新增上传文件信息管理菜单 -INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", - "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", - "external_link") -VALUES (20220922152714, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:27:14', - 'helio-generator', '上传文件信息管理', 0, 1, 'OssFileInfo', 'ant-design:flag-outlined', 100, 1, - '/oss/OssFileInfo/index', ''); -INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", - "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", - "external_link") -VALUES (20220922152715, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:27:14', - 'helio-generator', '查询', 1572848462892752896, 2, 'OssFileInfo:retrieve', NULL, 1, 1, NULL, ''); -INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", - "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", - "external_link") -VALUES (20220922152716, NULL, 1, 1, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:35:48', 'admin', - '新增', 1572848462892752896, 2, 'OssFileInfo:create', NULL, 2, 1, NULL, ''); -INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", - "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", - "external_link") -VALUES (20220922152717, NULL, 1, 1, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:35:55', 'admin', - '编辑', 1572848462892752896, 2, 'OssFileInfo:update', NULL, 4, 1, NULL, ''); -INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", - "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", - "external_link") -VALUES (20220922152718, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:36:03', 'admin', - '删除', 1572848462892752896, 2, 'OssFileInfo:delete', NULL, 2, 1, NULL, ''); - --- v1.8.0 - Uncarbon - 新增错误原因堆栈、用户UA、IP属地字段;表注释更新 -ALTER TABLE sys_log - ADD COLUMN error_stacktrace varchar(3000) NOT NULL DEFAULT '', - ADD COLUMN user_agent varchar(255) NOT NULL DEFAULT '', - ADD COLUMN ip_location_region_name varchar(100) NOT NULL DEFAULT '', - ADD COLUMN ip_location_province_name varchar(100) NOT NULL DEFAULT '', - ADD COLUMN ip_location_city_name varchar(100) NOT NULL DEFAULT '', - ADD COLUMN ip_location_district_name varchar(100) NOT NULL DEFAULT ''; - -COMMENT ON COLUMN sys_log.error_stacktrace IS '错误原因堆栈'; -COMMENT ON COLUMN sys_log.user_agent IS '用户UA'; -COMMENT ON COLUMN sys_log.ip_location_region_name IS 'IP地址属地-国家或地区名'; -COMMENT ON COLUMN sys_log.ip_location_province_name IS 'IP地址属地-省级行政区名'; -COMMENT ON COLUMN sys_log.ip_location_city_name IS 'IP地址属地-市级行政区名'; -COMMENT ON COLUMN sys_log.ip_location_district_name IS 'IP地址属地-县级行政区名'; - -COMMENT ON TABLE sys_log IS '系统日志'; - --- v1.8.0 - Uncarbon - 订正系统菜单-权限串缺少默认值问题 -ALTER TABLE "sys_menu" - ALTER COLUMN "permission" SET DEFAULT ''; +-- ---------------------------- +-- Table structure for sys_data_dict_classified & sys_data_dict_item +-- ---------------------------- +CREATE TABLE "sys_data_dict_classified" ( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255) COLLATE "pg_catalog"."default", + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255) COLLATE "pg_catalog"."default", + "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "status" int2 NOT NULL DEFAULT 1, + "description" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying +); +COMMENT ON COLUMN "sys_data_dict_classified"."id" IS '主键ID'; +COMMENT ON COLUMN "sys_data_dict_classified"."tenant_id" IS '租户ID'; +COMMENT ON COLUMN "sys_data_dict_classified"."revision" IS '乐观锁'; +COMMENT ON COLUMN "sys_data_dict_classified"."del_flag" IS '逻辑删除标识'; +COMMENT ON COLUMN "sys_data_dict_classified"."created_at" IS '创建时刻'; +COMMENT ON COLUMN "sys_data_dict_classified"."created_by" IS '创建者'; +COMMENT ON COLUMN "sys_data_dict_classified"."updated_at" IS '更新时刻'; +COMMENT ON COLUMN "sys_data_dict_classified"."updated_by" IS '更新者'; +COMMENT ON COLUMN "sys_data_dict_classified"."code" IS '分类编码'; +COMMENT ON COLUMN "sys_data_dict_classified"."name" IS '分类名称'; +COMMENT ON COLUMN "sys_data_dict_classified"."status" IS '状态'; +COMMENT ON COLUMN "sys_data_dict_classified"."description" IS '分类描述'; +COMMENT ON TABLE "sys_data_dict_classified" IS '数据字典分类'; +ALTER TABLE "sys_data_dict_classified" ADD PRIMARY KEY ("id"); + +CREATE TABLE "sys_data_dict_item" ( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255) COLLATE "pg_catalog"."default", + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255) COLLATE "pg_catalog"."default", + "classified_id" int8 NOT NULL, + "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "label" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "value" varchar(4096) COLLATE "pg_catalog"."default" NOT NULL, + "status" int2 NOT NULL DEFAULT 1, + "sort" int4 NOT NULL DEFAULT 1, + "description" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying +); +COMMENT ON COLUMN "sys_data_dict_item"."id" IS '主键ID'; +COMMENT ON COLUMN "sys_data_dict_item"."tenant_id" IS '租户ID'; +COMMENT ON COLUMN "sys_data_dict_item"."revision" IS '乐观锁'; +COMMENT ON COLUMN "sys_data_dict_item"."del_flag" IS '逻辑删除标识'; +COMMENT ON COLUMN "sys_data_dict_item"."created_at" IS '创建时刻'; +COMMENT ON COLUMN "sys_data_dict_item"."created_by" IS '创建者'; +COMMENT ON COLUMN "sys_data_dict_item"."updated_at" IS '更新时刻'; +COMMENT ON COLUMN "sys_data_dict_item"."updated_by" IS '更新者'; +COMMENT ON COLUMN "sys_data_dict_item"."classified_id" IS '所属分类ID'; +COMMENT ON COLUMN "sys_data_dict_item"."code" IS '字典项编码'; +COMMENT ON COLUMN "sys_data_dict_item"."label" IS '字典项标签'; +COMMENT ON COLUMN "sys_data_dict_item"."value" IS '字典项值'; +COMMENT ON COLUMN "sys_data_dict_item"."status" IS '状态'; +COMMENT ON COLUMN "sys_data_dict_item"."sort" IS '排序'; +COMMENT ON COLUMN "sys_data_dict_item"."description" IS '描述'; +COMMENT ON TABLE "sys_data_dict_item" IS '数据字典项'; +ALTER TABLE "sys_data_dict_item" ADD PRIMARY KEY ("id"); + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS "sys_dept"; +CREATE TABLE "sys_dept" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "title" varchar(50) NOT NULL, + "parent_id" int8 NOT NULL, + "sort" int4 NOT NULL, + "status" int4 NOT NULL +) +; +COMMENT +ON COLUMN "sys_dept"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_dept"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_dept"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_dept"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_dept"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_dept"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_dept"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_dept"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_dept"."title" IS '名称'; +COMMENT +ON COLUMN "sys_dept"."parent_id" IS '上级ID(根节点设置为0)'; +COMMENT +ON COLUMN "sys_dept"."sort" IS '排序'; +COMMENT +ON COLUMN "sys_dept"."status" IS '状态(0=禁用 1=启用)'; +COMMENT +ON TABLE "sys_dept" IS '部门'; + +-- ---------------------------- +-- Records of sys_dept +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_log +-- ---------------------------- +DROP TABLE IF EXISTS "sys_log"; +CREATE TABLE "sys_log" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "user_id" int8, + "username" varchar(50), + "operation" varchar(255), + "method" varchar(500), + "params" text, + "ip" varchar(128), + "status" int4 NOT NULL +) +; +COMMENT +ON COLUMN "sys_log"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_log"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_log"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_log"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_log"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_log"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_log"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_log"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_log"."user_id" IS '用户ID'; +COMMENT +ON COLUMN "sys_log"."username" IS '用户账号'; +COMMENT +ON COLUMN "sys_log"."operation" IS '操作内容'; +COMMENT +ON COLUMN "sys_log"."method" IS '请求方法'; +COMMENT +ON COLUMN "sys_log"."params" IS '请求参数'; +COMMENT +ON COLUMN "sys_log"."ip" IS 'IP地址'; +COMMENT +ON COLUMN "sys_log"."status" IS '状态(参考SysLogStatusEnum)'; +COMMENT +ON TABLE "sys_log" IS '后台操作日志'; + +-- ---------------------------- +-- Records of sys_log +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS "sys_menu"; +CREATE TABLE "sys_menu" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "title" varchar(50) NOT NULL, + "parent_id" int8 NOT NULL, + "type" int4 NOT NULL, + "permission" varchar(255) NOT NULL, + "icon" varchar(255), + "sort" int4, + "status" int4 NOT NULL, + "component" varchar(255), + "external_link" varchar(255) +) +; +COMMENT +ON COLUMN "sys_menu"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_menu"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_menu"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_menu"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_menu"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_menu"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_menu"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_menu"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_menu"."title" IS '名称'; +COMMENT +ON COLUMN "sys_menu"."parent_id" IS '上级菜单ID(根节点设置为0)'; +COMMENT +ON COLUMN "sys_menu"."type" IS '菜单类型(参考MenuTypeEnum)'; +COMMENT +ON COLUMN "sys_menu"."permission" IS '权限标识'; +COMMENT +ON COLUMN "sys_menu"."icon" IS '图标'; +COMMENT +ON COLUMN "sys_menu"."sort" IS '排序'; +COMMENT +ON COLUMN "sys_menu"."status" IS '状态(0=禁用 1=启用)'; +COMMENT +ON COLUMN "sys_menu"."component" IS '组件'; +COMMENT +ON COLUMN "sys_menu"."external_link" IS '外链地址'; +COMMENT +ON TABLE "sys_menu" IS '后台菜单'; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +BEGIN; +INSERT INTO "sys_menu" +VALUES (1, 0, 1, 0, '2021-06-01 17:16:48', NULL, '2021-06-02 17:14:16', NULL, '系统管理', 0, 0, 'Sys', + 'ant-design:setting-outlined', 3, 1, 'LAYOUT', ''); +INSERT INTO "sys_menu" +VALUES (2, 0, 1, 0, '2021-06-01 17:13:13', NULL, '2021-07-18 00:10:33', 'admin', '中控台', 0, 0, 'Dashboard', + 'ant-design:appstore-outlined', 1, 1, 'LAYOUT', ''); +INSERT INTO "sys_menu" +VALUES (3, 0, 1, 0, '2021-06-01 17:14:22', NULL, '2021-06-02 11:24:38', NULL, '分析页(后台登录后默认首页)', 2, 1, + 'Dashboard:analysis', 'ant-design:fund-outlined', 1, 1, '/dashboard/analysis/index', ''); +INSERT INTO "sys_menu" +VALUES (4, 0, 1, 0, '2021-06-01 17:14:47', NULL, '2021-06-02 11:32:23', NULL, '工作台', 2, 1, 'Dashboard:workbench', + 'ant-design:database-outlined', 2, 1, '/dashboard/workbench/index', ''); +INSERT INTO "sys_menu" +VALUES (5, 0, 1, 0, '2021-06-01 17:15:38', NULL, '2021-07-15 23:56:43', 'admin', '关于', 0, 1, 'About', + 'ant-design:eye-outlined', 2, 1, '/sys/about/index', ''); +INSERT INTO "sys_menu" +VALUES (6, 0, 1, 0, '2021-06-02 16:06:58', NULL, '2021-07-17 23:55:52', 'admin', '学(mo)习(yu)', 2, 3, '', + 'ant-design:zhihu-outlined', 3, 1, 'https://www.zhihu.com/', 'https://www.zhihu.com/'); +INSERT INTO "sys_menu" +VALUES (7, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '部门管理', 1, 1, 'SysDept', + 'ant-design:flag-outlined', 1, 1, '/sys/SysDept/index', ''); +INSERT INTO "sys_menu" +VALUES (8, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '查询', 7, 2, 'SysDept:retrieve', NULL, 1, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (9, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '新增', 7, 2, 'SysDept:create', NULL, 2, 1, + NULL, ''); +INSERT INTO "sys_menu" +VALUES (10, 0, 1, 0, '2021-07-17 23:32:15', NULL, '2021-07-17 23:32:15', NULL, '删除', 7, 2, 'SysDept:delete', NULL, 3, 1, + NULL, ''); +INSERT INTO "sys_menu" +VALUES (11, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 7, 2, 'SysDept:update', NULL, 4, 1, + NULL, ''); +INSERT INTO "sys_menu" +VALUES (12, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '角色管理', 1, 1, 'SysRole', + 'ant-design:usergroup-add-outlined', 2, 1, '/sys/SysRole/index', ''); +INSERT INTO "sys_menu" +VALUES (13, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '查询', 12, 2, 'SysRole:retrieve', NULL, 1, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (14, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '新增', 12, 2, 'SysRole:create', NULL, 2, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (15, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '删除', 12, 2, 'SysRole:delete', NULL, 3, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (16, 0, 1, 0, '2021-07-17 23:32:16', NULL, '2021-07-17 23:32:16', NULL, '编辑', 12, 2, 'SysRole:update', NULL, 4, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (17, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '后台用户', 1, 1, 'SysUser', + 'ant-design:user-outlined', 3, 1, '/sys/SysUser/index', ''); +INSERT INTO "sys_menu" +VALUES (18, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '查询', 17, 2, 'SysUser:retrieve', NULL, 1, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (19, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '新增', 17, 2, 'SysUser:create', NULL, 2, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (20, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '删除', 17, 2, 'SysUser:delete', NULL, 3, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (21, 0, 1, 0, '2021-07-17 23:32:17', NULL, '2021-07-17 23:32:17', NULL, '编辑', 17, 2, 'SysUser:update', NULL, 4, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (22, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '菜单管理', 1, 1, 'SysMenu', + 'ant-design:align-left-outlined', 4, 1, '/sys/SysMenu/index', ''); +INSERT INTO "sys_menu" +VALUES (23, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '查询', 22, 2, 'SysMenu:retrieve', NULL, 1, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (24, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '新增', 22, 2, 'SysMenu:create', NULL, 2, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (25, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '删除', 22, 2, 'SysMenu:delete', NULL, 3, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (26, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '编辑', 22, 2, 'SysMenu:update', NULL, 4, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (27, 0, 1, 0, '2021-07-17 23:32:18', NULL, '2021-07-17 23:32:18', NULL, '参数管理', 1, 1, 'SysParam', + 'ant-design:ant-design-outlined', 5, 1, '/sys/SysParam/index', ''); +INSERT INTO "sys_menu" +VALUES (28, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 27, 2, 'SysParam:retrieve', NULL, + 1, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (29, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '新增', 27, 2, 'SysParam:create', NULL, 2, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (30, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '删除', 27, 2, 'SysParam:delete', NULL, 3, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (31, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '编辑', 27, 2, 'SysParam:update', NULL, 4, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (32, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '租户管理', 1, 1, 'SysTenant', + 'ant-design:aliyun-outlined', 6, 1, '/sys/SysTenant/index', ''); +INSERT INTO "sys_menu" +VALUES (33, 0, 1, 0, '2021-07-17 23:32:19', NULL, '2021-07-17 23:32:19', NULL, '查询', 32, 2, 'SysTenant:retrieve', NULL, + 1, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (34, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '新增', 32, 2, 'SysTenant:create', NULL, 2, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (35, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '删除', 32, 2, 'SysTenant:delete', NULL, 3, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (36, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '编辑', 32, 2, 'SysTenant:update', NULL, 4, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (37, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '数据字典', 1, 1, 'SysDataDict', + 'ant-design:field-string-outlined', 7, 1, '/sys/SysDataDict/index', ''); +INSERT INTO "sys_menu" +VALUES (38, 0, 1, 0, '2021-07-17 23:32:20', NULL, '2021-07-17 23:32:20', NULL, '查询', 37, 2, 'SysDataDict:retrieve', + NULL, 1, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (39, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '新增', 37, 2, 'SysDataDict:create', NULL, + 2, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (40, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '删除', 37, 2, 'SysDataDict:delete', NULL, + 3, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (41, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '编辑', 37, 2, 'SysDataDict:update', NULL, + 4, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (42, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '系统日志', 1, 1, 'SysLog', + 'ant-design:edit-twotone', 8, 1, '/sys/SysLog/index', ''); +INSERT INTO "sys_menu" +VALUES (43, 0, 1, 0, '2021-07-17 23:32:21', NULL, '2021-07-17 23:32:21', NULL, '查询', 42, 2, 'SysLog:retrieve', NULL, 1, + 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (44, 0, 1, 0, '2021-07-17 23:37:26', 'admin', '2021-07-17 23:38:28', 'admin', '修改当前用户密码', 1, 1, '', + 'ant-design:compass-outlined', 9, 1, '/sys/SysUser/change-password/index', ''); +INSERT INTO "sys_menu" +VALUES (45, 0, 1, 0, '2021-07-17 23:39:41', 'admin', '2021-07-17 23:39:41', 'admin', '重置某用户密码', 17, 2, + 'SysUser:resetPassword', 'ant-design:redo-outlined', 5, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (46, 0, 1, 0, '2021-07-17 23:40:26', 'admin', '2021-07-17 23:40:26', 'admin', '绑定用户与角色关联关系', 17, 2, + 'SysUser:bindRoles', 'ant-design:share-alt-outlined', 6, 1, NULL, ''); +INSERT INTO "sys_menu" +VALUES (47, 0, 1, 0, '2021-07-17 23:40:47', 'admin', '2021-07-17 23:41:15', 'admin', '踢某用户下线', 17, 2, 'SysUser:kickOut', + 'ant-design:disconnect-outlined', 7, 1, 'LAYOUT', ''); +INSERT INTO "sys_menu" +VALUES (48, 0, 1, 0, '2022-06-29 17:35:26', 'admin', '2022-06-29 17:35:26', 'admin', '绑定角色与菜单关联关系', 12, 2, 'SysRole:bindMenus', + 'ant-design:share-alt-outlined', 5, 1, NULL, ''); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_param +-- ---------------------------- +DROP TABLE IF EXISTS "sys_param"; +CREATE TABLE "sys_param" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "name" varchar(50) NOT NULL, + "value" varchar(255) NOT NULL, + "description" varchar(255) NOT NULL +) +; +COMMENT +ON COLUMN "sys_param"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_param"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_param"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_param"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_param"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_param"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_param"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_param"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_param"."name" IS '键名'; +COMMENT +ON COLUMN "sys_param"."value" IS '键值'; +COMMENT +ON COLUMN "sys_param"."description" IS '描述'; +COMMENT +ON TABLE "sys_param" IS '系统参数'; + +-- ---------------------------- +-- Records of sys_param +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_role +-- ---------------------------- +DROP TABLE IF EXISTS "sys_role"; +CREATE TABLE "sys_role" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "title" varchar(50) NOT NULL, + "value" varchar(100) NOT NULL +) +; +COMMENT +ON COLUMN "sys_role"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_role"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_role"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_role"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_role"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_role"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_role"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_role"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_role"."title" IS '名称'; +COMMENT +ON COLUMN "sys_role"."value" IS '值'; +COMMENT +ON TABLE "sys_role" IS '后台角色'; + +-- ---------------------------- +-- Records of sys_role +-- ---------------------------- +BEGIN; +INSERT INTO "sys_role" +VALUES (1, 0, 1, 0, '2021-04-17 02:34:30', NULL, '2021-06-07 16:22:28', 'admin', '超级管理员(代码中固定拥有所有菜单的权限)', 'SuperAdmin'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_role_menu_relation +-- ---------------------------- +DROP TABLE IF EXISTS "sys_role_menu_relation"; +CREATE TABLE "sys_role_menu_relation" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "role_id" int8 NOT NULL, + "menu_id" int8 NOT NULL +) +; +COMMENT +ON COLUMN "sys_role_menu_relation"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_role_menu_relation"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_role_menu_relation"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_role_menu_relation"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_role_menu_relation"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_role_menu_relation"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_role_menu_relation"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_role_menu_relation"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_role_menu_relation"."role_id" IS '角色ID'; +COMMENT +ON COLUMN "sys_role_menu_relation"."menu_id" IS '菜单ID'; +COMMENT +ON TABLE "sys_role_menu_relation" IS '后台角色-可见菜单关联'; + +-- ---------------------------- +-- Records of sys_role_menu_relation +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_tenant +-- ---------------------------- +DROP TABLE IF EXISTS "sys_tenant"; +CREATE TABLE "sys_tenant" +( + "id" int8 NOT NULL, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "remark" varchar(255), + "tenant_name" varchar(50) NOT NULL, + "tenant_id" int8, + "status" int4 NOT NULL, + "tenant_admin_user_id" int8 +) +; +COMMENT +ON COLUMN "sys_tenant"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_tenant"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_tenant"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_tenant"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_tenant"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_tenant"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_tenant"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_tenant"."remark" IS '备注'; +COMMENT +ON COLUMN "sys_tenant"."tenant_name" IS '租户名'; +COMMENT +ON COLUMN "sys_tenant"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_tenant"."status" IS '状态(0=禁用 1=启用)'; +COMMENT +ON COLUMN "sys_tenant"."tenant_admin_user_id" IS '租户管理员用户ID'; +COMMENT +ON TABLE "sys_tenant" IS '系统租户'; + +-- ---------------------------- +-- Records of sys_tenant +-- ---------------------------- +BEGIN; +INSERT INTO "sys_tenant" +VALUES (1, 1, 0, '2021-05-11 16:06:47', '', '2021-06-10 16:29:32', 'admin', '可无视SQL拦截器', '超级租户', 0, 1, 1); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user +-- ---------------------------- +DROP TABLE IF EXISTS "sys_user"; +CREATE TABLE "sys_user" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "pin" varchar(20) NOT NULL, + "pwd" varchar(255) NOT NULL, + "salt" varchar(64) NOT NULL, + "nickname" varchar(20) NOT NULL, + "status" int4 NOT NULL, + "gender" int4, + "email" varchar(255), + "phone_no" varchar(20), + "last_login_at" timestamp(6) +) +; +COMMENT +ON COLUMN "sys_user"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_user"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_user"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_user"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_user"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_user"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_user"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_user"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_user"."pin" IS '账号'; +COMMENT +ON COLUMN "sys_user"."pwd" IS '密码'; +COMMENT +ON COLUMN "sys_user"."salt" IS '盐'; +COMMENT +ON COLUMN "sys_user"."nickname" IS '昵称'; +COMMENT +ON COLUMN "sys_user"."status" IS '状态(0=禁用 1=启用)'; +COMMENT +ON COLUMN "sys_user"."gender" IS '性别'; +COMMENT +ON COLUMN "sys_user"."email" IS '邮箱'; +COMMENT +ON COLUMN "sys_user"."phone_no" IS '手机号'; +COMMENT +ON COLUMN "sys_user"."last_login_at" IS '最后登录时刻'; +COMMENT +ON TABLE "sys_user" IS '后台用户'; + +-- ---------------------------- +-- Records of sys_user +-- ---------------------------- +BEGIN; +INSERT INTO "sys_user" +VALUES (1, 0, 1, 0, '2021-04-06 09:56:02', NULL, '2021-06-28 16:37:07', 'admin', 'admin', + 'b7f6692251833658a56ff2d09e9835b91384d203721bf27a544586d3c9a379ff', '6a8e9339-dfd1-4cfe-80cb-30ca9fc3d81e', + '超级管理员', 1, 0, 'admin@example.com', '17874585544', '2021-07-18 00:32:08'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_dept_relation +-- ---------------------------- +DROP TABLE IF EXISTS "sys_user_dept_relation"; +CREATE TABLE "sys_user_dept_relation" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "user_id" int8 NOT NULL, + "dept_id" int8 NOT NULL +) +; +COMMENT +ON COLUMN "sys_user_dept_relation"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_user_dept_relation"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_user_dept_relation"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_user_dept_relation"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_user_dept_relation"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_user_dept_relation"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_user_dept_relation"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_user_dept_relation"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_user_dept_relation"."user_id" IS '用户ID'; +COMMENT +ON COLUMN "sys_user_dept_relation"."dept_id" IS '部门ID'; +COMMENT +ON TABLE "sys_user_dept_relation" IS '后台用户-部门关联'; + +-- ---------------------------- +-- Records of sys_user_dept_relation +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_role_relation +-- ---------------------------- +DROP TABLE IF EXISTS "sys_user_role_relation"; +CREATE TABLE "sys_user_role_relation" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "user_id" int8 NOT NULL, + "role_id" int8 NOT NULL +) +; +COMMENT +ON COLUMN "sys_user_role_relation"."id" IS '主键ID'; +COMMENT +ON COLUMN "sys_user_role_relation"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "sys_user_role_relation"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "sys_user_role_relation"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "sys_user_role_relation"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "sys_user_role_relation"."created_by" IS '创建者'; +COMMENT +ON COLUMN "sys_user_role_relation"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "sys_user_role_relation"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "sys_user_role_relation"."user_id" IS '用户ID'; +COMMENT +ON COLUMN "sys_user_role_relation"."role_id" IS '角色ID'; +COMMENT +ON TABLE "sys_user_role_relation" IS '后台用户-角色关联'; + +-- ---------------------------- +-- Records of sys_user_role_relation +-- ---------------------------- +BEGIN; +INSERT INTO "sys_user_role_relation" +VALUES (1, 0, 1, 0, '2021-01-01 18:22:12', NULL, '2021-01-01 18:22:12', NULL, 1, 1); +COMMIT; + +-- ---------------------------- +-- Table structure for 数据表模板 +-- ---------------------------- +DROP TABLE IF EXISTS "数据表模板"; +CREATE TABLE "数据表模板" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255) +) +; +COMMENT +ON COLUMN "数据表模板"."id" IS '主键ID'; +COMMENT +ON COLUMN "数据表模板"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "数据表模板"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "数据表模板"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "数据表模板"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "数据表模板"."created_by" IS '创建者'; +COMMENT +ON COLUMN "数据表模板"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "数据表模板"."updated_by" IS '更新者'; +COMMENT +ON TABLE "数据表模板" IS '数据表注释'; + +-- ---------------------------- +-- Records of 数据表模板 +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Primary Key structure for table sys_dept +-- ---------------------------- +ALTER TABLE "sys_dept" + ADD CONSTRAINT "sys_dept_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_log +-- ---------------------------- +ALTER TABLE "sys_log" + ADD CONSTRAINT "sys_log_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_menu +-- ---------------------------- +ALTER TABLE "sys_menu" + ADD CONSTRAINT "sys_menu_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_param +-- ---------------------------- +ALTER TABLE "sys_param" + ADD CONSTRAINT "sys_param_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_role +-- ---------------------------- +ALTER TABLE "sys_role" + ADD CONSTRAINT "sys_role_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_role_menu_relation +-- ---------------------------- +ALTER TABLE "sys_role_menu_relation" + ADD CONSTRAINT "sys_role_menu_relation_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_tenant +-- ---------------------------- +ALTER TABLE "sys_tenant" + ADD CONSTRAINT "sys_tenant_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_user +-- ---------------------------- +ALTER TABLE "sys_user" + ADD CONSTRAINT "sys_user_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_user_dept_relation +-- ---------------------------- +ALTER TABLE "sys_user_dept_relation" + ADD CONSTRAINT "sys_user_dept_relation_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table sys_user_role_relation +-- ---------------------------- +ALTER TABLE "sys_user_role_relation" + ADD CONSTRAINT "sys_user_role_relation_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Primary Key structure for table 数据表模板 +-- ---------------------------- +ALTER TABLE "数据表模板" + ADD CONSTRAINT "数据表模板_pkey" PRIMARY KEY ("id"); + + +-- v1.7.2 - Uncarbon - 默认内置文件上传功能 +-- 建表 oss_file_info +DROP TABLE IF EXISTS "oss_file_info"; +CREATE TABLE "oss_file_info" +( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255), + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255), + "storage_platform" varchar(50) NOT NULL, + "storage_base_path" varchar(255) NOT NULL, + "storage_path" varchar(512) NOT NULL, + "storage_filename" varchar(255) NOT NULL, + "original_filename" varchar(255) NOT NULL, + "extend_name" varchar(16) NOT NULL, + "file_size" int8 NOT NULL, + "md5" varchar(32) NOT NULL, + "classified" varchar(50), + "direct_url" varchar(512) +) +; +COMMENT +ON COLUMN "oss_file_info"."id" IS '主键ID'; +COMMENT +ON COLUMN "oss_file_info"."tenant_id" IS '租户ID'; +COMMENT +ON COLUMN "oss_file_info"."revision" IS '乐观锁'; +COMMENT +ON COLUMN "oss_file_info"."del_flag" IS '逻辑删除标识'; +COMMENT +ON COLUMN "oss_file_info"."created_at" IS '创建时刻'; +COMMENT +ON COLUMN "oss_file_info"."created_by" IS '创建者'; +COMMENT +ON COLUMN "oss_file_info"."updated_at" IS '更新时刻'; +COMMENT +ON COLUMN "oss_file_info"."updated_by" IS '更新者'; +COMMENT +ON COLUMN "oss_file_info"."storage_platform" IS '存储平台'; +COMMENT +ON COLUMN "oss_file_info"."storage_base_path" IS '基础存储路径'; +COMMENT +ON COLUMN "oss_file_info"."storage_path" IS '存储路径'; +COMMENT +ON COLUMN "oss_file_info"."storage_filename" IS '存储文件名'; +COMMENT +ON COLUMN "oss_file_info"."original_filename" IS '原始文件名'; +COMMENT +ON COLUMN "oss_file_info"."extend_name" IS '扩展名'; +COMMENT +ON COLUMN "oss_file_info"."file_size" IS '文件大小'; +COMMENT +ON COLUMN "oss_file_info"."md5" IS 'MD5'; +COMMENT +ON COLUMN "oss_file_info"."classified" IS '文件类别'; +COMMENT +ON COLUMN "oss_file_info"."direct_url" IS '对象存储直链'; +COMMENT +ON TABLE "oss_file_info" IS '上传文件信息'; + +-- 主键 +ALTER TABLE "oss_file_info" + ADD CONSTRAINT "oss_file_info_pkey" PRIMARY KEY ("id"); + + +-- v1.7.2 - Uncarbon - 新增上传文件信息管理菜单 +INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", + "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", + "external_link") +VALUES (20220922152714, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:27:14', + 'helio-generator', '上传文件信息管理', 0, 1, 'OssFileInfo', 'ant-design:flag-outlined', 100, 1, + '/oss/OssFileInfo/index', ''); +INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", + "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", + "external_link") +VALUES (20220922152715, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:27:14', + 'helio-generator', '查询', 1572848462892752896, 2, 'OssFileInfo:retrieve', NULL, 1, 1, NULL, ''); +INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", + "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", + "external_link") +VALUES (20220922152716, NULL, 1, 1, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:35:48', 'admin', + '新增', 1572848462892752896, 2, 'OssFileInfo:create', NULL, 2, 1, NULL, ''); +INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", + "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", + "external_link") +VALUES (20220922152717, NULL, 1, 1, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:35:55', 'admin', + '编辑', 1572848462892752896, 2, 'OssFileInfo:update', NULL, 4, 1, NULL, ''); +INSERT INTO "sys_menu"("id", "tenant_id", "revision", "del_flag", "created_at", "created_by", "updated_at", + "updated_by", "title", "parent_id", "type", "permission", "icon", "sort", "status", "component", + "external_link") +VALUES (20220922152718, NULL, 1, 0, '2022-09-22 15:27:14', 'helio-generator', '2022-09-22 15:36:03', 'admin', + '删除', 1572848462892752896, 2, 'OssFileInfo:delete', NULL, 2, 1, NULL, ''); + +-- v1.8.0 - Uncarbon - 新增错误原因堆栈、用户UA、IP属地字段;表注释更新 +ALTER TABLE sys_log + ADD COLUMN error_stacktrace varchar(3000) NOT NULL DEFAULT '', + ADD COLUMN user_agent varchar(255) NOT NULL DEFAULT '', + ADD COLUMN ip_location_region_name varchar(100) NOT NULL DEFAULT '', + ADD COLUMN ip_location_province_name varchar(100) NOT NULL DEFAULT '', + ADD COLUMN ip_location_city_name varchar(100) NOT NULL DEFAULT '', + ADD COLUMN ip_location_district_name varchar(100) NOT NULL DEFAULT ''; + +COMMENT ON COLUMN sys_log.error_stacktrace IS '错误原因堆栈'; +COMMENT ON COLUMN sys_log.user_agent IS '用户UA'; +COMMENT ON COLUMN sys_log.ip_location_region_name IS 'IP地址属地-国家或地区名'; +COMMENT ON COLUMN sys_log.ip_location_province_name IS 'IP地址属地-省级行政区名'; +COMMENT ON COLUMN sys_log.ip_location_city_name IS 'IP地址属地-市级行政区名'; +COMMENT ON COLUMN sys_log.ip_location_district_name IS 'IP地址属地-县级行政区名'; + +COMMENT ON TABLE sys_log IS '系统日志'; + +-- v1.8.0 - Uncarbon - 订正系统菜单-权限串缺少默认值问题 +ALTER TABLE "sys_menu" + ALTER COLUMN "permission" SET DEFAULT ''; diff --git a/attachments/db/PostgreSQL/upgrade/2.0.0_to_2.1.0.sql b/attachments/db/PostgreSQL/upgrade/2.0.0_to_2.1.0.sql new file mode 100644 index 0000000..8fef2b3 --- /dev/null +++ b/attachments/db/PostgreSQL/upgrade/2.0.0_to_2.1.0.sql @@ -0,0 +1,64 @@ +-- 重构数据字典,拆分为`sys_data_dict_classified`(数据字典分类)和`sys_data_dict_item`(数据字典项),并重新设计字段 +CREATE TABLE "sys_data_dict_classified" ( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255) COLLATE "pg_catalog"."default", + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255) COLLATE "pg_catalog"."default", + "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "status" int2 NOT NULL DEFAULT 1, + "description" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying +); +COMMENT ON COLUMN "sys_data_dict_classified"."id" IS '主键ID'; +COMMENT ON COLUMN "sys_data_dict_classified"."tenant_id" IS '租户ID'; +COMMENT ON COLUMN "sys_data_dict_classified"."revision" IS '乐观锁'; +COMMENT ON COLUMN "sys_data_dict_classified"."del_flag" IS '逻辑删除标识'; +COMMENT ON COLUMN "sys_data_dict_classified"."created_at" IS '创建时刻'; +COMMENT ON COLUMN "sys_data_dict_classified"."created_by" IS '创建者'; +COMMENT ON COLUMN "sys_data_dict_classified"."updated_at" IS '更新时刻'; +COMMENT ON COLUMN "sys_data_dict_classified"."updated_by" IS '更新者'; +COMMENT ON COLUMN "sys_data_dict_classified"."code" IS '分类编码'; +COMMENT ON COLUMN "sys_data_dict_classified"."name" IS '分类名称'; +COMMENT ON COLUMN "sys_data_dict_classified"."status" IS '状态'; +COMMENT ON COLUMN "sys_data_dict_classified"."description" IS '分类描述'; +COMMENT ON TABLE "sys_data_dict_classified" IS '数据字典分类'; +ALTER TABLE "sys_data_dict_classified" ADD PRIMARY KEY ("id"); + +CREATE TABLE "sys_data_dict_item" ( + "id" int8 NOT NULL, + "tenant_id" int8, + "revision" int8 NOT NULL DEFAULT 1, + "del_flag" int2 NOT NULL DEFAULT 0, + "created_at" timestamp(6) NOT NULL, + "created_by" varchar(255) COLLATE "pg_catalog"."default", + "updated_at" timestamp(6) NOT NULL, + "updated_by" varchar(255) COLLATE "pg_catalog"."default", + "classified_id" int8 NOT NULL, + "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "label" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, + "value" varchar(4096) COLLATE "pg_catalog"."default" NOT NULL, + "status" int2 NOT NULL DEFAULT 1, + "sort" int4 NOT NULL DEFAULT 1, + "description" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying +); +COMMENT ON COLUMN "sys_data_dict_item"."id" IS '主键ID'; +COMMENT ON COLUMN "sys_data_dict_item"."tenant_id" IS '租户ID'; +COMMENT ON COLUMN "sys_data_dict_item"."revision" IS '乐观锁'; +COMMENT ON COLUMN "sys_data_dict_item"."del_flag" IS '逻辑删除标识'; +COMMENT ON COLUMN "sys_data_dict_item"."created_at" IS '创建时刻'; +COMMENT ON COLUMN "sys_data_dict_item"."created_by" IS '创建者'; +COMMENT ON COLUMN "sys_data_dict_item"."updated_at" IS '更新时刻'; +COMMENT ON COLUMN "sys_data_dict_item"."updated_by" IS '更新者'; +COMMENT ON COLUMN "sys_data_dict_item"."classified_id" IS '所属分类ID'; +COMMENT ON COLUMN "sys_data_dict_item"."code" IS '字典项编码'; +COMMENT ON COLUMN "sys_data_dict_item"."label" IS '字典项标签'; +COMMENT ON COLUMN "sys_data_dict_item"."value" IS '字典项值'; +COMMENT ON COLUMN "sys_data_dict_item"."status" IS '状态'; +COMMENT ON COLUMN "sys_data_dict_item"."sort" IS '排序'; +COMMENT ON COLUMN "sys_data_dict_item"."description" IS '描述'; +COMMENT ON TABLE "sys_data_dict_item" IS '数据字典项'; +ALTER TABLE "sys_data_dict_item" ADD PRIMARY KEY ("id"); diff --git a/pom.xml b/pom.xml index 2e9f759..dea6f9f 100644 --- a/pom.xml +++ b/pom.xml @@ -8,13 +8,13 @@ cc.uncarbon.framework helio-starters - 2.0.0 + 2.1.0 helio-boot Helio 单模块版单体脚手架 - 2.0.1 + 2.1.0 diff --git a/src/main/java/cc/uncarbon/module/adminapi/model/response/SelectOptionItemVO.java b/src/main/java/cc/uncarbon/module/adminapi/model/response/SelectOptionItemVO.java index a195aef..f0bc490 100644 --- a/src/main/java/cc/uncarbon/module/adminapi/model/response/SelectOptionItemVO.java +++ b/src/main/java/cc/uncarbon/module/adminapi/model/response/SelectOptionItemVO.java @@ -9,6 +9,7 @@ import lombok.Setter; import lombok.experimental.Accessors; +import java.io.Serial; import java.io.Serializable; import java.util.Arrays; import java.util.Collection; @@ -26,6 +27,7 @@ @Getter public class SelectOptionItemVO implements Serializable { + @Serial private static final long serialVersionUID = 1L; // ID👉名称 一对(用于关联各种实体) diff --git a/src/main/java/cc/uncarbon/module/adminapi/web/sys/AdminSysDataDictController.java b/src/main/java/cc/uncarbon/module/adminapi/web/sys/AdminSysDataDictController.java index 8ec274a..9375c29 100644 --- a/src/main/java/cc/uncarbon/module/adminapi/web/sys/AdminSysDataDictController.java +++ b/src/main/java/cc/uncarbon/module/adminapi/web/sys/AdminSysDataDictController.java @@ -6,22 +6,24 @@ import cc.uncarbon.framework.web.model.request.IdsDTO; import cc.uncarbon.framework.web.model.response.ApiResult; import cc.uncarbon.module.adminapi.constant.AdminApiConstant; +import cc.uncarbon.module.adminapi.util.AdminStpUtil; import cc.uncarbon.module.sys.annotation.SysLog; -import cc.uncarbon.module.sys.model.request.AdminInsertOrUpdateSysDataDictDTO; -import cc.uncarbon.module.sys.model.request.AdminListSysDataDictDTO; -import cc.uncarbon.module.sys.model.response.SysDataDictBO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictClassifiedInsertOrUpdateDTO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictClassifiedListDTO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictItemInsertOrUpdateDTO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictItemListDTO; +import cc.uncarbon.module.sys.model.response.SysDataDictClassifiedBO; +import cc.uncarbon.module.sys.model.response.SysDataDictItemBO; import cc.uncarbon.module.sys.service.SysDataDictService; -import cc.uncarbon.module.adminapi.util.AdminStpUtil; import cn.dev33.satoken.annotation.SaCheckLogin; import cn.dev33.satoken.annotation.SaCheckPermission; -import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; -import jakarta.validation.Valid; - @SaCheckLogin(type = AdminStpUtil.TYPE) @Tag(name = "数据字典管理接口") @@ -37,48 +39,82 @@ public class AdminSysDataDictController { @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.RETRIEVE) - @Operation(summary = "分页列表") - @GetMapping(value = "/sys/data-dicts") - public ApiResult> list(PageParam pageParam, AdminListSysDataDictDTO dto) { - return ApiResult.data(sysDataDictService.adminList(pageParam, dto)); + @Operation(summary = "分页列表数据字典分类") + @GetMapping(value = "/sys/data-dict/classifieds") + public ApiResult> list(PageParam pageParam, AdminSysDataDictClassifiedListDTO dto) { + return ApiResult.data(sysDataDictService.adminListClassified(pageParam, dto)); + } + + @SysLog(value = "新增数据字典分类") + @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.CREATE) + @Operation(summary = "新增数据字典分类") + @PostMapping(value = "/sys/data-dict/classifieds") + public ApiResult insert(@RequestBody @Valid AdminSysDataDictClassifiedInsertOrUpdateDTO dto) { + sysDataDictService.adminInsertClassified(dto); + + return ApiResult.success(); + } + + @SysLog(value = "编辑数据字典分类") + @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.UPDATE) + @Operation(summary = "编辑数据字典分类") + @PutMapping(value = "/sys/data-dict/classifieds/{id}") + public ApiResult update(@PathVariable Long id, @RequestBody @Valid AdminSysDataDictClassifiedInsertOrUpdateDTO dto) { + dto.setId(id); + sysDataDictService.adminUpdateClassified(dto); + + return ApiResult.success(); + } + + @SysLog(value = "删除数据字典分类") + @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.DELETE) + @Operation(summary = "删除数据字典分类") + @DeleteMapping(value = "/sys/data-dict/classifieds") + public ApiResult deleteClassified(@RequestBody @Valid IdsDTO dto) { + sysDataDictService.adminDeleteClassified(dto.getIds()); + + return ApiResult.success(); } @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.RETRIEVE) - @Operation(summary = "详情") - @GetMapping(value = "/sys/data-dicts/{id}") - public ApiResult getById(@PathVariable Long id) { - return ApiResult.data(sysDataDictService.getOneById(id, true)); + @Operation(summary = "分页列表数据字典分类下的字典项") + @GetMapping(value = "/sys/data-dict/classifieds/{classifiedId}/items") + public ApiResult> list(@PathVariable Long classifiedId, PageParam pageParam, AdminSysDataDictItemListDTO dto) { + dto.setClassifiedId(classifiedId); + return ApiResult.data(sysDataDictService.adminListItem(pageParam, dto)); } - @SysLog(value = "新增数据字典") + @SysLog(value = "新增数据字典项") @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.CREATE) - @Operation(summary = "新增") - @PostMapping(value = "/sys/data-dicts") - public ApiResult insert(@RequestBody @Valid AdminInsertOrUpdateSysDataDictDTO dto) { - sysDataDictService.adminInsert(dto); + @Operation(summary = "新增数据字典项") + @PostMapping(value = "/sys/data-dict/classifieds/{classifiedId}/items") + public ApiResult insert(@PathVariable Long classifiedId, @RequestBody @Valid AdminSysDataDictItemInsertOrUpdateDTO dto) { + dto.setClassifiedId(classifiedId); + sysDataDictService.adminInsertItem(dto); return ApiResult.success(); } - @SysLog(value = "编辑数据字典") + @SysLog(value = "编辑数据字典项") @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.UPDATE) - @Operation(summary = "编辑") - @PutMapping(value = "/sys/data-dicts/{id}") - public ApiResult update(@PathVariable Long id, @RequestBody @Valid AdminInsertOrUpdateSysDataDictDTO dto) { - dto.setId(id); - sysDataDictService.adminUpdate(dto); + @Operation(summary = "编辑数据字典项") + @PutMapping(value = "/sys/data-dict/classifieds/{classifiedId}/items/{id}") + public ApiResult update(@PathVariable Long classifiedId, @PathVariable Long id, @RequestBody @Valid AdminSysDataDictItemInsertOrUpdateDTO dto) { + dto + .setId(id) + .setClassifiedId(classifiedId); + sysDataDictService.adminUpdateItem(dto); return ApiResult.success(); } - @SysLog(value = "删除数据字典") + @SysLog(value = "删除数据字典项") @SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.DELETE) - @Operation(summary = "删除") - @DeleteMapping(value = "/sys/data-dicts") - public ApiResult delete(@RequestBody @Valid IdsDTO dto) { - sysDataDictService.adminDelete(dto.getIds()); + @Operation(summary = "删除数据字典项") + @DeleteMapping(value = "/sys/data-dict/classifieds/{classifiedId}/items") + public ApiResult deleteItem(@PathVariable Long classifiedId, @RequestBody @Valid IdsDTO dto) { + sysDataDictService.adminDeleteItem(dto.getIds(), classifiedId); return ApiResult.success(); } - } diff --git a/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictClassifiedEntity.java b/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictClassifiedEntity.java new file mode 100644 index 0000000..7117ac9 --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictClassifiedEntity.java @@ -0,0 +1,50 @@ +package cc.uncarbon.module.sys.entity; + +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; +import cc.uncarbon.framework.crud.entity.HelioBaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +import java.io.Serial; + + +/** + * 数据字典分类 + */ +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@Data +@TableName(value = "sys_data_dict_classified") +public class SysDataDictClassifiedEntity extends HelioBaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "分类编码") + @TableField(value = "code") + private String code; + + @Schema(description = "分类名称") + @TableField(value = "name") + private String name; + + @Schema(description = "状态") + @TableField(value = "status") + private EnabledStatusEnum status; + + @Schema(description = "分类描述") + @TableField(value = "description") + private String description; + +} diff --git a/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictEntity.java b/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictEntity.java deleted file mode 100644 index ce49628..0000000 --- a/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictEntity.java +++ /dev/null @@ -1,59 +0,0 @@ -package cc.uncarbon.module.sys.entity; - -import cc.uncarbon.framework.crud.entity.HelioBaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; - - -/** - * 数据字典 - */ -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -@SuperBuilder -@AllArgsConstructor -@NoArgsConstructor -@Data -@TableName(value = "sys_data_dict") -public class SysDataDictEntity extends HelioBaseEntity { - - @Schema(description = "驼峰式键名") - @TableField(value = "camel_case_key") - private String camelCaseKey; - - @Schema(description = "下划线式键名") - @TableField(value = "under_case_key") - private String underCaseKey; - - @Schema(description = "帕斯卡式键名") - @TableField(value = "pascal_case_key") - private String pascalCaseKey; - - @Schema(description = "数据值") - @TableField(value = "value") - private String value; - - @Schema(description = "描述") - @TableField(value = "description") - private String description; - - @Schema(description = "单位") - @TableField(value = "unit") - private String unit; - - @Schema(description = "取值范围") - @TableField(value = "value_range") - private String valueRange; - - @Schema(description = "别称键名") - @TableField(value = "alias_key") - private String aliasKey; - -} diff --git a/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictItemEntity.java b/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictItemEntity.java new file mode 100644 index 0000000..c752b88 --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/entity/SysDataDictItemEntity.java @@ -0,0 +1,62 @@ +package cc.uncarbon.module.sys.entity; + +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; +import cc.uncarbon.framework.crud.entity.HelioBaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +import java.io.Serial; + + +/** + * 数据字典项 + */ +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@Data +@TableName(value = "sys_data_dict_item") +public class SysDataDictItemEntity extends HelioBaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "所属分类ID") + @TableField(value = "classified_id") + private Long classifiedId; + + @Schema(description = "字典项编码") + @TableField(value = "code") + private String code; + + @Schema(description = "字典项标签") + @TableField(value = "label") + private String label; + + @Schema(description = "字典项值") + @TableField(value = "value") + private String value; + + @Schema(description = "状态") + @TableField(value = "status") + private EnabledStatusEnum status; + + @Schema(description = "排序") + @TableField(value = "sort") + private Integer sort; + + @Schema(description = "描述") + @TableField(value = "description") + private String description; + +} diff --git a/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictClassifiedMapper.java b/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictClassifiedMapper.java new file mode 100644 index 0000000..f39d0f2 --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictClassifiedMapper.java @@ -0,0 +1,31 @@ +package cc.uncarbon.module.sys.mapper; + +import cc.uncarbon.framework.core.constant.HelioConstant; +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; +import cc.uncarbon.module.sys.entity.SysDataDictClassifiedEntity; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Objects; + + +/** + * 数据字典分类 + */ +@Mapper +public interface SysDataDictClassifiedMapper extends BaseMapper { + + default SysDataDictClassifiedEntity selectByCode(@Nonnull String code, @Nullable EnabledStatusEnum status) { + return selectOne( + new QueryWrapper() + .lambda() + .eq(SysDataDictClassifiedEntity::getCode, code) + .eq(Objects.nonNull(status), SysDataDictClassifiedEntity::getStatus, status) + .last(HelioConstant.CRUD.SQL_LIMIT_1) + ); + } + +} diff --git a/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictMapper.java b/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictItemMapper.java similarity index 50% rename from src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictMapper.java rename to src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictItemMapper.java index dd8664f..6d84b3c 100644 --- a/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictMapper.java +++ b/src/main/java/cc/uncarbon/module/sys/mapper/SysDataDictItemMapper.java @@ -1,14 +1,14 @@ package cc.uncarbon.module.sys.mapper; -import cc.uncarbon.module.sys.entity.SysDataDictEntity; +import cc.uncarbon.module.sys.entity.SysDataDictItemEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** - * 数据字典 + * 数据字典项 */ @Mapper -public interface SysDataDictMapper extends BaseMapper { +public interface SysDataDictItemMapper extends BaseMapper { } diff --git a/src/main/java/cc/uncarbon/module/sys/model/request/AdminInsertOrUpdateSysDataDictDTO.java b/src/main/java/cc/uncarbon/module/sys/model/request/AdminInsertOrUpdateSysDataDictDTO.java deleted file mode 100644 index 1d2f71c..0000000 --- a/src/main/java/cc/uncarbon/module/sys/model/request/AdminInsertOrUpdateSysDataDictDTO.java +++ /dev/null @@ -1,65 +0,0 @@ -package cc.uncarbon.module.sys.model.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; -import java.io.Serializable; - - -/** - * 后台管理-新增/编辑数据字典 - */ -@Accessors(chain = true) -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Data -public class AdminInsertOrUpdateSysDataDictDTO implements Serializable { - - @Schema(description = "主键ID", hidden = true, title = "仅更新时使用") - private Long id; - - @Schema(description = "驼峰式键名", requiredMode = Schema.RequiredMode.REQUIRED) - @Size(max = 100, message = "【驼峰式键名】最长100位") - @NotBlank(message = "驼峰式键名不能为空") - private String camelCaseKey; - - @Schema(description = "下划线式键名", requiredMode = Schema.RequiredMode.REQUIRED) - @Size(max = 100, message = "【下划线式键名】最长100位") - @NotBlank(message = "下划线式键名不能为空") - private String underCaseKey; - - @Schema(description = "帕斯卡式键名", requiredMode = Schema.RequiredMode.REQUIRED) - @Size(max = 100, message = "【帕斯卡式键名】最长100位") - @NotBlank(message = "帕斯卡式键名不能为空") - private String pascalCaseKey; - - @Schema(description = "数据值", requiredMode = Schema.RequiredMode.REQUIRED) - @Size(max = 255, message = "【数据值】最长255位") - @NotBlank(message = "数据值不能为空") - private String value; - - @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED) - @Size(max = 255, message = "【描述】最长255位") - @NotBlank(message = "描述不能为空") - private String description; - - @Schema(description = "单位") - @Size(max = 30, message = "【单位】最长30位") - private String unit; - - @Schema(description = "取值范围") - @Size(max = 255, message = "【取值范围】最长255位") - private String valueRange; - - @Schema(description = "别称键名") - @Size(max = 100, message = "【别称键名】最长100位") - private String aliasKey; - -} diff --git a/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedInsertOrUpdateDTO.java b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedInsertOrUpdateDTO.java new file mode 100644 index 0000000..d3faca6 --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedInsertOrUpdateDTO.java @@ -0,0 +1,53 @@ +package cc.uncarbon.module.sys.model.request; + +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 后台管理-新增/编辑数据字典分类 DTO + */ +@Accessors(chain = true) +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class AdminSysDataDictClassifiedInsertOrUpdateDTO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "主键ID", hidden = true, title = "仅更新时使用") + private Long id; + + @Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED) + @Size(max = 255, message = "【分类编码】最长255位") + @NotBlank(message = "分类编码不能为空") + private String code; + + @Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED) + @Size(max = 255, message = "【分类名称】最长255位") + @NotBlank(message = "分类名称不能为空") + private String name; + + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "状态不能为空") + private EnabledStatusEnum status; + + @Schema(description = "分类描述") + @Size(max = 255, message = "【分类描述】最长255位") + private String description; + +} diff --git a/src/main/java/cc/uncarbon/module/sys/model/request/AdminListSysDataDictDTO.java b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedListDTO.java similarity index 50% rename from src/main/java/cc/uncarbon/module/sys/model/request/AdminListSysDataDictDTO.java rename to src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedListDTO.java index 3167573..4eac478 100644 --- a/src/main/java/cc/uncarbon/module/sys/model/request/AdminListSysDataDictDTO.java +++ b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictClassifiedListDTO.java @@ -2,25 +2,30 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; +import java.io.Serial; import java.io.Serializable; /** - * 后台管理-分页列表数据字典 + * 后台管理-分页列表数据字典分类 DTO */ @Accessors(chain = true) -@Builder +@SuperBuilder @AllArgsConstructor @NoArgsConstructor @Data -public class AdminListSysDataDictDTO implements Serializable { +public class AdminSysDataDictClassifiedListDTO implements Serializable { - @Schema(description = "描述(关键词)") - private String description; + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "分类编码") + private String code; } diff --git a/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemInsertOrUpdateDTO.java b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemInsertOrUpdateDTO.java new file mode 100644 index 0000000..36e5dfa --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemInsertOrUpdateDTO.java @@ -0,0 +1,65 @@ +package cc.uncarbon.module.sys.model.request; + +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 后台管理-新增/编辑数据字典项 DTO + */ +@Accessors(chain = true) +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class AdminSysDataDictItemInsertOrUpdateDTO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "主键ID", hidden = true, title = "仅更新时使用") + private Long id; + + @Schema(description = "所属分类ID", hidden = true) + private Long classifiedId; + + @Schema(description = "字典项编码", requiredMode = Schema.RequiredMode.REQUIRED) + @Size(max = 255, message = "【字典项编码】最长255位") + @NotBlank(message = "字典项编码不能为空") + private String code; + + @Schema(description = "字典项标签", requiredMode = Schema.RequiredMode.REQUIRED) + @Size(max = 255, message = "【字典项标签】最长255位") + @NotBlank(message = "字典项标签不能为空") + private String label; + + @Schema(description = "字典项值", requiredMode = Schema.RequiredMode.REQUIRED) + @Size(max = 4096, message = "【字典项值】最长4096位") + @NotBlank(message = "字典项值不能为空") + private String value; + + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "状态不能为空") + private EnabledStatusEnum status; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "排序不能为空") + private Integer sort; + + @Schema(description = "描述") + @Size(max = 255, message = "【描述】最长255位") + private String description; + +} diff --git a/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemListDTO.java b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemListDTO.java new file mode 100644 index 0000000..aa8471a --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/model/request/AdminSysDataDictItemListDTO.java @@ -0,0 +1,31 @@ +package cc.uncarbon.module.sys.model.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 后台管理-分页列表数据字典项 DTO + */ +@Accessors(chain = true) +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class AdminSysDataDictItemListDTO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "所属分类ID", hidden = true) + private Long classifiedId; + +} diff --git a/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictBO.java b/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictClassifiedBO.java similarity index 61% rename from src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictBO.java rename to src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictClassifiedBO.java index 8fb6c79..3d7a039 100644 --- a/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictBO.java +++ b/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictClassifiedBO.java @@ -1,30 +1,36 @@ package cc.uncarbon.module.sys.model.response; import cc.uncarbon.framework.core.constant.HelioConstant; +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serial; import java.io.Serializable; import java.time.LocalDateTime; /** - * 数据字典BO + * 数据字典分类 BO */ @Accessors(chain = true) -@Builder +@SuperBuilder @AllArgsConstructor @NoArgsConstructor @Data -public class SysDataDictBO implements Serializable { +public class SysDataDictClassifiedBO implements Serializable { - @Schema(description = "主键ID") + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "主键ID", hidden = true, title = "仅更新时使用") private Long id; @Schema(description = "创建时刻") @@ -37,28 +43,16 @@ public class SysDataDictBO implements Serializable { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = HelioConstant.Jackson.DATE_TIME_FORMAT) private LocalDateTime updatedAt; - @Schema(description = "驼峰式键名") - private String camelCaseKey; - - @Schema(description = "下划线式键名") - private String underCaseKey; + @Schema(description = "分类编码") + private String code; - @Schema(description = "帕斯卡式键名") - private String pascalCaseKey; + @Schema(description = "分类名称") + private String name; - @Schema(description = "数据值") - private String value; + @Schema(description = "状态") + private EnabledStatusEnum status; - @Schema(description = "描述") + @Schema(description = "分类描述") private String description; - @Schema(description = "单位") - private String unit; - - @Schema(description = "取值范围") - private String valueRange; - - @Schema(description = "别称键名") - private String aliasKey; - } diff --git a/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictItemBO.java b/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictItemBO.java new file mode 100644 index 0000000..08ba33b --- /dev/null +++ b/src/main/java/cc/uncarbon/module/sys/model/response/SysDataDictItemBO.java @@ -0,0 +1,67 @@ +package cc.uncarbon.module.sys.model.response; + +import cc.uncarbon.framework.core.constant.HelioConstant; +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serial; +import java.io.Serializable; +import java.time.LocalDateTime; + + +/** + * 数据字典项 BO + */ +@Accessors(chain = true) +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class SysDataDictItemBO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Schema(description = "主键ID", hidden = true, title = "仅更新时使用") + private Long id; + + @Schema(description = "创建时刻") + @DateTimeFormat(pattern = HelioConstant.Jackson.DATE_TIME_FORMAT) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = HelioConstant.Jackson.DATE_TIME_FORMAT) + private LocalDateTime createdAt; + + @Schema(description = "更新时刻") + @DateTimeFormat(pattern = HelioConstant.Jackson.DATE_TIME_FORMAT) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = HelioConstant.Jackson.DATE_TIME_FORMAT) + private LocalDateTime updatedAt; + + @Schema(description = "所属分类ID") + private Long classifiedId; + + @Schema(description = "字典项编码") + private String code; + + @Schema(description = "字典项标签") + private String label; + + @Schema(description = "字典项值") + private String value; + + @Schema(description = "状态") + private EnabledStatusEnum status; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "描述") + private String description; + +} diff --git a/src/main/java/cc/uncarbon/module/sys/service/SysDataDictService.java b/src/main/java/cc/uncarbon/module/sys/service/SysDataDictService.java index c839797..3041d51 100644 --- a/src/main/java/cc/uncarbon/module/sys/service/SysDataDictService.java +++ b/src/main/java/cc/uncarbon/module/sys/service/SysDataDictService.java @@ -1,29 +1,32 @@ package cc.uncarbon.module.sys.service; import cc.uncarbon.framework.core.constant.HelioConstant; +import cc.uncarbon.framework.core.enums.EnabledStatusEnum; import cc.uncarbon.framework.core.exception.BusinessException; import cc.uncarbon.framework.core.page.PageParam; import cc.uncarbon.framework.core.page.PageResult; -import cc.uncarbon.module.sys.entity.SysDataDictEntity; -import cc.uncarbon.module.sys.enums.SysErrorEnum; -import cc.uncarbon.module.sys.mapper.SysDataDictMapper; -import cc.uncarbon.module.sys.model.request.AdminInsertOrUpdateSysDataDictDTO; -import cc.uncarbon.module.sys.model.request.AdminListSysDataDictDTO; -import cc.uncarbon.module.sys.model.response.SysDataDictBO; +import cc.uncarbon.module.sys.entity.SysDataDictClassifiedEntity; +import cc.uncarbon.module.sys.entity.SysDataDictItemEntity; +import cc.uncarbon.module.sys.mapper.SysDataDictClassifiedMapper; +import cc.uncarbon.module.sys.mapper.SysDataDictItemMapper; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictClassifiedInsertOrUpdateDTO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictClassifiedListDTO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictItemInsertOrUpdateDTO; +import cc.uncarbon.module.sys.model.request.AdminSysDataDictItemListDTO; +import cc.uncarbon.module.sys.model.response.SysDataDictClassifiedBO; +import cc.uncarbon.module.sys.model.response.SysDataDictItemBO; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.CharSequenceUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import jakarta.annotation.Nonnull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; /** @@ -34,90 +37,156 @@ @Slf4j public class SysDataDictService { - private final SysDataDictMapper sysDataDictMapper; + private final SysDataDictClassifiedMapper sysDataDictClassifiedMapper; + private final SysDataDictItemMapper sysDataDictItemMapper; /** - * 后台管理-分页列表 + * 后台管理-分页列表数据字典分类 */ - public PageResult adminList(PageParam pageParam, AdminListSysDataDictDTO dto) { - Page entityPage = sysDataDictMapper.selectPage( + public PageResult adminListClassified(PageParam pageParam, AdminSysDataDictClassifiedListDTO dto) { + Page entityPage = sysDataDictClassifiedMapper.selectPage( new Page<>(pageParam.getPageNum(), pageParam.getPageSize()), - new QueryWrapper() + new QueryWrapper() .lambda() - // 参数描述 - .like(CharSequenceUtil.isNotBlank(dto.getDescription()), SysDataDictEntity::getDescription, CharSequenceUtil.cleanBlank(dto.getDescription())) + // 分类编码 + .eq(CharSequenceUtil.isNotBlank(dto.getCode()), SysDataDictClassifiedEntity::getCode, CharSequenceUtil.cleanBlank(dto.getCode())) // 排序 - .orderByDesc(SysDataDictEntity::getCreatedAt) + .orderByDesc(SysDataDictClassifiedEntity::getCreatedAt) ); - return this.entityPage2BOPage(entityPage); + return this.classifiedEntityPage2BOPage(entityPage); } /** - * 根据 ID 取详情 + * 后台管理-新增数据字典分类 * - * @param id 主键ID - * @return null or BO + * @return 主键ID */ - public SysDataDictBO getOneById(Long id) { - return this.getOneById(id, false); + @Transactional(rollbackFor = Exception.class) + public Long adminInsertClassified(AdminSysDataDictClassifiedInsertOrUpdateDTO dto) { + log.info("[后台管理-新增数据字典分类] >> 入参={}", dto); + this.checkExistence(dto); + + dto.setId(null); + SysDataDictClassifiedEntity entity = new SysDataDictClassifiedEntity(); + BeanUtil.copyProperties(dto, entity); + + sysDataDictClassifiedMapper.insert(entity); + + return entity.getId(); } /** - * 根据 ID 取详情 - * - * @param id 主键ID - * @param throwIfInvalidId 是否在 ID 无效时抛出异常 - * @return null or BO - */ - public SysDataDictBO getOneById(Long id, boolean throwIfInvalidId) throws BusinessException { - SysDataDictEntity entity = sysDataDictMapper.selectById(id); - if (throwIfInvalidId) { - SysErrorEnum.INVALID_ID.assertNotNull(entity); - } + * 后台管理-编辑数据字典分类 + */ + @Transactional(rollbackFor = Exception.class) + public void adminUpdateClassified(AdminSysDataDictClassifiedInsertOrUpdateDTO dto) { + log.info("[后台管理-编辑数据字典分类] >> 入参={}", dto); + this.checkExistence(dto); + + SysDataDictClassifiedEntity entity = new SysDataDictClassifiedEntity(); + BeanUtil.copyProperties(dto, entity); + + sysDataDictClassifiedMapper.updateById(entity); + } + + /** + * 后台管理-删除数据字典分类 + */ + @Transactional(rollbackFor = Exception.class) + public void adminDeleteClassified(Collection ids) { + log.info("[后台管理-删除数据字典分类] >> 入参={}", ids); + sysDataDictClassifiedMapper.deleteBatchIds(ids); + } + + /** + * 后台管理-分页列表数据字典分类下的字典项 + */ + public PageResult adminListItem(PageParam pageParam, AdminSysDataDictItemListDTO dto) { + Page entityPage = sysDataDictItemMapper.selectPage( + new Page<>(pageParam.getPageNum(), pageParam.getPageSize()), + new QueryWrapper() + .lambda() + // 分类ID + .eq(SysDataDictItemEntity::getClassifiedId, dto.getClassifiedId()) + // 排序 + .orderByAsc(SysDataDictItemEntity::getSort) + ); - return this.entity2BO(entity); + return this.itemEntityPage2BOPage(entityPage); } /** - * 后台管理-新增 + * 后台管理-新增数据字典项 + * + * @return 主键ID */ @Transactional(rollbackFor = Exception.class) - public Long adminInsert(AdminInsertOrUpdateSysDataDictDTO dto) { - log.info("[后台管理-新增数据字典] >> 入参={}", dto); + public Long adminInsertItem(AdminSysDataDictItemInsertOrUpdateDTO dto) { + log.info("[后台管理-新增数据字典项] >> 入参={}", dto); this.checkExistence(dto); dto.setId(null); - SysDataDictEntity entity = new SysDataDictEntity(); + SysDataDictItemEntity entity = new SysDataDictItemEntity(); BeanUtil.copyProperties(dto, entity); - sysDataDictMapper.insert(entity); + sysDataDictItemMapper.insert(entity); return entity.getId(); } /** - * 后台管理-编辑 + * 后台管理-编辑数据字典项 */ @Transactional(rollbackFor = Exception.class) - public void adminUpdate(AdminInsertOrUpdateSysDataDictDTO dto) { - log.info("[后台管理-编辑数据字典] >> 入参={}", dto); + public void adminUpdateItem(AdminSysDataDictItemInsertOrUpdateDTO dto) { + log.info("[后台管理-编辑数据字典项] >> 入参={}", dto); this.checkExistence(dto); - SysDataDictEntity entity = new SysDataDictEntity(); + SysDataDictItemEntity entity = new SysDataDictItemEntity(); BeanUtil.copyProperties(dto, entity); - sysDataDictMapper.updateById(entity); + sysDataDictItemMapper.updateById(entity); } /** - * 后台管理-删除 + * 后台管理-删除数据字典项 */ @Transactional(rollbackFor = Exception.class) - public void adminDelete(Collection ids) { - log.info("[后台管理-删除数据字典] >> 入参={}", ids); - sysDataDictMapper.deleteBatchIds(ids); + public void adminDeleteItem(Collection ids, Long classifiedId) { + log.info("[后台管理-删除数据字典项] >> 分类ID={} 入参={}", classifiedId, ids); + sysDataDictItemMapper.delete( + new QueryWrapper() + .lambda() + .eq(SysDataDictItemEntity::getClassifiedId, classifiedId) + .in(SysDataDictItemEntity::getId, ids) + ); + } + + /** + * 列举指定分类编码下的所有启用的字典项 + * + * @return 存在则返回字典项列表;不存在或没有符合的字典项,均返回空列表 + */ + public List listEnabledItemsByClassifiedCode(@Nonnull String classifiedCode) { + SysDataDictClassifiedEntity classified = + sysDataDictClassifiedMapper.selectByCode(classifiedCode, EnabledStatusEnum.ENABLED); + if (Objects.isNull(classified)) { + return Collections.emptyList(); + } + return itemEntityList2BOs( + sysDataDictItemMapper.selectList( + new QueryWrapper() + .lambda() + // 分类ID + .eq(SysDataDictItemEntity::getClassifiedId, classified.getId()) + // 状态 + .eq(SysDataDictItemEntity::getStatus, EnabledStatusEnum.ENABLED) + // 排序 + .orderByAsc(SysDataDictItemEntity::getSort) + ) + ); } /* @@ -132,12 +201,31 @@ public void adminDelete(Collection ids) { * @param entity 实体 * @return BO */ - private SysDataDictBO entity2BO(SysDataDictEntity entity) { + private SysDataDictClassifiedBO entity2BO(SysDataDictClassifiedEntity entity) { + if (entity == null) { + return null; + } + + SysDataDictClassifiedBO bo = new SysDataDictClassifiedBO(); + BeanUtil.copyProperties(entity, bo); + + // 可以在此处为BO填充字段 + + return bo; + } + + /** + * 实体转 BO + * + * @param entity 实体 + * @return BO + */ + private SysDataDictItemBO entity2BO(SysDataDictItemEntity entity) { if (entity == null) { return null; } - SysDataDictBO bo = new SysDataDictBO(); + SysDataDictItemBO bo = new SysDataDictItemBO(); BeanUtil.copyProperties(entity, bo); // 可以在此处为BO填充字段 @@ -151,13 +239,33 @@ private SysDataDictBO entity2BO(SysDataDictEntity entity) { * @param entityList 实体 List * @return BO List */ - private List entityList2BOs(List entityList) { + private List classifiedEntityList2BOs(List entityList) { + if (CollUtil.isEmpty(entityList)) { + return Collections.emptyList(); + } + + // 深拷贝 + List ret = new ArrayList<>(entityList.size()); + entityList.forEach( + entity -> ret.add(this.entity2BO(entity)) + ); + + return ret; + } + + /** + * 实体 List 转 BO List + * + * @param entityList 实体 List + * @return BO List + */ + private List itemEntityList2BOs(List entityList) { if (CollUtil.isEmpty(entityList)) { return Collections.emptyList(); } // 深拷贝 - List ret = new ArrayList<>(entityList.size()); + List ret = new ArrayList<>(entityList.size()); entityList.forEach( entity -> ret.add(this.entity2BO(entity)) ); @@ -171,12 +279,47 @@ private List entityList2BOs(List entityList) { * @param entityPage 实体分页 * @return BO 分页 */ - private PageResult entityPage2BOPage(Page entityPage) { - return new PageResult() + private PageResult classifiedEntityPage2BOPage(Page entityPage) { + return new PageResult() .setCurrent(entityPage.getCurrent()) .setSize(entityPage.getSize()) .setTotal(entityPage.getTotal()) - .setRecords(this.entityList2BOs(entityPage.getRecords())); + .setRecords(this.classifiedEntityList2BOs(entityPage.getRecords())); + } + + /** + * 实体分页转 BO 分页 + * + * @param entityPage 实体分页 + * @return BO 分页 + */ + private PageResult itemEntityPage2BOPage(Page entityPage) { + return new PageResult() + .setCurrent(entityPage.getCurrent()) + .setSize(entityPage.getSize()) + .setTotal(entityPage.getTotal()) + .setRecords(this.itemEntityList2BOs(entityPage.getRecords())); + } + + /** + * 检查是否已存在相同数据 + * + * @param dto DTO + */ + private void checkExistence(AdminSysDataDictClassifiedInsertOrUpdateDTO dto) { + SysDataDictClassifiedEntity existingEntity = sysDataDictClassifiedMapper.selectOne( + new QueryWrapper() + .lambda() + // 仅取主键ID + .select(SysDataDictClassifiedEntity::getId) + // 分类编码相同 + .eq(SysDataDictClassifiedEntity::getCode, dto.getCode()) + .last(HelioConstant.CRUD.SQL_LIMIT_1) + ); + + if (existingEntity != null && !existingEntity.getId().equals(dto.getId())) { + throw new BusinessException(400, "已存在相同数据字典分类,请重新输入"); + } } /** @@ -184,25 +327,21 @@ private PageResult entityPage2BOPage(Page enti * * @param dto DTO */ - private void checkExistence(AdminInsertOrUpdateSysDataDictDTO dto) { - SysDataDictEntity existingEntity = sysDataDictMapper.selectOne( - new QueryWrapper() + private void checkExistence(AdminSysDataDictItemInsertOrUpdateDTO dto) { + SysDataDictItemEntity existingEntity = sysDataDictItemMapper.selectOne( + new QueryWrapper() .lambda() // 仅取主键ID - .select(SysDataDictEntity::getId) - // 驼峰式键名相同 - .eq(SysDataDictEntity::getCamelCaseKey, dto.getCamelCaseKey()) - .or() - // 或帕斯卡式键名相同 - .eq(SysDataDictEntity::getPascalCaseKey, dto.getPascalCaseKey()) - .or() - // 或下划线式键名相同 - .eq(SysDataDictEntity::getUnderCaseKey, dto.getUnderCaseKey()) + .select(SysDataDictItemEntity::getId) + // 分类ID相同 + .eq(SysDataDictItemEntity::getClassifiedId, dto.getClassifiedId()) + // 分类编码相同 + .eq(SysDataDictItemEntity::getCode, dto.getCode()) .last(HelioConstant.CRUD.SQL_LIMIT_1) ); if (existingEntity != null && !existingEntity.getId().equals(dto.getId())) { - throw new BusinessException(400, "已存在相同数据字典,请重新输入"); + throw new BusinessException(400, "已存在相同数据字典项,请重新输入"); } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 981f8c3..509943d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -85,6 +85,8 @@ logging: # 指定日志级别,开发、测试环境建议为 DEBUG,生产环境建议为 INFO cc.uncarbon.framework: DEBUG cc.uncarbon.module: DEBUG + # 单元测试日志级别 + cc.uncarbon.test: INFO # 详细配置文档:https://sa-token.cc/doc.html#/use/config sa-token: diff --git a/src/test/java/cc/uncarbon/test/ExampleUnitTest.java b/src/test/java/cc/uncarbon/test/ExampleUnitTest.java index c0c9fe5..67ae65d 100644 --- a/src/test/java/cc/uncarbon/test/ExampleUnitTest.java +++ b/src/test/java/cc/uncarbon/test/ExampleUnitTest.java @@ -11,7 +11,7 @@ import cn.hutool.core.collection.CollUtil; import jakarta.annotation.Resource; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @@ -29,8 +29,8 @@ class ExampleUnitTest { private SysRoleService sysRoleService; - @BeforeEach - public void init() { + @BeforeAll + public static void init() { // 设置用户上下文 UserContext userContext = new UserContext(); userContext