Commit 909d3309d24b41147e8de429e3aa887f8dee887a

Authored by YunaiV
1 parent f869a571

【优化】支持登陆用户,直接读取昵称、部门等信息,也支持自定义字段

sql/mysql/ruoyi-vue-pro.sql
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 Target Server Version : 80200 (8.2.0) 11 Target Server Version : 80200 (8.2.0)
12 File Encoding : 65001 12 File Encoding : 65001
13 13
14 - Date: 04/04/2024 01:17:25 14 + Date: 07/04/2024 19:33:28
15 */ 15 */
16 16
17 SET NAMES utf8mb4; 17 SET NAMES utf8mb4;
@@ -347,7 +347,7 @@ CREATE TABLE `infra_api_access_log` ( @@ -347,7 +347,7 @@ CREATE TABLE `infra_api_access_log` (
347 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 347 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
348 PRIMARY KEY (`id`) USING BTREE, 348 PRIMARY KEY (`id`) USING BTREE,
349 INDEX `idx_create_time`(`create_time` ASC) USING BTREE 349 INDEX `idx_create_time`(`create_time` ASC) USING BTREE
350 -) ENGINE = InnoDB AUTO_INCREMENT = 35925 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'API 访问日志表'; 350 +) ENGINE = InnoDB AUTO_INCREMENT = 35934 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'API 访问日志表';
351 351
352 -- ---------------------------- 352 -- ----------------------------
353 -- Records of infra_api_access_log 353 -- Records of infra_api_access_log
@@ -389,7 +389,7 @@ CREATE TABLE `infra_api_error_log` ( @@ -389,7 +389,7 @@ CREATE TABLE `infra_api_error_log` (
389 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 389 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
390 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 390 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
391 PRIMARY KEY (`id`) USING BTREE 391 PRIMARY KEY (`id`) USING BTREE
392 -) ENGINE = InnoDB AUTO_INCREMENT = 16462 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; 392 +) ENGINE = InnoDB AUTO_INCREMENT = 16468 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
393 393
394 -- ---------------------------- 394 -- ----------------------------
395 -- Records of infra_api_error_log 395 -- Records of infra_api_error_log
@@ -744,7 +744,7 @@ CREATE TABLE `infra_file_content` ( @@ -744,7 +744,7 @@ CREATE TABLE `infra_file_content` (
744 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 744 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
745 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 745 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
746 PRIMARY KEY (`id`) USING BTREE 746 PRIMARY KEY (`id`) USING BTREE
747 -) ENGINE = InnoDB AUTO_INCREMENT = 282 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; 747 +) ENGINE = InnoDB AUTO_INCREMENT = 283 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
748 748
749 -- ---------------------------- 749 -- ----------------------------
750 -- Records of infra_file_content 750 -- Records of infra_file_content
@@ -897,13 +897,13 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st @@ -897,13 +897,13 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
897 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (13, 2, '自定义', '2', 'infra_config_type', 0, 'primary', '', '参数类型 - 自定义', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:06:07', b'0'); 897 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (13, 2, '自定义', '2', 'infra_config_type', 0, 'primary', '', '参数类型 - 自定义', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:06:07', b'0');
898 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (14, 1, '通知', '1', 'system_notice_type', 0, 'success', '', '通知', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:05:57', b'0'); 898 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (14, 1, '通知', '1', 'system_notice_type', 0, 'success', '', '通知', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:05:57', b'0');
899 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 2, '公告', '2', 'system_notice_type', 0, 'info', '', '公告', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:06:01', b'0'); 899 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 2, '公告', '2', 'system_notice_type', 0, 'info', '', '公告', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:06:01', b'0');
900 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 0, '其它', '0', 'system_operate_type', 0, 'default', '', '其它操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:32:46', b'0');  
901 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 1, '查询', '1', 'system_operate_type', 0, 'info', '', '查询操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:33:16', b'0');  
902 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (18, 2, '新增', '2', 'system_operate_type', 0, 'primary', '', '新增操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:33:13', b'0');  
903 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (19, 3, '修改', '3', 'system_operate_type', 0, 'warning', '', '修改操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:33:22', b'0');  
904 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (20, 4, '删除', '4', 'system_operate_type', 0, 'danger', '', '删除操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:33:27', b'0');  
905 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (22, 5, '导出', '5', 'system_operate_type', 0, 'default', '', '导出操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:33:32', b'0');  
906 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (23, 6, '导入', '6', 'system_operate_type', 0, 'default', '', '导入操作', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:33:35', b'0'); 900 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 0, '其它', '0', 'infra_operate_type', 0, 'default', '', '其它操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:19', b'0');
  901 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 1, '查询', '1', 'infra_operate_type', 0, 'info', '', '查询操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:20', b'0');
  902 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (18, 2, '新增', '2', 'infra_operate_type', 0, 'primary', '', '新增操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:21', b'0');
  903 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (19, 3, '修改', '3', 'infra_operate_type', 0, 'warning', '', '修改操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:22', b'0');
  904 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (20, 4, '删除', '4', 'infra_operate_type', 0, 'danger', '', '删除操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:23', b'0');
  905 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (22, 5, '导出', '5', 'infra_operate_type', 0, 'default', '', '导出操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:24', b'0');
  906 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (23, 6, '导入', '6', 'infra_operate_type', 0, 'default', '', '导入操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:25', b'0');
907 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (27, 1, '开启', '0', 'common_status', 0, 'primary', '', '开启状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:39', b'0'); 907 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (27, 1, '开启', '0', 'common_status', 0, 'primary', '', '开启状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:39', b'0');
908 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (28, 2, '关闭', '1', 'common_status', 0, 'info', '', '关闭状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:44', b'0'); 908 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (28, 2, '关闭', '1', 'common_status', 0, 'info', '', '关闭状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:44', b'0');
909 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (29, 1, '目录', '1', 'system_menu_type', 0, '', '', '目录', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:45', b'0'); 909 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (29, 1, '目录', '1', 'system_menu_type', 0, '', '', '目录', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:45', b'0');
@@ -1291,7 +1291,7 @@ BEGIN; @@ -1291,7 +1291,7 @@ BEGIN;
1291 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1, '用户性别', 'system_user_sex', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2022-05-16 20:29:32', b'0', NULL); 1291 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1, '用户性别', 'system_user_sex', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2022-05-16 20:29:32', b'0', NULL);
1292 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (6, '参数类型', 'infra_config_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:36:54', b'0', NULL); 1292 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (6, '参数类型', 'infra_config_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:36:54', b'0', NULL);
1293 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (7, '通知类型', 'system_notice_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:35:26', b'0', NULL); 1293 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (7, '通知类型', 'system_notice_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:35:26', b'0', NULL);
1294 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (9, '操作类型', 'system_operate_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 09:32:21', b'0', NULL); 1294 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (9, '操作类型', 'infra_operate_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:01', b'0', NULL);
1295 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (10, '系统状态', 'common_status', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:21:28', b'0', NULL); 1295 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (10, '系统状态', 'common_status', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:21:28', b'0', NULL);
1296 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (11, 'Boolean 是否类型', 'infra_boolean_string', 0, 'boolean 转是否', '', '2021-01-19 03:20:08', '', '2022-02-01 16:37:10', b'0', NULL); 1296 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (11, 'Boolean 是否类型', 'infra_boolean_string', 0, 'boolean 转是否', '', '2021-01-19 03:20:08', '', '2022-02-01 16:37:10', b'0', NULL);
1297 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (104, '登陆结果', 'system_login_result', 0, '登陆结果', '', '2021-01-18 06:17:11', '', '2022-02-01 16:36:00', b'0', NULL); 1297 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (104, '登陆结果', 'system_login_result', 0, '登陆结果', '', '2021-01-18 06:17:11', '', '2022-02-01 16:36:00', b'0', NULL);
@@ -1420,7 +1420,7 @@ CREATE TABLE `system_login_log` ( @@ -1420,7 +1420,7 @@ CREATE TABLE `system_login_log` (
1420 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 1420 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1421 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 1421 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1422 PRIMARY KEY (`id`) USING BTREE 1422 PRIMARY KEY (`id`) USING BTREE
1423 -) ENGINE = InnoDB AUTO_INCREMENT = 3067 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; 1423 +) ENGINE = InnoDB AUTO_INCREMENT = 3081 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
1424 1424
1425 -- ---------------------------- 1425 -- ----------------------------
1426 -- Records of system_login_log 1426 -- Records of system_login_log
@@ -1550,7 +1550,7 @@ CREATE TABLE `system_menu` ( @@ -1550,7 +1550,7 @@ CREATE TABLE `system_menu` (
1550 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 1550 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1551 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 1551 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1552 PRIMARY KEY (`id`) USING BTREE 1552 PRIMARY KEY (`id`) USING BTREE
1553 -) ENGINE = InnoDB AUTO_INCREMENT = 2736 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; 1553 +) ENGINE = InnoDB AUTO_INCREMENT = 2738 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表';
1554 1554
1555 -- ---------------------------- 1555 -- ----------------------------
1556 -- Records of system_menu 1556 -- Records of system_menu
@@ -2337,6 +2337,8 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i @@ -2337,6 +2337,8 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
2337 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2733, '流程表达式创建', 'bpm:process-expression:create', 3, 2, 2731, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-03-09 22:35:08', '', '2024-03-09 22:35:08', b'0'); 2337 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2733, '流程表达式创建', 'bpm:process-expression:create', 3, 2, 2731, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-03-09 22:35:08', '', '2024-03-09 22:35:08', b'0');
2338 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2734, '流程表达式更新', 'bpm:process-expression:update', 3, 3, 2731, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-03-09 22:35:08', '', '2024-03-09 22:35:08', b'0'); 2338 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2734, '流程表达式更新', 'bpm:process-expression:update', 3, 3, 2731, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-03-09 22:35:08', '', '2024-03-09 22:35:08', b'0');
2339 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2735, '流程表达式删除', 'bpm:process-expression:delete', 3, 4, 2731, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-03-09 22:35:08', '', '2024-03-09 22:35:08', b'0'); 2339 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2735, '流程表达式删除', 'bpm:process-expression:delete', 3, 4, 2731, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-03-09 22:35:08', '', '2024-03-09 22:35:08', b'0');
  2340 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2736, '员工业绩', '', 2, 3, 2560, 'performance', 'ep:dish-dot', 'crm/statistics/performance/index', 'CrmStatisticsPerformance', 0, b'1', b'1', b'1', '1', '2024-04-05 13:49:20', '1', '2024-04-05 13:49:20', b'0');
  2341 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2737, '客户画像', '', 2, 4, 2560, 'portrait', 'ep:picture', 'crm/statistics/portrait/index', 'CrmStatisticsPortrait', 0, b'1', b'1', b'1', '1', '2024-04-05 13:57:40', '1', '2024-04-05 13:57:40', b'0');
2340 COMMIT; 2342 COMMIT;
2341 2343
2342 -- ---------------------------- 2344 -- ----------------------------
@@ -2443,6 +2445,7 @@ CREATE TABLE `system_oauth2_access_token` ( @@ -2443,6 +2445,7 @@ CREATE TABLE `system_oauth2_access_token` (
2443 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', 2445 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
2444 `user_id` bigint NOT NULL COMMENT '用户编号', 2446 `user_id` bigint NOT NULL COMMENT '用户编号',
2445 `user_type` tinyint NOT NULL COMMENT '用户类型', 2447 `user_type` tinyint NOT NULL COMMENT '用户类型',
  2448 + `user_info` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户信息',
2446 `access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '访问令牌', 2449 `access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '访问令牌',
2447 `refresh_token` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '刷新令牌', 2450 `refresh_token` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '刷新令牌',
2448 `client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端编号', 2451 `client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端编号',
@@ -2457,7 +2460,7 @@ CREATE TABLE `system_oauth2_access_token` ( @@ -2457,7 +2460,7 @@ CREATE TABLE `system_oauth2_access_token` (
2457 PRIMARY KEY (`id`) USING BTREE, 2460 PRIMARY KEY (`id`) USING BTREE,
2458 INDEX `idx_access_token`(`access_token` ASC) USING BTREE, 2461 INDEX `idx_access_token`(`access_token` ASC) USING BTREE,
2459 INDEX `idx_refresh_token`(`refresh_token` ASC) USING BTREE 2462 INDEX `idx_refresh_token`(`refresh_token` ASC) USING BTREE
2460 -) ENGINE = InnoDB AUTO_INCREMENT = 6372 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; 2463 +) ENGINE = InnoDB AUTO_INCREMENT = 6439 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
2461 2464
2462 -- ---------------------------- 2465 -- ----------------------------
2463 -- Records of system_oauth2_access_token 2466 -- Records of system_oauth2_access_token
@@ -2579,7 +2582,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( @@ -2579,7 +2582,7 @@ CREATE TABLE `system_oauth2_refresh_token` (
2579 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 2582 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2580 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 2583 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2581 PRIMARY KEY (`id`) USING BTREE 2584 PRIMARY KEY (`id`) USING BTREE
2582 -) ENGINE = InnoDB AUTO_INCREMENT = 1442 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; 2585 +) ENGINE = InnoDB AUTO_INCREMENT = 1463 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌';
2583 2586
2584 -- ---------------------------- 2587 -- ----------------------------
2585 -- Records of system_oauth2_refresh_token 2588 -- Records of system_oauth2_refresh_token
@@ -2612,7 +2615,7 @@ CREATE TABLE `system_operate_log` ( @@ -2612,7 +2615,7 @@ CREATE TABLE `system_operate_log` (
2612 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 2615 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2613 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 2616 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2614 PRIMARY KEY (`id`) USING BTREE 2617 PRIMARY KEY (`id`) USING BTREE
2615 -) ENGINE = InnoDB AUTO_INCREMENT = 9019 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录 V2 版本'; 2618 +) ENGINE = InnoDB AUTO_INCREMENT = 9035 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录 V2 版本';
2616 2619
2617 -- ---------------------------- 2620 -- ----------------------------
2618 -- Records of system_operate_log 2621 -- Records of system_operate_log
@@ -2671,7 +2674,7 @@ CREATE TABLE `system_role` ( @@ -2671,7 +2674,7 @@ CREATE TABLE `system_role` (
2671 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 2674 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2672 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 2675 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2673 PRIMARY KEY (`id`) USING BTREE 2676 PRIMARY KEY (`id`) USING BTREE
2674 -) ENGINE = InnoDB AUTO_INCREMENT = 145 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色信息表'; 2677 +) ENGINE = InnoDB AUTO_INCREMENT = 146 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色信息表';
2675 2678
2676 -- ---------------------------- 2679 -- ----------------------------
2677 -- Records of system_role 2680 -- Records of system_role
@@ -5269,7 +5272,7 @@ CREATE TABLE `system_sms_log` ( @@ -5269,7 +5272,7 @@ CREATE TABLE `system_sms_log` (
5269 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 5272 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
5270 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 5273 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
5271 PRIMARY KEY (`id`) USING BTREE 5274 PRIMARY KEY (`id`) USING BTREE
5272 -) ENGINE = InnoDB AUTO_INCREMENT = 947 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; 5275 +) ENGINE = InnoDB AUTO_INCREMENT = 948 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
5273 5276
5274 -- ---------------------------- 5277 -- ----------------------------
5275 -- Records of system_sms_log 5278 -- Records of system_sms_log
@@ -5482,7 +5485,7 @@ CREATE TABLE `system_user_post` ( @@ -5482,7 +5485,7 @@ CREATE TABLE `system_user_post` (
5482 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 5485 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
5483 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 5486 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
5484 PRIMARY KEY (`id`) USING BTREE 5487 PRIMARY KEY (`id`) USING BTREE
5485 -) ENGINE = InnoDB AUTO_INCREMENT = 120 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户岗位表'; 5488 +) ENGINE = InnoDB AUTO_INCREMENT = 125 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户岗位表';
5486 5489
5487 -- ---------------------------- 5490 -- ----------------------------
5488 -- Records of system_user_post 5491 -- Records of system_user_post
@@ -5494,6 +5497,8 @@ INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_t @@ -5494,6 +5497,8 @@ INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_t
5494 INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (116, 117, 2, '1', '2022-07-09 17:40:26', '1', '2022-07-09 17:40:26', b'0', 1); 5497 INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (116, 117, 2, '1', '2022-07-09 17:40:26', '1', '2022-07-09 17:40:26', b'0', 1);
5495 INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (117, 118, 1, '1', '2022-07-09 17:44:44', '1', '2022-07-09 17:44:44', b'0', 1); 5498 INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (117, 118, 1, '1', '2022-07-09 17:44:44', '1', '2022-07-09 17:44:44', b'0', 1);
5496 INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (119, 114, 5, '1', '2024-03-24 20:45:51', '1', '2024-03-24 20:45:51', b'0', 1); 5499 INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (119, 114, 5, '1', '2024-03-24 20:45:51', '1', '2024-03-24 20:45:51', b'0', 1);
  5500 +INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (123, 115, 1, '1', '2024-04-04 09:37:14', '1', '2024-04-04 09:37:14', b'0', 1);
  5501 +INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (124, 115, 2, '1', '2024-04-04 09:37:14', '1', '2024-04-04 09:37:14', b'0', 1);
5497 COMMIT; 5502 COMMIT;
5498 5503
5499 -- ---------------------------- 5504 -- ----------------------------
@@ -5577,13 +5582,13 @@ CREATE TABLE `system_users` ( @@ -5577,13 +5582,13 @@ CREATE TABLE `system_users` (
5577 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 5582 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
5578 PRIMARY KEY (`id`) USING BTREE, 5583 PRIMARY KEY (`id`) USING BTREE,
5579 UNIQUE INDEX `idx_username`(`username` ASC, `update_time` ASC, `tenant_id` ASC) USING BTREE 5584 UNIQUE INDEX `idx_username`(`username` ASC, `update_time` ASC, `tenant_id` ASC) USING BTREE
5580 -) ENGINE = InnoDB AUTO_INCREMENT = 130 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户信息表'; 5585 +) ENGINE = InnoDB AUTO_INCREMENT = 131 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户信息表';
5581 5586
5582 -- ---------------------------- 5587 -- ----------------------------
5583 -- Records of system_users 5588 -- Records of system_users
5584 -- ---------------------------- 5589 -- ----------------------------
5585 BEGIN; 5590 BEGIN;
5586 -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '18818260277', 2, 'http://test.yudao.iocoder.cn/96c787a2ce88bf6d0ce3cd8b6cf5314e80e7703cd41bf4af8cd2e2909dbd6b6d.png', 0, '127.0.0.1', '2024-04-03 20:01:18', 'admin', '2021-01-05 17:03:47', NULL, '2024-04-03 20:01:18', b'0', 1); 5591 +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '18818260277', 2, 'http://test.yudao.iocoder.cn/96c787a2ce88bf6d0ce3cd8b6cf5314e80e7703cd41bf4af8cd2e2909dbd6b6d.png', 0, '0:0:0:0:0:0:0:1', '2024-04-07 03:16:30', 'admin', '2021-01-05 17:03:47', NULL, '2024-04-07 03:16:30', b'0', 1);
5587 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1); 5592 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1);
5588 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '0:0:0:0:0:0:0:1', '2024-03-18 21:09:04', '', '2021-01-13 23:50:35', NULL, '2024-03-18 21:09:04', b'0', 1); 5593 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '0:0:0:0:0:0:0:1', '2024-03-18 21:09:04', '', '2021-01-13 23:50:35', NULL, '2024-03-18 21:09:04', b'0', 1);
5589 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$04$KhExCYl7lx6eWWZYKsibKOZ8IBJRyuNuCcEOLQ11RYhJKgHmlSwK.', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-26 07:11:35', '', '2021-01-21 02:13:53', NULL, '2024-03-26 07:11:35', b'0', 1); 5594 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$04$KhExCYl7lx6eWWZYKsibKOZ8IBJRyuNuCcEOLQ11RYhJKgHmlSwK.', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-26 07:11:35', '', '2021-01-21 02:13:53', NULL, '2024-03-26 07:11:35', b'0', 1);
@@ -5595,10 +5600,10 @@ INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, @@ -5595,10 +5600,10 @@ INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`,
5595 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (112, 'newobject', '$2a$04$dB0z8Q819fJWz0hbaLe6B.VfHCjYgWx6LFfET5lyz3JwcqlyCkQ4C', '新对象', NULL, 100, '[]', '', '15601691235', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-16 23:11:38', '1', '2022-02-23 19:08:03', NULL, '2024-03-16 23:11:38', b'0', 1); 5600 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (112, 'newobject', '$2a$04$dB0z8Q819fJWz0hbaLe6B.VfHCjYgWx6LFfET5lyz3JwcqlyCkQ4C', '新对象', NULL, 100, '[]', '', '15601691235', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-16 23:11:38', '1', '2022-02-23 19:08:03', NULL, '2024-03-16 23:11:38', b'0', 1);
5596 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (113, 'aoteman', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '芋道', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '127.0.0.1', '2022-03-19 18:38:51', '1', '2022-03-07 21:37:58', NULL, '2022-03-19 18:38:51', b'0', 122); 5601 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (113, 'aoteman', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '芋道', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '127.0.0.1', '2022-03-19 18:38:51', '1', '2022-03-07 21:37:58', NULL, '2022-03-19 18:38:51', b'0', 122);
5597 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (114, 'hrmgr', '$2a$10$TR4eybBioGRhBmDBWkqWLO6NIh3mzYa8KBKDDB5woiGYFVlRAi.fu', 'hr 小姐姐', NULL, NULL, '[5]', '', '15601691236', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-24 22:21:05', '1', '2022-03-19 21:50:58', NULL, '2024-03-24 22:21:05', b'0', 1); 5602 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (114, 'hrmgr', '$2a$10$TR4eybBioGRhBmDBWkqWLO6NIh3mzYa8KBKDDB5woiGYFVlRAi.fu', 'hr 小姐姐', NULL, NULL, '[5]', '', '15601691236', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-24 22:21:05', '1', '2022-03-19 21:50:58', NULL, '2024-03-24 22:21:05', b'0', 1);
5598 -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (115, 'aotemane', '$2a$10$/WCwGHu1eq0wOVDd/u8HweJ0gJCHyLS6T7ndCqI8UXZAQom1etk2e', '1', '11', 101, '[]', '', '15601691238', 1, '', 0, '', NULL, '1', '2022-04-30 02:55:43', '1', '2024-03-15 19:48:22', b'0', 1); 5603 +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (115, 'aotemane', '$2a$04$GcyP0Vyzb2F2Yni5PuIK9ueGxM0tkZGMtDwVRwrNbtMvorzbpNsV2', '阿呆', '11222', 102, '[1,2]', '7648@qq.com', '15601691229', 2, '', 0, '', NULL, '1', '2022-04-30 02:55:43', '1', '2024-04-04 09:37:14', b'0', 1);
5599 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (116, '15601691302', '$2a$10$L5C4S0U6adBWMvFv1Wwl4.DI/NwYS3WIfLj5Q.Naqr5II8CmqsDZ6', '小豆', NULL, NULL, NULL, '', '', 0, '', 0, '', NULL, '1', '2022-05-17 10:07:10', '1', '2022-05-17 10:07:10', b'0', 124); 5604 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (116, '15601691302', '$2a$10$L5C4S0U6adBWMvFv1Wwl4.DI/NwYS3WIfLj5Q.Naqr5II8CmqsDZ6', '小豆', NULL, NULL, NULL, '', '', 0, '', 0, '', NULL, '1', '2022-05-17 10:07:10', '1', '2022-05-17 10:07:10', b'0', 124);
5600 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (117, 'admin123', '$2a$10$WI8Gg/lpZQIrOEZMHqka7OdFaD4Nx.B/qY8ZGTTUKrOJwaHFqibaC', '测试号', '1111', 100, '[2]', '', '15601691234', 1, '', 0, '', NULL, '1', '2022-07-09 17:40:26', '1', '2022-07-09 17:40:26', b'0', 1); 5605 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (117, 'admin123', '$2a$10$WI8Gg/lpZQIrOEZMHqka7OdFaD4Nx.B/qY8ZGTTUKrOJwaHFqibaC', '测试号', '1111', 100, '[2]', '', '15601691234', 1, '', 0, '', NULL, '1', '2022-07-09 17:40:26', '1', '2022-07-09 17:40:26', b'0', 1);
5601 -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (118, 'goudan', '$2a$04$OB1SuphCdiLVRpiYRKeqH.8NYS7UIp5vmIv1W7U4w6toiFeOAATVK', '狗蛋', NULL, 103, '[1]', '', '15601691239', 2, '', 0, '0:0:0:0:0:0:0:1', '2024-03-17 09:10:27', '1', '2022-07-09 17:44:43', NULL, '2024-03-17 09:10:27', b'0', 1); 5606 +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (118, 'goudan', '$2a$04$OB1SuphCdiLVRpiYRKeqH.8NYS7UIp5vmIv1W7U4w6toiFeOAATVK', '狗蛋', NULL, 103, '[1]', '', '15601691239', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-03-17 09:10:27', '1', '2022-07-09 17:44:43', '1', '2024-04-04 09:48:05', b'0', 1);
5602 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (126, 'tudou123', '$2a$04$lecJZ/CqgknEp7mDV2d4ou0beyj1GbM3.nVEZe//8WgQpR.JBgnAu', '土豆', NULL, NULL, NULL, '', '', 0, '', 0, '', NULL, '1', '2023-12-02 23:35:05', '1', '2023-12-02 23:35:05', b'0', 151); 5607 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (126, 'tudou123', '$2a$04$lecJZ/CqgknEp7mDV2d4ou0beyj1GbM3.nVEZe//8WgQpR.JBgnAu', '土豆', NULL, NULL, NULL, '', '', 0, '', 0, '', NULL, '1', '2023-12-02 23:35:05', '1', '2023-12-02 23:35:05', b'0', 151);
5603 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (127, 'admin2024', '$2a$04$cHdZ7N6AUKysa2XTUG/J/egYtAzdwtpnNpcMVHDrupt1dyn4teOku', '土豆', NULL, NULL, NULL, '', '', 0, '', 0, '0:0:0:0:0:0:0:1', '2023-12-30 11:43:28', '1', '2023-12-30 11:43:17', NULL, '2023-12-30 11:43:28', b'0', 152); 5608 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (127, 'admin2024', '$2a$04$cHdZ7N6AUKysa2XTUG/J/egYtAzdwtpnNpcMVHDrupt1dyn4teOku', '土豆', NULL, NULL, NULL, '', '', 0, '', 0, '0:0:0:0:0:0:0:1', '2023-12-30 11:43:28', '1', '2023-12-30 11:43:17', NULL, '2023-12-30 11:43:28', b'0', 152);
5604 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (128, 'xiaoming', '$2a$04$BRinw4an9PBGvx6K7GLNre6rWU0.1HMYHkQCN6Oir74zNFKkNKRzm', 'xiaoming', NULL, NULL, NULL, '', '15601691301', 0, '', 0, '0:0:0:0:0:0:0:1', '2024-02-29 23:48:33', '1', '2024-02-27 21:58:25', NULL, '2024-02-29 23:48:33', b'0', 153); 5609 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (128, 'xiaoming', '$2a$04$BRinw4an9PBGvx6K7GLNre6rWU0.1HMYHkQCN6Oir74zNFKkNKRzm', 'xiaoming', NULL, NULL, NULL, '', '15601691301', 0, '', 0, '0:0:0:0:0:0:0:1', '2024-02-29 23:48:33', '1', '2024-02-27 21:58:25', NULL, '2024-02-29 23:48:33', b'0', 153);
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java
@@ -17,6 +17,9 @@ import java.util.Map; @@ -17,6 +17,9 @@ import java.util.Map;
17 @Data 17 @Data
18 public class LoginUser { 18 public class LoginUser {
19 19
  20 + public static final String INFO_KEY_NICKNAME = "nickname";
  21 + public static final String INFO_KEY_DEPT_ID = "deptId";
  22 +
20 /** 23 /**
21 * 用户编号 24 * 用户编号
22 */ 25 */
@@ -28,6 +31,10 @@ public class LoginUser { @@ -28,6 +31,10 @@ public class LoginUser {
28 */ 31 */
29 private Integer userType; 32 private Integer userType;
30 /** 33 /**
  34 + * 额外的用户信息
  35 + */
  36 + private Map<String, String> info;
  37 + /**
31 * 租户编号 38 * 租户编号
32 */ 39 */
33 private Long tenantId; 40 private Long tenantId;
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java
@@ -83,6 +83,7 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter { @@ -83,6 +83,7 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
83 } 83 }
84 // 构建登录用户 84 // 构建登录用户
85 return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType()) 85 return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType())
  86 + .setInfo(accessToken.getUserInfo()) // 额外的用户信息
86 .setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes()); 87 .setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes());
87 } catch (ServiceException serviceException) { 88 } catch (ServiceException serviceException) {
88 // 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可 89 // 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
1 package cn.iocoder.yudao.framework.security.core.util; 1 package cn.iocoder.yudao.framework.security.core.util;
2 2
  3 +import cn.hutool.core.map.MapUtil;
3 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
4 import cn.iocoder.yudao.framework.security.core.LoginUser; 5 import cn.iocoder.yudao.framework.security.core.LoginUser;
5 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; 6 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
@@ -90,6 +91,28 @@ public class SecurityFrameworkUtils { @@ -90,6 +91,28 @@ public class SecurityFrameworkUtils {
90 } 91 }
91 92
92 /** 93 /**
  94 + * 获得当前用户的昵称,从上下文中
  95 + *
  96 + * @return 昵称
  97 + */
  98 + @Nullable
  99 + public static String getLoginUserNickname() {
  100 + LoginUser loginUser = getLoginUser();
  101 + return loginUser != null ? MapUtil.getStr(loginUser.getInfo(), LoginUser.INFO_KEY_NICKNAME) : null;
  102 + }
  103 +
  104 + /**
  105 + * 获得当前用户的部门编号,从上下文中
  106 + *
  107 + * @return 部门编号
  108 + */
  109 + @Nullable
  110 + public static Long getLoginUserDeptId() {
  111 + LoginUser loginUser = getLoginUser();
  112 + return loginUser != null ? MapUtil.getLong(loginUser.getInfo(), LoginUser.INFO_KEY_DEPT_ID) : null;
  113 + }
  114 +
  115 + /**
93 * 设置当前用户 116 * 设置当前用户
94 * 117 *
95 * @param loginUser 登录用户 118 * @param loginUser 登录用户
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/dto/OAuth2AccessTokenCheckRespDTO.java
@@ -4,6 +4,7 @@ import lombok.Data; @@ -4,6 +4,7 @@ import lombok.Data;
4 4
5 import java.io.Serializable; 5 import java.io.Serializable;
6 import java.util.List; 6 import java.util.List;
  7 +import java.util.Map;
7 8
8 /** 9 /**
9 * OAuth2.0 访问令牌的校验 Response DTO 10 * OAuth2.0 访问令牌的校验 Response DTO
@@ -22,6 +23,10 @@ public class OAuth2AccessTokenCheckRespDTO implements Serializable { @@ -22,6 +23,10 @@ public class OAuth2AccessTokenCheckRespDTO implements Serializable {
22 */ 23 */
23 private Integer userType; 24 private Integer userType;
24 /** 25 /**
  26 + * 用户信息
  27 + */
  28 + private Map<String, String> userInfo;
  29 + /**
25 * 租户编号 30 * 租户编号
26 */ 31 */
27 private Long tenantId; 32 private Long tenantId;
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oauth2/OAuth2AccessTokenDO.java
@@ -12,6 +12,7 @@ import lombok.EqualsAndHashCode; @@ -12,6 +12,7 @@ import lombok.EqualsAndHashCode;
12 12
13 import java.time.LocalDateTime; 13 import java.time.LocalDateTime;
14 import java.util.List; 14 import java.util.List;
  15 +import java.util.Map;
15 16
16 /** 17 /**
17 * OAuth2 访问令牌 DO 18 * OAuth2 访问令牌 DO
@@ -51,6 +52,11 @@ public class OAuth2AccessTokenDO extends TenantBaseDO { @@ -51,6 +52,11 @@ public class OAuth2AccessTokenDO extends TenantBaseDO {
51 */ 52 */
52 private Integer userType; 53 private Integer userType;
53 /** 54 /**
  55 + * 用户信息
  56 + */
  57 + @TableField(typeHandler = JacksonTypeHandler.class)
  58 + private Map<String, String> userInfo;
  59 + /**
54 * 客户端编号 60 * 客户端编号
55 * 61 *
56 * 关联 {@link OAuth2ClientDO#getId()} 62 * 关联 {@link OAuth2ClientDO#getId()}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/oauth2/OAuth2TokenServiceImpl.java
1 package cn.iocoder.yudao.module.system.service.oauth2; 1 package cn.iocoder.yudao.module.system.service.oauth2;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.map.MapUtil;
4 import cn.hutool.core.util.IdUtil; 5 import cn.hutool.core.util.IdUtil;
5 import cn.hutool.core.util.ObjectUtil; 6 import cn.hutool.core.util.ObjectUtil;
  7 +import cn.hutool.core.util.StrUtil;
  8 +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
6 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; 9 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
7 import cn.iocoder.yudao.framework.common.pojo.PageResult; 10 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 import cn.iocoder.yudao.framework.common.util.date.DateUtils; 11 import cn.iocoder.yudao.framework.common.util.date.DateUtils;
  12 +import cn.iocoder.yudao.framework.security.core.LoginUser;
9 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 13 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
10 import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.token.OAuth2AccessTokenPageReqVO; 14 import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.token.OAuth2AccessTokenPageReqVO;
11 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; 15 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
12 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO; 16 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO;
13 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2RefreshTokenDO; 17 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2RefreshTokenDO;
  18 +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
14 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2AccessTokenMapper; 19 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2AccessTokenMapper;
15 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2RefreshTokenMapper; 20 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2RefreshTokenMapper;
16 import cn.iocoder.yudao.module.system.dal.redis.oauth2.OAuth2AccessTokenRedisDAO; 21 import cn.iocoder.yudao.module.system.dal.redis.oauth2.OAuth2AccessTokenRedisDAO;
  22 +import cn.iocoder.yudao.module.system.service.user.AdminUserService;
  23 +import jakarta.annotation.Resource;
  24 +import org.springframework.context.annotation.Lazy;
17 import org.springframework.stereotype.Service; 25 import org.springframework.stereotype.Service;
18 import org.springframework.transaction.annotation.Transactional; 26 import org.springframework.transaction.annotation.Transactional;
19 27
20 -import jakarta.annotation.Resource;  
21 import java.time.LocalDateTime; 28 import java.time.LocalDateTime;
  29 +import java.util.Collections;
22 import java.util.List; 30 import java.util.List;
  31 +import java.util.Map;
23 32
24 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; 33 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
25 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; 34 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@@ -42,6 +51,9 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService { @@ -42,6 +51,9 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
42 51
43 @Resource 52 @Resource
44 private OAuth2ClientService oauth2ClientService; 53 private OAuth2ClientService oauth2ClientService;
  54 + @Resource
  55 + @Lazy // 懒加载,避免循环依赖
  56 + private AdminUserService adminUserService;
45 57
46 @Override 58 @Override
47 @Transactional 59 @Transactional
@@ -135,6 +147,7 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService { @@ -135,6 +147,7 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
135 private OAuth2AccessTokenDO createOAuth2AccessToken(OAuth2RefreshTokenDO refreshTokenDO, OAuth2ClientDO clientDO) { 147 private OAuth2AccessTokenDO createOAuth2AccessToken(OAuth2RefreshTokenDO refreshTokenDO, OAuth2ClientDO clientDO) {
136 OAuth2AccessTokenDO accessTokenDO = new OAuth2AccessTokenDO().setAccessToken(generateAccessToken()) 148 OAuth2AccessTokenDO accessTokenDO = new OAuth2AccessTokenDO().setAccessToken(generateAccessToken())
137 .setUserId(refreshTokenDO.getUserId()).setUserType(refreshTokenDO.getUserType()) 149 .setUserId(refreshTokenDO.getUserId()).setUserType(refreshTokenDO.getUserType())
  150 + .setUserInfo(buildUserInfo(refreshTokenDO.getUserId(), refreshTokenDO.getUserType()))
138 .setClientId(clientDO.getClientId()).setScopes(refreshTokenDO.getScopes()) 151 .setClientId(clientDO.getClientId()).setScopes(refreshTokenDO.getScopes())
139 .setRefreshToken(refreshTokenDO.getRefreshToken()) 152 .setRefreshToken(refreshTokenDO.getRefreshToken())
140 .setExpiresTime(LocalDateTime.now().plusSeconds(clientDO.getAccessTokenValiditySeconds())); 153 .setExpiresTime(LocalDateTime.now().plusSeconds(clientDO.getAccessTokenValiditySeconds()));
@@ -154,6 +167,25 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService { @@ -154,6 +167,25 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
154 return refreshToken; 167 return refreshToken;
155 } 168 }
156 169
  170 + /**
  171 + * 加载用户信息,方便 {@link cn.iocoder.yudao.framework.security.core.LoginUser} 获取到昵称、部门等信息
  172 + *
  173 + * @param userId 用户编号
  174 + * @param userType 用户类型
  175 + * @return 用户信息
  176 + */
  177 + private Map<String, String> buildUserInfo(Long userId, Integer userType) {
  178 + if (userType.equals(UserTypeEnum.ADMIN.getValue())) {
  179 + AdminUserDO user = adminUserService.getUser(userId);
  180 + return MapUtil.builder(LoginUser.INFO_KEY_NICKNAME, user.getNickname())
  181 + .put(LoginUser.INFO_KEY_DEPT_ID, StrUtil.toStringOrNull(user.getDeptId())).build();
  182 + } else if (userType.equals(UserTypeEnum.MEMBER.getValue())) {
  183 + // 注意:目前 Member 暂时不读取,可以按需实现
  184 + return Collections.emptyMap();
  185 + }
  186 + return null;
  187 + }
  188 +
157 private static String generateAccessToken() { 189 private static String generateAccessToken() {
158 return IdUtil.fastSimpleUUID(); 190 return IdUtil.fastSimpleUUID();
159 } 191 }
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/oauth2/OAuth2TokenServiceImplTest.java
1 package cn.iocoder.yudao.module.system.service.oauth2; 1 package cn.iocoder.yudao.module.system.service.oauth2;
2 2
3 import cn.hutool.core.date.LocalDateTimeUtil; 3 import cn.hutool.core.date.LocalDateTimeUtil;
4 -import cn.hutool.core.util.RandomUtil;  
5 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
6 import cn.iocoder.yudao.framework.common.exception.ErrorCode; 5 import cn.iocoder.yudao.framework.common.exception.ErrorCode;
7 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -12,15 +11,17 @@ import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.token.OAuth2Acc @@ -12,15 +11,17 @@ import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.token.OAuth2Acc
12 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; 11 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
13 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO; 12 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO;
14 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2RefreshTokenDO; 13 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2RefreshTokenDO;
  14 +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
15 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2AccessTokenMapper; 15 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2AccessTokenMapper;
16 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2RefreshTokenMapper; 16 import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2RefreshTokenMapper;
17 import cn.iocoder.yudao.module.system.dal.redis.oauth2.OAuth2AccessTokenRedisDAO; 17 import cn.iocoder.yudao.module.system.dal.redis.oauth2.OAuth2AccessTokenRedisDAO;
  18 +import cn.iocoder.yudao.module.system.service.user.AdminUserService;
  19 +import jakarta.annotation.Resource;
18 import org.assertj.core.util.Lists; 20 import org.assertj.core.util.Lists;
19 import org.junit.jupiter.api.Test; 21 import org.junit.jupiter.api.Test;
20 import org.springframework.boot.test.mock.mockito.MockBean; 22 import org.springframework.boot.test.mock.mockito.MockBean;
21 import org.springframework.context.annotation.Import; 23 import org.springframework.context.annotation.Import;
22 24
23 -import jakarta.annotation.Resource;  
24 import java.time.LocalDateTime; 25 import java.time.LocalDateTime;
25 import java.util.List; 26 import java.util.List;
26 27
@@ -53,19 +54,24 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest { @@ -53,19 +54,24 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
53 54
54 @MockBean 55 @MockBean
55 private OAuth2ClientService oauth2ClientService; 56 private OAuth2ClientService oauth2ClientService;
  57 + @MockBean
  58 + private AdminUserService adminUserService;
56 59
57 @Test 60 @Test
58 public void testCreateAccessToken() { 61 public void testCreateAccessToken() {
59 TenantContextHolder.setTenantId(0L); 62 TenantContextHolder.setTenantId(0L);
60 // 准备参数 63 // 准备参数
61 Long userId = randomLongId(); 64 Long userId = randomLongId();
62 - Integer userType = RandomUtil.randomEle(UserTypeEnum.values()).getValue(); 65 + Integer userType = UserTypeEnum.ADMIN.getValue();
63 String clientId = randomString(); 66 String clientId = randomString();
64 List<String> scopes = Lists.newArrayList("read", "write"); 67 List<String> scopes = Lists.newArrayList("read", "write");
65 // mock 方法 68 // mock 方法
66 OAuth2ClientDO clientDO = randomPojo(OAuth2ClientDO.class).setClientId(clientId) 69 OAuth2ClientDO clientDO = randomPojo(OAuth2ClientDO.class).setClientId(clientId)
67 .setAccessTokenValiditySeconds(30).setRefreshTokenValiditySeconds(60); 70 .setAccessTokenValiditySeconds(30).setRefreshTokenValiditySeconds(60);
68 when(oauth2ClientService.validOAuthClientFromCache(eq(clientId))).thenReturn(clientDO); 71 when(oauth2ClientService.validOAuthClientFromCache(eq(clientId))).thenReturn(clientDO);
  72 + // mock 数据(用户)
  73 + AdminUserDO user = randomPojo(AdminUserDO.class);
  74 + when(adminUserService.getUser(userId)).thenReturn(user);
69 75
70 // 调用 76 // 调用
71 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, userType, clientId, scopes); 77 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, userType, clientId, scopes);
@@ -74,6 +80,9 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest { @@ -74,6 +80,9 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
74 assertPojoEquals(accessTokenDO, dbAccessTokenDO, "createTime", "updateTime", "deleted"); 80 assertPojoEquals(accessTokenDO, dbAccessTokenDO, "createTime", "updateTime", "deleted");
75 assertEquals(userId, accessTokenDO.getUserId()); 81 assertEquals(userId, accessTokenDO.getUserId());
76 assertEquals(userType, accessTokenDO.getUserType()); 82 assertEquals(userType, accessTokenDO.getUserType());
  83 + assertEquals(2, accessTokenDO.getUserInfo().size());
  84 + assertEquals(user.getNickname(), accessTokenDO.getUserInfo().get("nickname"));
  85 + assertEquals(user.getDeptId().toString(), accessTokenDO.getUserInfo().get("deptId"));
77 assertEquals(clientId, accessTokenDO.getClientId()); 86 assertEquals(clientId, accessTokenDO.getClientId());
78 assertEquals(scopes, accessTokenDO.getScopes()); 87 assertEquals(scopes, accessTokenDO.getScopes());
79 assertFalse(DateUtils.isExpired(accessTokenDO.getExpiresTime())); 88 assertFalse(DateUtils.isExpired(accessTokenDO.getExpiresTime()));
@@ -149,12 +158,17 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest { @@ -149,12 +158,17 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
149 // mock 数据(访问令牌) 158 // mock 数据(访问令牌)
150 OAuth2RefreshTokenDO refreshTokenDO = randomPojo(OAuth2RefreshTokenDO.class) 159 OAuth2RefreshTokenDO refreshTokenDO = randomPojo(OAuth2RefreshTokenDO.class)
151 .setRefreshToken(refreshToken).setClientId(clientId) 160 .setRefreshToken(refreshToken).setClientId(clientId)
152 - .setExpiresTime(LocalDateTime.now().plusDays(1)); 161 + .setExpiresTime(LocalDateTime.now().plusDays(1))
  162 + .setUserType(UserTypeEnum.ADMIN.getValue());
153 oauth2RefreshTokenMapper.insert(refreshTokenDO); 163 oauth2RefreshTokenMapper.insert(refreshTokenDO);
154 // mock 数据(访问令牌) 164 // mock 数据(访问令牌)
155 - OAuth2AccessTokenDO accessTokenDO = randomPojo(OAuth2AccessTokenDO.class).setRefreshToken(refreshToken); 165 + OAuth2AccessTokenDO accessTokenDO = randomPojo(OAuth2AccessTokenDO.class).setRefreshToken(refreshToken)
  166 + .setUserType(refreshTokenDO.getUserType());
156 oauth2AccessTokenMapper.insert(accessTokenDO); 167 oauth2AccessTokenMapper.insert(accessTokenDO);
157 oauth2AccessTokenRedisDAO.set(accessTokenDO); 168 oauth2AccessTokenRedisDAO.set(accessTokenDO);
  169 + // mock 数据(用户)
  170 + AdminUserDO user = randomPojo(AdminUserDO.class);
  171 + when(adminUserService.getUser(refreshTokenDO.getUserId())).thenReturn(user);
158 172
159 // 调用 173 // 调用
160 OAuth2AccessTokenDO newAccessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, clientId); 174 OAuth2AccessTokenDO newAccessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, clientId);
yudao-module-system/yudao-module-system-biz/src/test/resources/sql/create_tables.sql
@@ -490,6 +490,7 @@ CREATE TABLE IF NOT EXISTS &quot;system_oauth2_access_token&quot; ( @@ -490,6 +490,7 @@ CREATE TABLE IF NOT EXISTS &quot;system_oauth2_access_token&quot; (
490 "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, 490 "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
491 "user_id" bigint NOT NULL, 491 "user_id" bigint NOT NULL,
492 "user_type" tinyint NOT NULL, 492 "user_type" tinyint NOT NULL,
  493 + "user_info" varchar NOT NULL,
493 "access_token" varchar NOT NULL, 494 "access_token" varchar NOT NULL,
494 "refresh_token" varchar NOT NULL, 495 "refresh_token" varchar NOT NULL,
495 "client_id" varchar NOT NULL, 496 "client_id" varchar NOT NULL,