add
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
Target Server Version : 50742
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 04/07/2023 17:59:38
|
||||
Date: 05/07/2023 17:30:52
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@ -32,12 +32,15 @@ CREATE TABLE `generator_table` (
|
||||
`function_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能名',
|
||||
`author` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能作者',
|
||||
`parent_menu_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '父级菜单ID',
|
||||
`doc_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文档开关',
|
||||
`excel_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Excel导出开关',
|
||||
PRIMARY KEY (`table_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1676167700458000387 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1676523729943375874 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of generator_table
|
||||
-- ----------------------------
|
||||
INSERT INTO `generator_table` VALUES (1676523729943375873, 'test_user', '用户信息表', 'TestUser', 'com.qiaoba.module.generator', 'generator', 'user', '用户信息', 'Ailanyin', NULL, NULL, NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for generator_table_column
|
||||
@ -62,11 +65,26 @@ CREATE TABLE `generator_table_column` (
|
||||
`dict_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型',
|
||||
`sort` int(11) NULL DEFAULT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`column_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1676167700831293442 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1676523730350223363 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of generator_table_column
|
||||
-- ----------------------------
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730039844866, '1676523729943375873', 'user_id', '用户ID123', 'bigint(200)', 'Long', 'userId', '1', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 1);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730065010689, '1676523729943375873', 'dept_id', '部门ID', 'bigint(20)', 'Long', 'deptId', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 2);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730085982209, '1676523729943375873', 'username', '用户账号', 'varchar(30)', 'String', 'username', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 3);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730102759425, '1676523729943375873', 'nickname', '用户昵称', 'varchar(30)', 'String', 'nickname', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 4);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730119536642, '1676523729943375873', 'email', '用户邮箱', 'varchar(50)', 'String', 'email', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 5);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730140508162, '1676523729943375873', 'phone', '手机号码', 'varchar(11)', 'String', 'phone', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 6);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730165673986, '1676523729943375873', 'gender', '用户性别(0男 1女 2未知)', 'char(1)', 'String', 'gender', '0', NULL, '1', '1', '1', NULL, 'EQ', 'select', '', 7);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730199228418, '1676523729943375873', 'avatar', '头像地址', 'varchar(100)', 'String', 'avatar', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 8);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730241171457, '1676523729943375873', 'password', '密码', 'varchar(100)', 'String', 'password', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 9);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730274725889, '1676523729943375873', 'status', '帐号状态(1正常 0停用)', 'char(1)', 'String', 'status', '0', NULL, '1', '1', '1', NULL, 'EQ', 'radio', '', 10);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730287308801, '1676523729943375873', 'create_user', '创建者', 'varchar(64)', 'String', 'createUser', '0', NULL, NULL, NULL, NULL, NULL, 'EQ', 'input', '', 11);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730295697410, '1676523729943375873', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', NULL, NULL, NULL, NULL, NULL, 'EQ', 'datetime', '', 12);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730312474626, '1676523729943375873', 'update_user', '更新者', 'varchar(64)', 'String', 'updateUser', '0', NULL, NULL, NULL, NULL, NULL, 'EQ', 'input', '', 13);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730333446145, '1676523729943375873', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', NULL, NULL, NULL, NULL, NULL, 'EQ', 'datetime', '', 14);
|
||||
INSERT INTO `generator_table_column` VALUES (1676523730350223362, '1676523729943375873', 'tenant_id', '租户ID', 'bigint(20)', 'Long', 'tenantId', '0', NULL, NULL, NULL, NULL, NULL, 'EQ', 'input', '', 15);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_config
|
||||
@ -93,7 +111,7 @@ CREATE TABLE `sys_config` (
|
||||
INSERT INTO `sys_config` VALUES (1661598740507910145, 'Token有效期', 'sys.token.expireTime', '96', 'Y', 'admin', '2023-05-25 13:22:50', 'admin', '2023-05-25 15:02:42', '单位:小时,仅支持正整数', 1);
|
||||
INSERT INTO `sys_config` VALUES (1661602101802164225, '账号黑名单开关', 'sys.account.blacklistOnOff', 'true', 'Y', 'admin', '2023-05-25 13:22:31', 'admin', '2023-05-25 13:57:14', '(true开启,false关闭)', 1);
|
||||
INSERT INTO `sys_config` VALUES (1661603407233077249, '账号注册开关', 'sys.account.registerUser', 'false', 'Y', 'admin', '2023-05-25 13:21:38', 'admin', '2023-05-25 15:07:00', '(true开启,false关闭)', 1);
|
||||
INSERT INTO `sys_config` VALUES (1661603968779079681, '登录验证码开关', 'sys.account.captchaOnOff', 'false', 'Y', 'admin', '2023-05-25 13:23:52', 'admin', '2023-06-09 14:40:17', '(true开启,false关闭)', 1);
|
||||
INSERT INTO `sys_config` VALUES (1661603968779079681, '登录验证码开关', 'sys.account.captchaOnOff', 'false', 'Y', 'admin', '2023-05-25 13:23:52', 'admin', '2023-07-05 11:02:12', '(true开启,false关闭)', 1);
|
||||
INSERT INTO `sys_config` VALUES (1661603968779079682, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-light', 'Y', 'admin', '2022-08-15 18:01:28', 'admin', '2023-05-25 13:26:27', '深色主题theme-dark,浅色主题theme-light', 1);
|
||||
INSERT INTO `sys_config` VALUES (1661603968779079683, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', '2022-08-15 18:01:28', '', NULL, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow', 1);
|
||||
INSERT INTO `sys_config` VALUES (1668426274817994753, '登陆最大错误次数', 'sys.account.loginErrorMaxCount', '10', 'Y', 'admin', '2023-06-13 09:13:16', 'admin', '2023-06-13 09:35:59', '超过次数, 就会被拉黑', 1);
|
||||
@ -269,6 +287,21 @@ INSERT INTO `sys_login_log` VALUES (1675866008431042562, 'c602923e58b24a72be492b
|
||||
INSERT INTO `sys_login_log` VALUES (1676030485081948161, '553ddb8b511340d0bae3512d20373ea0', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-04 08:49:41', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676033199325138946, '322a4eb1deae4f8d8259365513ae85b3', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-07-04 09:00:29', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676127576290619394, '3e553aaf45fd402c8bb8c942b56b1879', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-04 15:15:30', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676169998718554113, 'f1b44f041ea74ab3ad5a3b992960763d', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-04 18:04:04', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676407137817337858, '2d4544efe0784ff78adda21a7871a200', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 09:46:22', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676411525273231361, '0d2e414ace56410da9a11f05e038ce8d', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-07-05 10:03:48', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676414234550403073, '2c543d659d7b41af81e7f57d2d976fe4', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 10:14:34', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676417431067238401, 'd33f3ea6f76f4594bee6e75177e0bbb5', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 10:27:16', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676426053985845249, '5f324dd28d0c4d928c76e98bf1adecf6', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 11:01:32', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676426168481955842, 'e01e3442c0bd493a89b4c0acf0771d29', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 11:02:00', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676426234663878657, '03ccbaa09a77465eacbf5881c36b0bd8', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 11:02:15', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676444341532958721, '599ec4d4ec284239a2c15fa0023e6b7b', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-07-05 12:14:12', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676482773508476929, 'c285b175b69547c9824053443cf3a708', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 14:46:55', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676483066891653122, 'eec284c56a4045df86a7eb03c6d602a5', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 14:48:05', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676490398224699393, '03aec0103fa4456cb5a51390b5951ad1', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-07-05 15:17:13', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676504142338166786, '60cfd50dca384997a1fc6cf075b15bba', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 16:11:50', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676511047492132865, 'd3edbc1426b14af0a5e8f6c4a3b34614', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 16:39:16', '', NULL, '', NULL, NULL, 1);
|
||||
INSERT INTO `sys_login_log` VALUES (1676523812147539969, '874a9ba3d7e647fc94477fea892d7a0a', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-05 17:30:00', '', NULL, '', NULL, NULL, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_menu
|
||||
@ -302,7 +335,7 @@ CREATE TABLE `sys_menu` (
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 1, 'system', NULL, '', 0, 0, 'M', '1', '', 'system', 'admin', '2023-04-23 14:35:29', '', NULL, '系统管理目录', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 2, 'monitor', NULL, '', 0, 0, 'M', '1', '', 'monitor', 'admin', '2023-05-27 22:25:03', '', NULL, '系统监控目录', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3, '附加工具', 0, 4, 'tool', NULL, NULL, 0, 0, 'M', '1', NULL, 'tool', 'admin', '2023-07-03 21:53:02', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3, '开发工具', 0, 4, 'tool', NULL, NULL, 0, 0, 'M', '1', NULL, 'tool', 'admin', '2023-07-03 21:53:02', 'admin', '2023-07-05 13:02:53', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 1, 'user', 'system/user/index', '', 0, 0, 'C', '1', 'system:user:list', 'user', 'admin', '2023-04-23 14:35:29', '', NULL, '用户管理菜单', 1);
|
||||
INSERT INTO `sys_menu` VALUES (101, '角色管理', 1, 2, 'role', 'system/role/index', '', 0, 0, 'C', '1', 'system:role:list', 'peoples', 'admin', '2023-04-23 14:35:29', '', NULL, '角色管理菜单', 1);
|
||||
INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', 0, 0, 'C', '1', 'system:menu:list', 'tree-table', 'admin', '2023-04-23 14:35:29', '', NULL, '菜单管理菜单', 1);
|
||||
@ -312,6 +345,7 @@ INSERT INTO `sys_menu` VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/i
|
||||
INSERT INTO `sys_menu` VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', '', 0, 0, 'C', '1', 'system:config:list', 'edit', 'admin', '2022-08-15 18:01:28', 'admin', '2023-05-24 21:13:11', '参数设置菜单', 1);
|
||||
INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', 0, 0, 'C', '1', 'monitor:online:list', 'online', 'admin', '2023-05-27 22:22:18', 'admin', '2023-06-19 15:29:03', '在线用户菜单', 1);
|
||||
INSERT INTO `sys_menu` VALUES (116, '代码生成', 3, 1, 'gen', 'tool/gen/index', '', 0, 0, 'C', '1', 'tool:gen:list', 'code', 'admin', '2023-07-03 09:05:56', 'admin', '2023-07-03 21:53:13', '代码生成菜单', 1);
|
||||
INSERT INTO `sys_menu` VALUES (500, '操作日志', 2, 3, 'operlog', 'monitor/use_log/index', '', 0, 0, 'C', '1', 'monitor:use-log:list', 'log', 'admin', '2022-08-15 18:01:28', 'admin', '2023-07-05 15:19:25', '操作日志菜单', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1000, '用户查询', 100, 1, '', '', '', 0, 0, 'F', '1', 'system:user:query', '#', 'admin', '2023-04-23 14:35:29', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1001, '用户新增', 100, 2, '', '', '', 0, 0, 'F', '1', 'system:user:add', '#', 'admin', '2023-04-23 14:35:29', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1002, '用户修改', 100, 3, '', '', '', 0, 0, 'F', '1', 'system:user:edit', '#', 'admin', '2023-04-23 14:35:29', '', NULL, '', 1);
|
||||
@ -346,6 +380,9 @@ INSERT INTO `sys_menu` VALUES (1030, '参数查询', 106, 1, '#', '', '', 0, 0,
|
||||
INSERT INTO `sys_menu` VALUES (1031, '参数新增', 106, 2, '#', '', '', 0, 0, 'F', '1', 'system:config:add', '#', 'admin', '2022-08-15 18:01:28', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1032, '参数修改', 106, 3, '#', '', '', 0, 0, 'F', '1', 'system:config:edit', '#', 'admin', '2022-08-15 18:01:28', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1033, '参数删除', 106, 4, '#', '', '', 0, 0, 'F', '1', 'system:config:remove', '#', 'admin', '2022-08-15 18:01:28', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1039, '操作查询', 500, 1, '#', '', '', 0, 0, 'F', '1', 'monitor:use-log:query', '#', 'admin', '2022-08-15 18:01:28', 'admin', '2023-07-05 15:15:09', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1040, '操作删除', 500, 2, '#', '', '', 0, 0, 'F', '1', 'monitor:use-log:remove', '#', 'admin', '2022-08-15 18:01:28', 'admin', '2023-07-05 15:15:15', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1041, '日志导出', 500, 3, '#', '', '', 0, 0, 'F', '1', 'monitor:use-log:export', '#', 'admin', '2022-08-15 18:01:28', 'admin', '2023-07-05 15:15:21', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', 0, 0, 'F', '1', 'monitor:online:query', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', 0, 0, 'F', '1', 'monitor:online:batchLogout', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', 0, 0, 'F', '1', 'monitor:online:forceLogout', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
|
||||
@ -366,7 +403,7 @@ INSERT INTO `sys_menu` VALUES (1666365815403069442, '删除数据源', 166343193
|
||||
INSERT INTO `sys_menu` VALUES (1666365996601196545, '数据源列表', 1663431933531869185, 8, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:datasource:list', '#', 'admin', '2023-06-07 16:46:28', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1666366412382552066, '删除租户', 1663431933531869185, 4, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:remove', '#', 'admin', '2023-06-07 16:48:07', 'admin', '2023-06-13 16:52:20', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1668544169384468481, '租户初始化', 1663431933531869184, 2, 'initialize', 'tenant/initialize', NULL, 0, 0, 'C', '0', NULL, '#', 'admin', '2023-06-13 17:01:45', 'admin', '2023-06-21 15:32:27', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1670708064303742978, '登录日志', 2, 2, 'login-log', 'monitor/login_log/index', NULL, 0, 0, 'C', '1', 'monitor:login-log:list', 'documentation', 'admin', '2023-06-19 16:20:17', 'admin', '2023-06-19 16:21:59', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1670708064303742978, '登录日志', 2, 2, 'login-log', 'monitor/login_log/index', NULL, 0, 0, 'C', '1', 'monitor:login-log:list', 'logininfor', 'admin', '2023-06-19 16:20:17', 'admin', '2023-07-05 14:47:47', '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1670719944372002817, '日志导出', 1670708064303742978, 1, '', NULL, NULL, 0, 0, 'F', '1', 'monitor:login-log:export', '#', 'admin', '2023-06-19 17:07:30', '', NULL, '', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1670720034851528706, '日志清空', 1670708064303742978, 2, '', NULL, NULL, 0, 0, 'F', '1', 'monitor:login-log:remove', '#', 'admin', '2023-06-19 17:07:51', '', NULL, '', 1);
|
||||
|
||||
@ -420,7 +457,7 @@ CREATE TABLE `sys_role` (
|
||||
-- ----------------------------
|
||||
-- Records of sys_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', '1', 'admin', '2023-04-23 14:35:29', 'admin', '2023-07-03 20:37:26', '超级管理员', 1);
|
||||
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', '1', 'admin', '2023-04-23 14:35:29', 'admin', '2023-07-05 14:48:01', '超级管理员', 1);
|
||||
INSERT INTO `sys_role` VALUES (1660535591067213826, '测试', 'test', 1, '2', '1', 'admin', '2023-05-22 14:38:31', 'admin', '2023-06-21 15:31:52', NULL, 1);
|
||||
|
||||
-- ----------------------------
|
||||
@ -467,6 +504,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 105, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 106, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 109, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 116, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 500, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1000, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1001, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1002, 1);
|
||||
@ -501,6 +539,9 @@ INSERT INTO `sys_role_menu` VALUES (1, 1030, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1031, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1032, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1033, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1039, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1040, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1041, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1046, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1047, 1);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1048, 1);
|
||||
@ -597,6 +638,7 @@ CREATE TABLE `sys_tenant` (
|
||||
-- Records of sys_tenant
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_tenant` VALUES (1, '主系统', '111', '111', '11', '11122', '111', NULL, '2099-05-30 23:59:59', 111, '1', '3', NULL, 'admin', '2023-05-30 15:18:04', 'admin', '2023-06-13 16:04:04', '111');
|
||||
INSERT INTO `sys_tenant` VALUES (1676519873008209922, '121', '313', '4143', '313', '52353', '313', NULL, '2023-07-05 17:14:19', 121, '1', NULL, NULL, 'admin', '2023-07-05 17:14:21', 'admin', '2023-07-05 17:14:30', '313');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_tenant_datasource
|
||||
@ -628,6 +670,36 @@ CREATE TABLE `sys_tenant_datasource` (
|
||||
-- Records of sys_tenant_datasource
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_use_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_use_log`;
|
||||
CREATE TABLE `sys_use_log` (
|
||||
`id` bigint(20) NOT NULL COMMENT '日志主键',
|
||||
`title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '模块标题',
|
||||
`business_type` int(11) NULL DEFAULT 0 COMMENT '业务类型(0其它 1新增 2修改 3删除)',
|
||||
`method` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '方法名称',
|
||||
`request_method` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求方式',
|
||||
`operator_type` int(11) NULL DEFAULT 0 COMMENT '操作类别(0其它 1后台用户 2手机端用户)',
|
||||
`operator_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作人员',
|
||||
`dept_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '部门名称',
|
||||
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求URL',
|
||||
`ip` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '主机地址',
|
||||
`operation_location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作地点',
|
||||
`operation_param` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求参数',
|
||||
`json_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '返回参数',
|
||||
`status` int(11) NULL DEFAULT 0 COMMENT '操作状态(0正常 1异常)',
|
||||
`error_msg` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '错误消息',
|
||||
`operation_time` datetime NULL DEFAULT NULL COMMENT '操作时间',
|
||||
`tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志记录' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_use_log
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_use_log` VALUES (1676521836735180802, '操作日志', 9, 'com.qiaoba.module.log.controller.SysUseLogController.clean()', 'DELETE', 1, 'admin', '', '/monitor/use-log/clean', '192.168.0.201', '0|0|0|内网IP|内网IP', '', '{\"msg\":\"操作成功\",\"code\":200}', 1, '', '2023-07-05 17:22:09', 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user
|
||||
-- ----------------------------
|
||||
|
10
pom.xml
10
pom.xml
@ -163,6 +163,11 @@
|
||||
<artifactId>qiaoba-module-monitor</artifactId>
|
||||
<version>${qiaoba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-module-log</artifactId>
|
||||
<version>${qiaoba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-module-generator</artifactId>
|
||||
@ -228,6 +233,11 @@
|
||||
<artifactId>qiaoba-api-tenant</artifactId>
|
||||
<version>${qiaoba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-api-log</artifactId>
|
||||
<version>${qiaoba.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
<module>qiaoba-api-auth</module>
|
||||
<module>qiaoba-api-monitor</module>
|
||||
<module>qiaoba-api-tenant</module>
|
||||
<module>qiaoba-api-log</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
@ -17,5 +17,9 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.qiaoba.auth.annotation;
|
||||
package com.qiaoba.api.auth.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.qiaoba.auth.constants;
|
||||
package com.qiaoba.api.auth.constants;
|
||||
|
||||
/**
|
||||
* 安全常量
|
@ -1,8 +1,8 @@
|
||||
package com.qiaoba.auth.entity;
|
||||
package com.qiaoba.api.auth.entity;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
@ -1,4 +1,4 @@
|
||||
package com.qiaoba.auth.entity;
|
||||
package com.qiaoba.api.auth.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
@ -1,6 +1,6 @@
|
||||
package com.qiaoba.auth.entity;
|
||||
package com.qiaoba.api.auth.entity;
|
||||
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
@ -1,4 +1,4 @@
|
||||
package com.qiaoba.auth.entity.dto;
|
||||
package com.qiaoba.api.auth.entity.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
@ -1,4 +1,4 @@
|
||||
package com.qiaoba.auth.entity.dto;
|
||||
package com.qiaoba.api.auth.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.qiaoba.auth.service;
|
||||
package com.qiaoba.api.auth.service;
|
||||
|
||||
import com.qiaoba.auth.entity.OnlineUser;
|
||||
import com.qiaoba.api.auth.entity.OnlineUser;
|
||||
import com.qiaoba.common.base.entity.BasePage;
|
||||
|
||||
import java.util.List;
|
@ -1,6 +1,6 @@
|
||||
package com.qiaoba.auth.utils;
|
||||
package com.qiaoba.api.auth.utils;
|
||||
|
||||
import com.qiaoba.auth.entity.LoginUser;
|
||||
import com.qiaoba.api.auth.entity.LoginUser;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
@ -1,8 +1,8 @@
|
||||
package com.qiaoba.auth.utils;
|
||||
package com.qiaoba.api.auth.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.auth.entity.dto.OnlineUserDto;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.entity.dto.OnlineUserDto;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
|
||||
@ -51,4 +51,24 @@ public class TokenUtil {
|
||||
throw new ServiceException("Token解析失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 username
|
||||
*
|
||||
* @param request request
|
||||
* @return username
|
||||
*/
|
||||
public static String analyzeUsername(HttpServletRequest request) {
|
||||
// 取Header中的Token
|
||||
try {
|
||||
String authHeader = request.getHeader(SecurityConstant.TOKEN_HEADER);
|
||||
if (StrUtil.isNotBlank(authHeader) && authHeader.startsWith(SecurityConstant.TOKEN_HEAD)) {
|
||||
String token = authHeader.substring(SecurityConstant.TOKEN_HEAD.length());
|
||||
return token.split(BaseConstant.COLON_JOIN_STR)[0];
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-auth</artifactId>
|
||||
<artifactId>qiaoba-api-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
|
14
qiaoba-apis/qiaoba-api-log/pom.xml
Normal file
14
qiaoba-apis/qiaoba-api-log/pom.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>qiaoba-apis</artifactId>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>qiaoba-api-log</artifactId>
|
||||
|
||||
</project>
|
@ -0,0 +1,44 @@
|
||||
package com.qiaoba.api.job.annotation;
|
||||
|
||||
import com.qiaoba.api.job.enums.BusinessType;
|
||||
import com.qiaoba.api.job.enums.OperatorType;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 自定义操作日志记录注解
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @date 1/31/23 4:23 PM
|
||||
*/
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Log {
|
||||
|
||||
/**
|
||||
* 模块
|
||||
*/
|
||||
String title() default "";
|
||||
|
||||
/**
|
||||
* 功能
|
||||
*/
|
||||
BusinessType businessType() default BusinessType.OTHER;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*/
|
||||
OperatorType operatorType() default OperatorType.MANAGE;
|
||||
|
||||
/**
|
||||
* 是否保存请求的参数
|
||||
*/
|
||||
boolean isSaveRequestData() default true;
|
||||
|
||||
/**
|
||||
* 是否保存响应的参数
|
||||
*/
|
||||
boolean isSaveResponseData() default true;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.qiaoba.api.job.enums;
|
||||
|
||||
/**
|
||||
* 业务操作类型
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @date 1/31/23 4:23 PM
|
||||
*/
|
||||
public enum BusinessType {
|
||||
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
INSERT,
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE,
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
GRANT,
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
EXPORT,
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
IMPORT,
|
||||
|
||||
/**
|
||||
* 强退
|
||||
*/
|
||||
FORCE,
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
GENCODE,
|
||||
|
||||
/**
|
||||
* 清空数据
|
||||
*/
|
||||
CLEAN,
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.qiaoba.api.job.enums;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @date 1/31/23 4:23 PM
|
||||
*/
|
||||
public enum OperatorType {
|
||||
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 后台用户
|
||||
*/
|
||||
MANAGE,
|
||||
|
||||
/**
|
||||
* 手机端用户
|
||||
*/
|
||||
MOBILE
|
||||
}
|
@ -12,10 +12,6 @@
|
||||
<artifactId>qiaoba-api-monitor</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-poi</artifactId>
|
||||
|
@ -14,6 +14,10 @@
|
||||
<description>总打包模块, 需要打包的模块, 引入到该模块中即可</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-module-monitor</artifactId>
|
||||
@ -34,6 +38,10 @@
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-module-generator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-module-log</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -23,10 +23,6 @@
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-base</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-web</artifactId>
|
||||
</dependency>
|
||||
<!-- common-redis -->
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
|
@ -2,10 +2,10 @@ package com.qiaoba.auth.aspectj;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiaoba.auth.annotation.DataScope;
|
||||
import com.qiaoba.auth.entity.LoginUser;
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.annotation.DataScope;
|
||||
import com.qiaoba.api.auth.entity.LoginUser;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.entity.DataScopeParam;
|
||||
import com.qiaoba.common.base.utils.DatabaseUtil;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.qiaoba.auth.config;
|
||||
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.auth.filters.AuthenticationCoreFilter;
|
||||
import com.qiaoba.auth.handler.AccessDeniedHandler;
|
||||
import com.qiaoba.auth.handler.LogoutHandler;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.qiaoba.auth.filters;
|
||||
|
||||
import com.qiaoba.api.auth.service.AuthConfigApiService;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.auth.entity.dto.OnlineUserDto;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.entity.dto.OnlineUserDto;
|
||||
import com.qiaoba.auth.properties.AuthConfigProperties;
|
||||
import com.qiaoba.auth.service.OnlineUserService;
|
||||
import com.qiaoba.auth.utils.TokenUtil;
|
||||
import com.qiaoba.api.auth.service.OnlineUserService;
|
||||
import com.qiaoba.api.auth.utils.TokenUtil;
|
||||
import com.qiaoba.common.redis.service.RedisService;
|
||||
import com.qiaoba.common.web.utils.ResponseUtil;
|
||||
import com.qiaoba.common.web.utils.UriUtil;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.qiaoba.auth.handler;
|
||||
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.common.web.utils.ResponseUtil;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.qiaoba.auth.handler;
|
||||
|
||||
import com.qiaoba.auth.entity.LoginUser;
|
||||
import com.qiaoba.auth.service.OnlineUserService;
|
||||
import com.qiaoba.api.auth.entity.LoginUser;
|
||||
import com.qiaoba.api.auth.service.OnlineUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
@ -2,7 +2,7 @@ package com.qiaoba.auth.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiaoba.api.auth.service.AuthConfigApiService;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.common.base.constants.ConfigConstant;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.common.redis.service.RedisService;
|
||||
|
@ -3,11 +3,11 @@ package com.qiaoba.auth.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiaoba.api.auth.service.SysUserDetailsApiService;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.auth.entity.OnlineUser;
|
||||
import com.qiaoba.auth.entity.dto.OnlineUserDto;
|
||||
import com.qiaoba.auth.service.OnlineUserService;
|
||||
import com.qiaoba.auth.utils.TokenUtil;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.entity.OnlineUser;
|
||||
import com.qiaoba.api.auth.entity.dto.OnlineUserDto;
|
||||
import com.qiaoba.api.auth.service.OnlineUserService;
|
||||
import com.qiaoba.api.auth.utils.TokenUtil;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.entity.BasePage;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
|
@ -19,6 +19,7 @@
|
||||
<module>qiaoba-module-tenant</module>
|
||||
<module>qiaoba-module-demo</module>
|
||||
<module>qiaoba-module-generator</module>
|
||||
<module>qiaoba-module-log</module>
|
||||
</modules>
|
||||
|
||||
<description>qiaoba-modules: 新建的模块, 统一放在这个模块下面</description>
|
||||
|
@ -32,11 +32,15 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-auth</artifactId>
|
||||
<artifactId>qiaoba-api-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-doc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-api-log</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.qiaoba.module.generator.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.qiaoba.api.job.annotation.Log;
|
||||
import com.qiaoba.api.job.enums.BusinessType;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
@ -74,6 +76,7 @@ public class GeneratorController {
|
||||
* 批量删除代码生成
|
||||
*/
|
||||
@DeleteMapping("/{tableIds}")
|
||||
@Log(title = "代码生成", businessType = BusinessType.DELETE)
|
||||
public AjaxResult remove(@PathVariable List<String> tableIds) {
|
||||
return AjaxResult.toAjax(generatorTableService.deleteByIds(tableIds));
|
||||
}
|
||||
@ -107,6 +110,7 @@ public class GeneratorController {
|
||||
* 下载文件
|
||||
*/
|
||||
@GetMapping("/download/{tableId}/{templateType}")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
public void download(HttpServletResponse response, @PathVariable String tableId, @PathVariable String templateType) throws IOException {
|
||||
byte[] data = generatorTableService.downloadCode(tableId, templateType);
|
||||
GeneratorUtil.download(response, data);
|
||||
|
@ -4,7 +4,7 @@ import java.util.*;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
39
qiaoba-modules/qiaoba-module-log/pom.xml
Normal file
39
qiaoba-modules/qiaoba-module-log/pom.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>qiaoba-modules</artifactId>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>qiaoba-module-log</artifactId>
|
||||
|
||||
<description>日志模块</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-api-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-api-log</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-datasource</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-doc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-common-poi</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,192 @@
|
||||
package com.qiaoba.module.log.aspect;
|
||||
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.qiaoba.api.auth.utils.TokenUtil;
|
||||
import com.qiaoba.api.job.annotation.Log;
|
||||
import com.qiaoba.common.base.enums.BaseEnum;
|
||||
import com.qiaoba.common.web.utils.IpUtil;
|
||||
import com.qiaoba.module.log.entity.SysUseLog;
|
||||
import com.qiaoba.module.log.service.SysUserLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.AfterThrowing;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 操作日志记录切面
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @date 1/31/23 4:23 PM
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class LogAspect {
|
||||
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
||||
|
||||
private static final String METHOD_TEMPLATE = "{}.{}()";
|
||||
|
||||
private final SysUserLogService logService;
|
||||
|
||||
private final HttpServletRequest request;
|
||||
|
||||
|
||||
/**
|
||||
* 处理完请求后执行
|
||||
*
|
||||
* @param joinPoint 切点
|
||||
*/
|
||||
@AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
|
||||
public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) {
|
||||
handleLog(joinPoint, controllerLog, null, jsonResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拦截异常操作
|
||||
*
|
||||
* @param joinPoint 切点
|
||||
* @param e 异常
|
||||
*/
|
||||
@AfterThrowing(value = "@annotation(controllerLog)", throwing = "e")
|
||||
public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) {
|
||||
handleLog(joinPoint, controllerLog, e, null);
|
||||
}
|
||||
|
||||
private void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult) {
|
||||
try {
|
||||
// *========数据库日志=========*//
|
||||
SysUseLog sysLog = new SysUseLog();
|
||||
sysLog.setStatus(BaseEnum.NORMAL.getCode());
|
||||
// 请求的地址
|
||||
String ip = ServletUtil.getClientIP(request);
|
||||
sysLog.setIp(ip);
|
||||
sysLog.setOperationLocation(IpUtil.getIpAddr(ip));
|
||||
sysLog.setOperatorName(TokenUtil.analyzeUsername(request));
|
||||
sysLog.setUrl(request.getRequestURI());
|
||||
|
||||
|
||||
if (e != null) {
|
||||
sysLog.setStatus(BaseEnum.NO.getCode());
|
||||
sysLog.setErrorMsg(e.getMessage());
|
||||
}
|
||||
// 设置方法名称
|
||||
String className = joinPoint.getTarget().getClass().getName();
|
||||
String methodName = joinPoint.getSignature().getName();
|
||||
sysLog.setMethod(StrUtil.format(METHOD_TEMPLATE, className, methodName));
|
||||
// 设置请求方式
|
||||
sysLog.setRequestMethod(request.getMethod());
|
||||
sysLog.setOperationTime(new Date());
|
||||
// 处理设置注解上的参数
|
||||
getControllerMethodDescription(joinPoint, controllerLog, sysLog, jsonResult);
|
||||
// 保存数据库
|
||||
logService.insert(sysLog);
|
||||
} catch (Exception exp) {
|
||||
// 记录本地异常日志
|
||||
log.error("==前置通知异常==");
|
||||
log.error("异常信息:{}", exp.getMessage());
|
||||
exp.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取注解中对方法的描述信息 用于Controller层注解
|
||||
*
|
||||
* @param log 日志
|
||||
* @param sysLog 操作日志
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
private void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysUseLog sysLog, Object jsonResult) throws Exception {
|
||||
// 设置action动作
|
||||
sysLog.setBusinessType(log.businessType().ordinal());
|
||||
// 设置标题
|
||||
sysLog.setTitle(log.title());
|
||||
// 设置操作人类别
|
||||
sysLog.setOperatorType(log.operatorType().ordinal());
|
||||
// 是否需要保存request,参数和值
|
||||
if (log.isSaveRequestData()) {
|
||||
// 获取参数的信息,传入到数据库中。
|
||||
setRequestValue(joinPoint, sysLog);
|
||||
}
|
||||
// 是否需要保存response,参数和值
|
||||
if (log.isSaveResponseData() && ObjectUtil.isNotNull(jsonResult)) {
|
||||
sysLog.setJsonResult(JSONUtil.toJsonStr(jsonResult));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求的参数,放到log中
|
||||
*
|
||||
* @param sysLog 操作日志
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
private void setRequestValue(JoinPoint joinPoint, SysUseLog sysLog) throws Exception {
|
||||
String requestMethod = sysLog.getRequestMethod();
|
||||
if (!HttpMethod.GET.name().equals(requestMethod)) {
|
||||
String params = argsArrayToString(joinPoint.getArgs());
|
||||
sysLog.setOperationParam(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数拼装
|
||||
*/
|
||||
private String argsArrayToString(Object[] paramsArray) {
|
||||
StringBuilder params = new StringBuilder();
|
||||
if (paramsArray != null && paramsArray.length > 0) {
|
||||
for (Object o : paramsArray) {
|
||||
if (ObjectUtil.isNotNull(o) && !isFilterObject(o)) {
|
||||
String jsonObj = JSONUtil.toJsonStr(o);
|
||||
params.append(jsonObj).append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return params.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否需要过滤的对象。
|
||||
*
|
||||
* @param o 对象信息。
|
||||
* @return 如果是需要过滤的对象,则返回true;否则返回false。
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private boolean isFilterObject(final Object o) {
|
||||
Class<?> clazz = o.getClass();
|
||||
if (clazz.isArray()) {
|
||||
return clazz.getComponentType().isAssignableFrom(MultipartFile.class);
|
||||
} else if (Collection.class.isAssignableFrom(clazz)) {
|
||||
Collection collection = (Collection) o;
|
||||
for (Object value : collection) {
|
||||
return value instanceof MultipartFile;
|
||||
}
|
||||
} else if (Map.class.isAssignableFrom(clazz)) {
|
||||
Map map = (Map) o;
|
||||
for (Object value : map.entrySet()) {
|
||||
Map.Entry entry = (Map.Entry) value;
|
||||
return entry.getValue() instanceof MultipartFile;
|
||||
}
|
||||
}
|
||||
return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
|
||||
|| o instanceof BindingResult;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.qiaoba.module.log.controller;
|
||||
|
||||
import com.qiaoba.api.job.annotation.Log;
|
||||
import com.qiaoba.api.job.enums.BusinessType;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
import com.qiaoba.common.poi.utils.ExcelUtil;
|
||||
import com.qiaoba.module.log.entity.SysUseLog;
|
||||
import com.qiaoba.module.log.entity.param.SysUseLogParam;
|
||||
import com.qiaoba.module.log.service.SysUserLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 web层
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2022-09-22 04:20:28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/use-log")
|
||||
@RequiredArgsConstructor
|
||||
public class SysUseLogController {
|
||||
|
||||
private final SysUserLogService sysUserLogService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUseLogParam param, PageQuery pageQuery) {
|
||||
return sysUserLogService.selectPageList(param, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUseLogParam param) {
|
||||
List<SysUseLog> list = sysUserLogService.selectList(param);
|
||||
ExcelUtil.exportExcel(list, SysUseLog.class, "操作日志", response);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean() {
|
||||
sysUserLogService.cleanUseLog();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.qiaoba.module.log.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 使用日志 sys_use_log
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @date 1/31/23 4:23 PM
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("sys_use_log")
|
||||
public class SysUseLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "操作序号")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "操作模块")
|
||||
private String title;
|
||||
|
||||
@Excel(name = "业务类型", replace = {"其他_0", "新增_1", "修改_2", "删除_3", "授权_4", "导出_5", "导入_6", "强退_7", "生成代码_8", "清空数据_9"})
|
||||
private Integer businessType;
|
||||
|
||||
@Excel(name = "请求方法")
|
||||
private String method;
|
||||
|
||||
@Excel(name = "请求方式")
|
||||
private String requestMethod;
|
||||
|
||||
@Excel(name = "操作类别", replace = {"其他_0", "后台用户_1", "手机端用户_2"})
|
||||
private Integer operatorType;
|
||||
|
||||
@Excel(name = "操作人员")
|
||||
private String operatorName;
|
||||
|
||||
private String deptName;
|
||||
|
||||
@Excel(name = "请求地址")
|
||||
private String url;
|
||||
|
||||
@Excel(name = "操作地址")
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "操作地点")
|
||||
private String operationLocation;
|
||||
|
||||
@Excel(name = "请求参数")
|
||||
private String operationParam;
|
||||
|
||||
@Excel(name = "返回参数")
|
||||
private String jsonResult;
|
||||
|
||||
@Excel(name = "状态", replace = {"正常_0", "异常_1"})
|
||||
private String status;
|
||||
|
||||
@Excel(name = "错误消息")
|
||||
private String errorMsg;
|
||||
|
||||
@Excel(name = "操作时间", format = "yyyy-MM-dd HH:mm:ss", width = 30)
|
||||
private Date operationTime;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.qiaoba.module.log.entity.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 使用日志 查询参数
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/7/5 14:24
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SysUseLogParam implements Serializable {
|
||||
|
||||
private String title;
|
||||
|
||||
private String operatorName;
|
||||
|
||||
private Integer businessType;
|
||||
|
||||
private Integer status;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date beginTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.qiaoba.module.log.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.qiaoba.module.log.entity.SysUseLog;
|
||||
|
||||
/**
|
||||
* 使用日志 数据层
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/7/5 13:52
|
||||
*/
|
||||
public interface SysUserLogMapper extends BaseMapper<SysUseLog> {
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.qiaoba.module.log.service;
|
||||
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
import com.qiaoba.module.log.entity.SysUseLog;
|
||||
import com.qiaoba.module.log.entity.param.SysUseLogParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 使用日志 服务层
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/7/5 13:51
|
||||
*/
|
||||
public interface SysUserLogService {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param sysUseLog sysUseLog
|
||||
*/
|
||||
void insert(SysUseLog sysUseLog);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @param pageQuery 分页信息
|
||||
* @return list
|
||||
*/
|
||||
TableDataInfo selectPageList(SysUseLogParam param, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return list
|
||||
*/
|
||||
List<SysUseLog> selectList(SysUseLogParam param);
|
||||
|
||||
/**
|
||||
* 清空日志
|
||||
*/
|
||||
void cleanUseLog();
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.qiaoba.module.log.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
import com.qiaoba.module.log.entity.SysUseLog;
|
||||
import com.qiaoba.module.log.entity.param.SysUseLogParam;
|
||||
import com.qiaoba.module.log.mapper.SysUserLogMapper;
|
||||
import com.qiaoba.module.log.service.SysUserLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 使用日志 服务层实现
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/7/5 13:51
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysUserLogServiceImpl implements SysUserLogService {
|
||||
|
||||
private final SysUserLogMapper sysUserLogMapper;
|
||||
|
||||
@Override
|
||||
public void insert(SysUseLog sysUseLog) {
|
||||
sysUserLogMapper.insert(sysUseLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo selectPageList(SysUseLogParam param, PageQuery pageQuery) {
|
||||
return TableDataInfo.build(sysUserLogMapper.selectPage(pageQuery.build(), param2Wrapper(param)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUseLog> selectList(SysUseLogParam param) {
|
||||
return sysUserLogMapper.selectList(param2Wrapper(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUseLog() {
|
||||
sysUserLogMapper.delete(param2Wrapper(new SysUseLogParam()));
|
||||
}
|
||||
|
||||
private QueryWrapper<SysUseLog> param2Wrapper(SysUseLogParam param) {
|
||||
QueryWrapper<SysUseLog> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda()
|
||||
.orderByDesc(SysUseLog::getOperationTime)
|
||||
.between(ObjectUtil.isNotEmpty(param.getBeginTime()), SysUseLog::getOperationTime, param.getBeginTime(), param.getEndTime())
|
||||
.like(StrUtil.isNotBlank(param.getTitle()), SysUseLog::getTitle, param.getTitle())
|
||||
.like(StrUtil.isNotBlank(param.getOperatorName()), SysUseLog::getOperatorName, param.getOperatorName())
|
||||
.eq(ObjectUtil.isNotEmpty(param.getBusinessType()), SysUseLog::getBusinessType, param.getBusinessType())
|
||||
.eq(ObjectUtil.isNotEmpty(param.getStatus()), SysUseLog::getStatus, param.getStatus());
|
||||
return wrapper;
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-auth</artifactId>
|
||||
<artifactId>qiaoba-api-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.qiaoba.module.monitor.controller;
|
||||
|
||||
import com.qiaoba.auth.service.OnlineUserService;
|
||||
import com.qiaoba.api.auth.service.OnlineUserService;
|
||||
import com.qiaoba.common.base.entity.BasePage;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -50,7 +50,7 @@ public class SysLoginLogServiceImpl implements SysLoginLogService {
|
||||
private QueryWrapper<SysLoginLog> param2Wrapper(LoginLogParam param) {
|
||||
QueryWrapper<SysLoginLog> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda()
|
||||
.orderByAsc(SysLoginLog::getLoginTime)
|
||||
.orderByDesc(SysLoginLog::getLoginTime)
|
||||
.ge(Objects.nonNull(param.getBeginTime()), SysLoginLog::getLoginTime, param.getBeginTime())
|
||||
.le(Objects.nonNull(param.getEndTime()), SysLoginLog::getLoginTime, param.getEndTime())
|
||||
.like(StrUtil.isNotBlank(param.getNickname()), SysLoginLog::getNickname, param.getNickname())
|
||||
|
@ -2,7 +2,7 @@ package com.qiaoba.module.system.controller;
|
||||
|
||||
import com.qiaoba.api.system.entity.dto.LoginDto;
|
||||
import com.qiaoba.api.system.entity.vo.SysMenuVo;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import com.qiaoba.module.system.service.SysLoginService;
|
||||
import com.qiaoba.module.system.service.SysMenuService;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.qiaoba.module.system.controller;
|
||||
|
||||
import com.qiaoba.api.system.entity.dto.ResetUserBasicInfoDto;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import com.qiaoba.module.system.service.SysProfileService;
|
||||
import com.qiaoba.module.system.service.SysUserPostService;
|
||||
|
@ -11,7 +11,7 @@ import com.qiaoba.api.system.entity.param.SysPostParam;
|
||||
import com.qiaoba.api.system.entity.param.SysRoleParam;
|
||||
import com.qiaoba.api.system.entity.param.SysUserParam;
|
||||
import com.qiaoba.api.system.entity.vo.SysUserVo;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.enums.BaseEnum;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
|
@ -2,7 +2,7 @@ package com.qiaoba.module.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.qiaoba.api.system.entity.SysUserRole;
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.qiaoba.module.system.service;
|
||||
|
||||
import com.qiaoba.api.system.entity.SysUserRole;
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.api.system.entity.SysConfig;
|
||||
import com.qiaoba.api.system.entity.param.SysConfigParam;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.code.ConfigErrorCode;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.constants.ConfigConstant;
|
||||
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.qiaoba.api.system.entity.SysDept;
|
||||
import com.qiaoba.api.system.entity.param.SysDeptParam;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.enums.BaseEnum;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
|
@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.api.system.entity.SysDictData;
|
||||
import com.qiaoba.api.system.entity.SysDictType;
|
||||
import com.qiaoba.api.system.entity.param.SysDictDataParam;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.constants.DictConstant;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
|
@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.api.system.entity.SysDictType;
|
||||
import com.qiaoba.api.system.entity.param.SysDictTypeParam;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.code.DictErrorCode;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
|
@ -14,11 +14,11 @@ import com.qiaoba.api.monitor.entity.SysLoginLog;
|
||||
import com.qiaoba.api.monitor.service.SysLoginLogApiService;
|
||||
import com.qiaoba.api.system.entity.SysUser;
|
||||
import com.qiaoba.api.system.entity.dto.LoginDto;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.auth.entity.OnlineUser;
|
||||
import com.qiaoba.auth.service.OnlineUserService;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.auth.utils.TokenUtil;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.entity.OnlineUser;
|
||||
import com.qiaoba.api.auth.service.OnlineUserService;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.TokenUtil;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.constants.ConfigConstant;
|
||||
import com.qiaoba.common.base.enums.BaseEnum;
|
||||
|
@ -9,7 +9,7 @@ import com.qiaoba.api.system.entity.SysMenu;
|
||||
import com.qiaoba.api.system.entity.param.SysMenuParam;
|
||||
import com.qiaoba.api.system.entity.vo.RouterVo;
|
||||
import com.qiaoba.api.system.entity.vo.SysMenuVo;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.module.system.mapper.SysMenuMapper;
|
||||
|
@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.api.system.entity.SysPost;
|
||||
import com.qiaoba.api.system.entity.param.SysPostParam;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
|
@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import com.qiaoba.api.file.service.FileApiService;
|
||||
import com.qiaoba.api.system.entity.SysUser;
|
||||
import com.qiaoba.api.system.entity.dto.ResetUserBasicInfoDto;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.module.system.service.SysProfileService;
|
||||
import com.qiaoba.module.system.service.SysUserService;
|
||||
|
@ -10,7 +10,7 @@ import com.qiaoba.api.system.entity.SysRoleMenu;
|
||||
import com.qiaoba.api.system.entity.dto.DataScopeDto;
|
||||
import com.qiaoba.api.system.entity.dto.SysRoleDto;
|
||||
import com.qiaoba.api.system.entity.param.SysRoleParam;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
|
@ -3,11 +3,11 @@ package com.qiaoba.module.system.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.qiaoba.api.auth.service.SysUserDetailsApiService;
|
||||
import com.qiaoba.api.system.entity.SysUser;
|
||||
import com.qiaoba.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.auth.entity.LoginUser;
|
||||
import com.qiaoba.auth.entity.SecurityUser;
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.auth.utils.TokenUtil;
|
||||
import com.qiaoba.api.auth.constants.SecurityConstant;
|
||||
import com.qiaoba.api.auth.entity.LoginUser;
|
||||
import com.qiaoba.api.auth.entity.SecurityUser;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.utils.TokenUtil;
|
||||
import com.qiaoba.common.base.enums.BaseEnum;
|
||||
import com.qiaoba.common.redis.service.RedisService;
|
||||
import com.qiaoba.module.system.service.SysMenuService;
|
||||
|
@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.qiaoba.api.system.entity.SysUserRole;
|
||||
import com.qiaoba.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.api.auth.entity.dto.RoleDto;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.enums.BaseEnum;
|
||||
import com.qiaoba.module.system.mapper.SysUserRoleMapper;
|
||||
|
@ -12,8 +12,8 @@ import com.qiaoba.api.system.entity.SysUserRole;
|
||||
import com.qiaoba.api.system.entity.dto.SysUserDto;
|
||||
import com.qiaoba.api.system.entity.param.SysUserParam;
|
||||
import com.qiaoba.api.system.entity.vo.SysUserVo;
|
||||
import com.qiaoba.auth.annotation.DataScope;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.annotation.DataScope;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.exceptions.ServiceException;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
|
@ -13,7 +13,7 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectRoleDtoByUserId" resultType="com.qiaoba.auth.entity.dto.RoleDto">
|
||||
<select id="selectRoleDtoByUserId" resultType="com.qiaoba.api.auth.entity.dto.RoleDto">
|
||||
select t2.role_id,t2.role_key,t2.role_name,t2.data_scope from sys_user_role t1
|
||||
left join sys_role t2 on t2.role_id = t1.role_id
|
||||
where t1.user_id = #{userId}
|
||||
|
@ -14,13 +14,17 @@
|
||||
<description>租户模块</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-api-log</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-api-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
<artifactId>qiaoba-auth</artifactId>
|
||||
<artifactId>qiaoba-api-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiaoba</groupId>
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.qiaoba.module.tenant.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.qiaoba.api.job.annotation.Log;
|
||||
import com.qiaoba.api.job.enums.BusinessType;
|
||||
import com.qiaoba.api.tenant.entity.SysTenant;
|
||||
import com.qiaoba.api.tenant.entity.param.SysTenantParam;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
@ -35,6 +37,7 @@ public class SysTenantController {
|
||||
@PreAuthorize("hasAuthority('tenant:add')")
|
||||
@PostMapping
|
||||
@Operation(summary = "新增租户")
|
||||
@Log(title = "新增租户", businessType = BusinessType.INSERT)
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody SysTenant sysTenant) {
|
||||
return AjaxResult.toAjax(sysTenantService.insert(sysTenant));
|
||||
}
|
||||
@ -49,6 +52,7 @@ public class SysTenantController {
|
||||
@PreAuthorize("hasAuthority('tenant:edit')")
|
||||
@PutMapping
|
||||
@Operation(summary = "修改租户")
|
||||
@Log(title = "修改租户", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult edit(@Validated(EditGroup.class) @RequestBody SysTenant sysTenant) {
|
||||
return AjaxResult.toAjax(sysTenantService.update(sysTenant));
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qiaoba.api.tenant.entity.SysTenant;
|
||||
import com.qiaoba.api.tenant.entity.param.SysTenantParam;
|
||||
import com.qiaoba.api.tenant.service.SysTenantApiService;
|
||||
import com.qiaoba.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.api.auth.utils.SecurityUtil;
|
||||
import com.qiaoba.common.base.code.TenantErrorCode;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.constants.TenantConstant;
|
||||
|
Reference in New Issue
Block a user