Commit 69a3e8e7d017d60b97b0307975b4f5e83e39a782
1 parent
cef5b63d
init: 基础登录相关
Showing
38 changed files
with
2081 additions
and
56 deletions
sql/init.sql
1 | -# 部门表 | 1 | +DROP TABLE IF EXISTS `admin_dept`; |
2 | CREATE TABLE `admin_dept` ( | 2 | CREATE TABLE `admin_dept` ( |
3 | `id` bigint NOT NULL AUTO_INCREMENT, | 3 | `id` bigint NOT NULL AUTO_INCREMENT, |
4 | `pid` bigint(20) DEFAULT NULL COMMENT '上级部门', | 4 | `pid` bigint(20) DEFAULT NULL COMMENT '上级部门', |
@@ -14,7 +14,21 @@ CREATE TABLE `admin_dept` ( | @@ -14,7 +14,21 @@ CREATE TABLE `admin_dept` ( | ||
14 | PRIMARY KEY (`id`) | 14 | PRIMARY KEY (`id`) |
15 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门表'; | 15 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门表'; |
16 | 16 | ||
17 | +-- ---------------------------- | ||
18 | +-- Records of admin_dept | ||
19 | +-- ---------------------------- | ||
20 | +BEGIN; | ||
21 | +INSERT INTO `admin_dept` VALUES (2, 7, 1, '研发部', 3, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
22 | +INSERT INTO `admin_dept` VALUES (5, 7, 0, '运维部', 4, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
23 | +INSERT INTO `admin_dept` VALUES (6, 8, 0, '测试部', 6, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
24 | +INSERT INTO `admin_dept` VALUES (7, NULL, 2, '华南分部', 0, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
25 | +INSERT INTO `admin_dept` VALUES (8, NULL, 2, '华北分部', 1, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
26 | +INSERT INTO `admin_dept` VALUES (15, 8, 0, 'UI部门', 7, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
27 | +INSERT INTO `admin_dept` VALUES (17, 2, 0, '研发一组', 999, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
28 | +COMMIT; | ||
17 | 29 | ||
30 | + | ||
31 | +DROP TABLE IF EXISTS `admin_job`; | ||
18 | # 岗位表 | 32 | # 岗位表 |
19 | CREATE TABLE `admin_job` ( | 33 | CREATE TABLE `admin_job` ( |
20 | `id` bigint NOT NULL AUTO_INCREMENT, | 34 | `id` bigint NOT NULL AUTO_INCREMENT, |
@@ -30,6 +44,15 @@ CREATE TABLE `admin_job` ( | @@ -30,6 +44,15 @@ CREATE TABLE `admin_job` ( | ||
30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位表'; | 44 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位表'; |
31 | 45 | ||
32 | 46 | ||
47 | +BEGIN; | ||
48 | +INSERT INTO `admin_job` VALUES (8, '人事专员', 3, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
49 | +INSERT INTO `admin_job` VALUES (10, '产品经理', 4, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
50 | +INSERT INTO `admin_job` VALUES (11, '全栈开发', 2, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
51 | +INSERT INTO `admin_job` VALUES (12, '软件测试', 5, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
52 | +COMMIT; | ||
53 | + | ||
54 | + | ||
55 | +DROP TABLE IF EXISTS `admin_menu`; | ||
33 | # 菜单表 | 56 | # 菜单表 |
34 | CREATE TABLE `admin_menu` ( | 57 | CREATE TABLE `admin_menu` ( |
35 | `id` bigint NOT NULL AUTO_INCREMENT, | 58 | `id` bigint NOT NULL AUTO_INCREMENT, |
@@ -52,13 +75,81 @@ CREATE TABLE `admin_menu` ( | @@ -52,13 +75,81 @@ CREATE TABLE `admin_menu` ( | ||
52 | `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | 75 | `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', |
53 | `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | 76 | `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', |
54 | `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | 77 | `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', |
55 | - PRIMARY KEY (`menu_id`) USING BTREE, | 78 | + PRIMARY KEY (`id`), |
56 | UNIQUE KEY `uniq_title` (`title`), | 79 | UNIQUE KEY `uniq_title` (`title`), |
57 | UNIQUE KEY `uniq_name` (`name`), | 80 | UNIQUE KEY `uniq_name` (`name`), |
58 | KEY `inx_pid` (`pid`) | 81 | KEY `inx_pid` (`pid`) |
59 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; | 82 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单表'; |
83 | + | ||
84 | + | ||
60 | 85 | ||
86 | +BEGIN; | ||
87 | +INSERT INTO `admin_menu` VALUES (1, NULL, 7, 0, '系统管理', NULL, NULL, 1, 'system', 'system', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
88 | +INSERT INTO `admin_menu` VALUES (2, 1, 3, 1, '用户管理', 'User', 'system/user/index', 2, 'peoples', 'user', b'0', b'0', b'0', 'user:list',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
89 | +INSERT INTO `admin_menu` VALUES (3, 1, 3, 1, '角色管理', 'Role', 'system/role/index', 3, 'role', 'role', b'0', b'0', b'0', 'roles:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
90 | +INSERT INTO `admin_menu` VALUES (5, 1, 3, 1, '菜单管理', 'Menu', 'system/menu/index', 5, 'menu', 'menu', b'0', b'0', b'0', 'menu:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
91 | +INSERT INTO `admin_menu` VALUES (6, NULL, 5, 0, '系统监控', NULL, NULL, 10, 'monitor', 'monitor', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
92 | +INSERT INTO `admin_menu` VALUES (7, 6, 0, 1, '操作日志', 'Log', 'monitor/log/index', 11, 'log', 'logs', b'0', b'1', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
93 | +INSERT INTO `admin_menu` VALUES (9, 6, 0, 1, 'SQL监控', 'Sql', 'monitor/sql/index', 18, 'sqlMonitor', 'druid', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
94 | +INSERT INTO `admin_menu` VALUES (10, NULL, 5, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
95 | +INSERT INTO `admin_menu` VALUES (11, 10, 0, 1, '图标库', 'Icons', 'components/icons/index', 51, 'icon', 'icon', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
96 | +INSERT INTO `admin_menu` VALUES (14, 36, 0, 1, '邮件工具', 'Email', 'tools/email/index', 35, 'email', 'email', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
97 | +INSERT INTO `admin_menu` VALUES (15, 10, 0, 1, '富文本', 'Editor', 'components/Editor', 52, 'fwb', 'tinymce', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
98 | +INSERT INTO `admin_menu` VALUES (18, 36, 3, 1, '存储管理', 'Storage', 'tools/storage/index', 34, 'qiniu', 'storage', b'0', b'0', b'0', 'storage:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
99 | +INSERT INTO `admin_menu` VALUES (19, 36, 0, 1, '支付宝工具', 'AliPay', 'tools/aliPay/index', 37, 'alipay', 'aliPay', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
100 | +INSERT INTO `admin_menu` VALUES (21, NULL, 2, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
101 | +INSERT INTO `admin_menu` VALUES (22, 21, 2, 0, '二级菜单1', NULL, '', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL,10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
102 | +INSERT INTO `admin_menu` VALUES (23, 21, 0, 1, '二级菜单2', NULL, 'nested/menu2/index', 999, 'menu', 'menu2', b'0', b'0', b'0', NULL,10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
103 | +INSERT INTO `admin_menu` VALUES (24, 22, 0, 1, '三级菜单1', 'Test', 'nested/menu1/menu1-1', 999, 'menu', 'menu1-1', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
104 | +INSERT INTO `admin_menu` VALUES (27, 22, 0, 1, '三级菜单2', NULL, 'nested/menu1/menu1-2', 999, 'menu', 'menu1-2', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
105 | +INSERT INTO `admin_menu` VALUES (28, 1, 3, 1, '任务调度', 'Timing', 'system/timing/index', 999, 'timing', 'timing', b'0', b'0', b'0', 'timing:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
106 | +INSERT INTO `admin_menu` VALUES (30, 36, 0, 1, '代码生成', 'GeneratorIndex', 'generator/index', 32, 'dev', 'generator', b'0', b'1', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
107 | +INSERT INTO `admin_menu` VALUES (32, 6, 0, 1, '异常日志', 'ErrorLog', 'monitor/log/errorLog', 12, 'error', 'errorLog', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
108 | +INSERT INTO `admin_menu` VALUES (33, 10, 0, 1, 'Markdown', 'Markdown', 'components/MarkDown', 53, 'markdown', 'markdown', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
109 | +INSERT INTO `admin_menu` VALUES (34, 10, 0, 1, 'Yaml编辑器', 'YamlEdit', 'components/YamlEdit', 54, 'dev', 'yaml', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
110 | +INSERT INTO `admin_menu` VALUES (35, 1, 3, 1, '部门管理', 'Dept', 'system/dept/index', 6, 'dept', 'dept', b'0', b'0', b'0', 'dept:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
111 | +INSERT INTO `admin_menu` VALUES (36, NULL, 7, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
112 | +INSERT INTO `admin_menu` VALUES (37, 1, 3, 1, '岗位管理', 'Job', 'system/job/index', 7, 'Steve-Jobs', 'job', b'0', b'0', b'0', 'job:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
113 | +INSERT INTO `admin_menu` VALUES (38, 36, 0, 1, '接口文档', 'Swagger', 'tools/swagger/index', 36, 'swagger', 'swagger2', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
114 | +INSERT INTO `admin_menu` VALUES (39, 1, 3, 1, '字典管理', 'Dict', 'system/dict/index', 8, 'dictionary', 'dict', b'0', b'0', b'0', 'dict:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
115 | +INSERT INTO `admin_menu` VALUES (41, 6, 0, 1, '在线用户', 'OnlineUser', 'monitor/online/index', 10, 'Steve-Jobs', 'online', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
116 | +INSERT INTO `admin_menu` VALUES (44, 2, 0, 2, '用户新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'user:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
117 | +INSERT INTO `admin_menu` VALUES (45, 2, 0, 2, '用户编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'user:edit',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
118 | +INSERT INTO `admin_menu` VALUES (46, 2, 0, 2, '用户删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'user:del', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
119 | +INSERT INTO `admin_menu` VALUES (48, 3, 0, 2, '角色创建', NULL, '', 2, '', '', b'0', b'0', b'0', 'roles:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
120 | +INSERT INTO `admin_menu` VALUES (49, 3, 0, 2, '角色修改', NULL, '', 3, '', '', b'0', b'0', b'0', 'roles:edit', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
121 | +INSERT INTO `admin_menu` VALUES (50, 3, 0, 2, '角色删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'roles:del', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
122 | +INSERT INTO `admin_menu` VALUES (52, 5, 0, 2, '菜单新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'menu:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
123 | +INSERT INTO `admin_menu` VALUES (53, 5, 0, 2, '菜单编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'menu:edit', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
124 | +INSERT INTO `admin_menu` VALUES (54, 5, 0, 2, '菜单删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'menu:del', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
125 | +INSERT INTO `admin_menu` VALUES (56, 35, 0, 2, '部门新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dept:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
126 | +INSERT INTO `admin_menu` VALUES (57, 35, 0, 2, '部门编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dept:edit', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
127 | +INSERT INTO `admin_menu` VALUES (58, 35, 0, 2, '部门删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dept:del', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
128 | +INSERT INTO `admin_menu` VALUES (60, 37, 0, 2, '岗位新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'job:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
129 | +INSERT INTO `admin_menu` VALUES (61, 37, 0, 2, '岗位编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'job:edit', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
130 | +INSERT INTO `admin_menu` VALUES (62, 37, 0, 2, '岗位删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'job:del',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
131 | +INSERT INTO `admin_menu` VALUES (64, 39, 0, 2, '字典新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dict:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
132 | +INSERT INTO `admin_menu` VALUES (65, 39, 0, 2, '字典编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dict:edit',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
133 | +INSERT INTO `admin_menu` VALUES (66, 39, 0, 2, '字典删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dict:del', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
134 | +INSERT INTO `admin_menu` VALUES (73, 28, 0, 2, '任务新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'timing:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
135 | +INSERT INTO `admin_menu` VALUES (74, 28, 0, 2, '任务编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'timing:edit', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
136 | +INSERT INTO `admin_menu` VALUES (75, 28, 0, 2, '任务删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'timing:del',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
137 | +INSERT INTO `admin_menu` VALUES (77, 18, 0, 2, '上传文件', NULL, '', 2, '', '', b'0', b'0', b'0', 'storage:add', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
138 | +INSERT INTO `admin_menu` VALUES (78, 18, 0, 2, '文件编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'storage:edit', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
139 | +INSERT INTO `admin_menu` VALUES (79, 18, 0, 2, '文件删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'storage:del', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
140 | +INSERT INTO `admin_menu` VALUES (80, 6, 0, 1, '服务监控', 'ServerMonitor', 'monitor/server/index', 14, 'codeConsole', 'server', b'0', b'0', b'0', 'monitor:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
141 | +INSERT INTO `admin_menu` VALUES (82, 36, 0, 1, '生成配置', 'GeneratorConfig', 'generator/config', 33, 'dev', 'generator/config/:tableName', b'0', b'1', b'1', '',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
142 | +INSERT INTO `admin_menu` VALUES (83, 10, 0, 1, '图表库', 'Echarts', 'components/Echarts', 50, 'chart', 'echarts', b'0', b'1', b'0', '', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
143 | +INSERT INTO `admin_menu` VALUES (90, NULL, 5, 1, '运维管理', 'Mnt', '', 20, 'mnt', 'mnt', b'0', b'0', b'0', NULL, 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
144 | +INSERT INTO `admin_menu` VALUES (92, 90, 3, 1, '服务器', 'ServerDeploy', 'mnt/server/index', 22, 'server', 'mnt/serverDeploy', b'0', b'0', b'0', 'serverDeploy:list',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
145 | +INSERT INTO `admin_menu` VALUES (93, 90, 3, 1, '应用管理', 'App', 'mnt/app/index', 23, 'app', 'mnt/app', b'0', b'0', b'0', 'app:list',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
146 | +INSERT INTO `admin_menu` VALUES (94, 90, 3, 1, '部署管理', 'Deploy', 'mnt/deploy/index', 24, 'deploy', 'mnt/deploy', b'0', b'0', b'0', 'deploy:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
147 | +INSERT INTO `admin_menu` VALUES (97, 90, 1, 1, '部署备份', 'DeployHistory', 'mnt/deployHistory/index', 25, 'backup', 'mnt/deployHistory', b'0', b'0', b'0', 'deployHistory:list', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
148 | +INSERT INTO `admin_menu` VALUES (98, 90, 3, 1, '数据库管理', 'Database', 'mnt/database/index', 26, 'database', 'mnt/database', b'0', b'0', b'0', 'database:list',10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
61 | 149 | ||
150 | +COMMIT; | ||
151 | + | ||
152 | +DROP TABLE IF EXISTS `admin_role`; | ||
62 | # 角色表 | 153 | # 角色表 |
63 | CREATE TABLE `admin_role` ( | 154 | CREATE TABLE `admin_role` ( |
64 | `id` bigint NOT NULL AUTO_INCREMENT, | 155 | `id` bigint NOT NULL AUTO_INCREMENT, |
@@ -76,26 +167,141 @@ CREATE TABLE `admin_role` ( | @@ -76,26 +167,141 @@ CREATE TABLE `admin_role` ( | ||
76 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; | 167 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; |
77 | 168 | ||
78 | 169 | ||
170 | +BEGIN; | ||
171 | +INSERT INTO `admin_role` VALUES (1, '超级管理员', 1, '-', '全部', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
172 | +INSERT INTO `admin_role` VALUES (2, '普通用户', 2, '-', '本级', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
173 | +COMMIT; | ||
174 | + | ||
175 | + | ||
176 | + | ||
177 | +DROP TABLE IF EXISTS `admin_role_dept`; | ||
79 | # 角色-部门表 | 178 | # 角色-部门表 |
80 | CREATE TABLE `admin_role_dept` ( | 179 | CREATE TABLE `admin_role_dept` ( |
81 | `id` bigint NOT NULL AUTO_INCREMENT, | 180 | `id` bigint NOT NULL AUTO_INCREMENT, |
82 | `role_id` bigint NOT NULL COMMENT '角色id', | 181 | `role_id` bigint NOT NULL COMMENT '角色id', |
83 | `dept_id` bigint NOT NULL COMMENT '部门id', | 182 | `dept_id` bigint NOT NULL COMMENT '部门id', |
84 | - UNIQUE KEY (`role_id`,`dept_id`) | 183 | + UNIQUE KEY (`role_id`,`dept_id`), |
85 | PRIMARY KEY (`id`) | 184 | PRIMARY KEY (`id`) |
86 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色-部门表'; | 185 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色-部门表'; |
87 | 186 | ||
88 | - | 187 | +DROP TABLE IF EXISTS `admin_role_menu`; |
89 | # 角色-菜单表 | 188 | # 角色-菜单表 |
90 | CREATE TABLE `admin_role_menu` ( | 189 | CREATE TABLE `admin_role_menu` ( |
91 | `id` bigint NOT NULL AUTO_INCREMENT, | 190 | `id` bigint NOT NULL AUTO_INCREMENT, |
92 | `role_id` bigint NOT NULL COMMENT '角色id', | 191 | `role_id` bigint NOT NULL COMMENT '角色id', |
93 | `menu_id` bigint NOT NULL COMMENT '菜单id', | 192 | `menu_id` bigint NOT NULL COMMENT '菜单id', |
94 | - UNIQUE KEY (`role_id`,`menu_id`) | 193 | + UNIQUE KEY (`role_id`,`menu_id`), |
95 | PRIMARY KEY (`id`) | 194 | PRIMARY KEY (`id`) |
96 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色-菜单表'; | 195 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色-菜单表'; |
97 | 196 | ||
98 | 197 | ||
198 | +BEGIN; | ||
199 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (1, 1); | ||
200 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (2, 1); | ||
201 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (3, 1); | ||
202 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (5, 1); | ||
203 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (6, 1); | ||
204 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (7, 1); | ||
205 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (9, 1); | ||
206 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (10, 1); | ||
207 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (11, 1); | ||
208 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (14, 1); | ||
209 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (15, 1); | ||
210 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (18, 1); | ||
211 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (19, 1); | ||
212 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (21, 1); | ||
213 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (22, 1); | ||
214 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (23, 1); | ||
215 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (24, 1); | ||
216 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (27, 1); | ||
217 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (28, 1); | ||
218 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (30, 1); | ||
219 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (32, 1); | ||
220 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (33, 1); | ||
221 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (34, 1); | ||
222 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (35, 1); | ||
223 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (36, 1); | ||
224 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (37, 1); | ||
225 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (38, 1); | ||
226 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (39, 1); | ||
227 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (41, 1); | ||
228 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (44, 1); | ||
229 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (45, 1); | ||
230 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (46, 1); | ||
231 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (48, 1); | ||
232 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (49, 1); | ||
233 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (50, 1); | ||
234 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (52, 1); | ||
235 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (53, 1); | ||
236 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (54, 1); | ||
237 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (56, 1); | ||
238 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (57, 1); | ||
239 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (58, 1); | ||
240 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (60, 1); | ||
241 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (61, 1); | ||
242 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (62, 1); | ||
243 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (64, 1); | ||
244 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (65, 1); | ||
245 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (66, 1); | ||
246 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (73, 1); | ||
247 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (74, 1); | ||
248 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (75, 1); | ||
249 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (77, 1); | ||
250 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (78, 1); | ||
251 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (79, 1); | ||
252 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (80, 1); | ||
253 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (82, 1); | ||
254 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (83, 1); | ||
255 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (90, 1); | ||
256 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (92, 1); | ||
257 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (93, 1); | ||
258 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (94, 1); | ||
259 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (97, 1); | ||
260 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (98, 1); | ||
261 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (102, 1); | ||
262 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (103, 1); | ||
263 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (104, 1); | ||
264 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (105, 1); | ||
265 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (106, 1); | ||
266 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (107, 1); | ||
267 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (108, 1); | ||
268 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (109, 1); | ||
269 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (110, 1); | ||
270 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (111, 1); | ||
271 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (112, 1); | ||
272 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (113, 1); | ||
273 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (114, 1); | ||
274 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (116, 1); | ||
275 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (120, 1); | ||
276 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (1, 2); | ||
277 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (2, 2); | ||
278 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (6, 2); | ||
279 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (7, 2); | ||
280 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (9, 2); | ||
281 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (10, 2); | ||
282 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (11, 2); | ||
283 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (14, 2); | ||
284 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (15, 2); | ||
285 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (19, 2); | ||
286 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (21, 2); | ||
287 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (22, 2); | ||
288 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (23, 2); | ||
289 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (24, 2); | ||
290 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (27, 2); | ||
291 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (30, 2); | ||
292 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (32, 2); | ||
293 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (33, 2); | ||
294 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (34, 2); | ||
295 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (36, 2); | ||
296 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (80, 2); | ||
297 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (82, 2); | ||
298 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (83, 2); | ||
299 | +INSERT INTO `admin_role_menu`(`role_id`,`menu_id`) VALUES (116, 2); | ||
300 | +COMMIT; | ||
301 | + | ||
302 | + | ||
303 | +DROP TABLE IF EXISTS `admin_user`; | ||
304 | + | ||
99 | # 用户表 | 305 | # 用户表 |
100 | CREATE TABLE `admin_user` ( | 306 | CREATE TABLE `admin_user` ( |
101 | `id` bigint NOT NULL AUTO_INCREMENT, | 307 | `id` bigint NOT NULL AUTO_INCREMENT, |
@@ -116,34 +322,54 @@ CREATE TABLE `admin_user` ( | @@ -116,34 +322,54 @@ CREATE TABLE `admin_user` ( | ||
116 | `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | 322 | `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', |
117 | `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | 323 | `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', |
118 | `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | 324 | `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', |
119 | - UNIQUE KEY `uniq_username` (`username`), | 325 | + UNIQUE KEY `uniq_username` (`user_name`), |
120 | UNIQUE KEY `uniq_phone` (`phone`), | 326 | UNIQUE KEY `uniq_phone` (`phone`), |
121 | UNIQUE KEY `uniq_email` (`email`), | 327 | UNIQUE KEY `uniq_email` (`email`), |
122 | PRIMARY KEY (`id`) | 328 | PRIMARY KEY (`id`) |
123 | 329 | ||
124 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表'; | 330 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表'; |
125 | 331 | ||
332 | +BEGIN; | ||
333 | +INSERT INTO `admin_user` VALUES (1, 2, 'admin', '管理员', '男', '18888888888', '201507802@qq.com', 'avatar-20200806032259161.png', '/Users/jie/Documents/work/me/admin/eladmin/~/avatar/avatar-20200806032259161.png', '$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa', b'1','2020-05-03 16:38:31', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
334 | +INSERT INTO `admin_user` VALUES (2, 2, 'test', '测试', '男', '19999999999', '231@qq.com', NULL, NULL, '$2a$10$4XcyudOYTSz6fue6KFNMHeUQnCX5jbBQypLEnGk1PmekXt5c95JcK', b'0', '2020-05-03 16:38:31', 10, '2019-03-25 09:15:32', 'admin', '2020-08-02 14:48:47','admin',NULL); | ||
335 | +COMMIT; | ||
336 | + | ||
337 | + | ||
126 | 338 | ||
339 | +DROP TABLE IF EXISTS `admin_user_job`; | ||
127 | # 用户-岗位表 | 340 | # 用户-岗位表 |
128 | CREATE TABLE `admin_user_job` ( | 341 | CREATE TABLE `admin_user_job` ( |
129 | `id` bigint NOT NULL AUTO_INCREMENT, | 342 | `id` bigint NOT NULL AUTO_INCREMENT, |
130 | `user_id` bigint(20) NOT NULL COMMENT '用户ID', | 343 | `user_id` bigint(20) NOT NULL COMMENT '用户ID', |
131 | `job_id` bigint(20) NOT NULL COMMENT '岗位ID', | 344 | `job_id` bigint(20) NOT NULL COMMENT '岗位ID', |
132 | - UNIQUE KEY (`user_id`,`job_id`) | 345 | + UNIQUE KEY (`user_id`,`job_id`), |
133 | PRIMARY KEY (`id`) | 346 | PRIMARY KEY (`id`) |
134 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户-岗位表'; | 347 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户-岗位表'; |
135 | 348 | ||
136 | 349 | ||
350 | +BEGIN; | ||
351 | +INSERT INTO `admin_user_job` VALUES (1,1, 11); | ||
352 | +INSERT INTO `admin_user_job` VALUES (2,2, 12); | ||
353 | +COMMIT; | ||
354 | + | ||
355 | + | ||
356 | +DROP TABLE IF EXISTS `admin_user_role`; | ||
137 | # 用户角色表 | 357 | # 用户角色表 |
138 | CREATE TABLE `admin_user_role` ( | 358 | CREATE TABLE `admin_user_role` ( |
139 | `id` bigint NOT NULL AUTO_INCREMENT, | 359 | `id` bigint NOT NULL AUTO_INCREMENT, |
140 | `user_id` bigint NOT NULL COMMENT '用户id', | 360 | `user_id` bigint NOT NULL COMMENT '用户id', |
141 | `role_id` bigint NOT NULL COMMENT '角色id', | 361 | `role_id` bigint NOT NULL COMMENT '角色id', |
142 | - UNIQUE KEY (`user_id`,`role_id`) | 362 | + UNIQUE KEY (`user_id`,`role_id`), |
143 | PRIMARY KEY (`id`) | 363 | PRIMARY KEY (`id`) |
144 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户角色表'; | 364 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户角色表'; |
145 | 365 | ||
146 | 366 | ||
367 | +BEGIN; | ||
368 | +INSERT INTO `admin_user_role` VALUES (1,1, 1); | ||
369 | +INSERT INTO `admin_user_role` VALUES (2,2, 2); | ||
370 | +COMMIT; | ||
371 | + | ||
372 | + | ||
147 | # 字典表 | 373 | # 字典表 |
148 | CREATE TABLE `dictionary` ( | 374 | CREATE TABLE `dictionary` ( |
149 | `id` bigint NOT NULL AUTO_INCREMENT, | 375 | `id` bigint NOT NULL AUTO_INCREMENT, |
@@ -159,4 +385,28 @@ CREATE TABLE `dictionary` ( | @@ -159,4 +385,28 @@ CREATE TABLE `dictionary` ( | ||
159 | `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | 385 | `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', |
160 | `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | 386 | `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', |
161 | PRIMARY KEY (`id`) | 387 | PRIMARY KEY (`id`) |
162 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典表'; | ||
163 | \ No newline at end of file | 388 | \ No newline at end of file |
389 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典表'; | ||
390 | + | ||
391 | +DROP TABLE IF EXISTS `sys_log`; | ||
392 | +CREATE TABLE `sys_log` ( | ||
393 | + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', | ||
394 | + `description` varchar(255) DEFAULT NULL, | ||
395 | + `log_type` varchar(10) DEFAULT NULL, | ||
396 | + `method` varchar(255) DEFAULT NULL, | ||
397 | + `params` text DEFAULT NULL, | ||
398 | + `request_ip` varchar(255) DEFAULT NULL, | ||
399 | + `time` bigint(20) DEFAULT NULL, | ||
400 | + `username` varchar(255) DEFAULT NULL, | ||
401 | + `address` varchar(255) DEFAULT NULL, | ||
402 | + `browser` varchar(255) DEFAULT NULL, | ||
403 | + `exception_detail` text DEFAULT NULL, | ||
404 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | ||
405 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | ||
406 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | ||
407 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | ||
408 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | ||
409 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | ||
410 | + PRIMARY KEY (`id`) , | ||
411 | + KEY `log_create_time_index` (`create_time`), | ||
412 | + KEY `inx_log_type` (`log_type`) | ||
413 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统日志'; | ||
164 | \ No newline at end of file | 414 | \ No newline at end of file |
src/main/java/com/order/erp/common/utils/RequestHolder.java
0 → 100644
1 | +package com.order.erp.common.utils; | ||
2 | + | ||
3 | +import org.springframework.web.context.request.RequestContextHolder; | ||
4 | +import org.springframework.web.context.request.ServletRequestAttributes; | ||
5 | + | ||
6 | +import javax.servlet.http.HttpServletRequest; | ||
7 | +import java.util.Objects; | ||
8 | + | ||
9 | +/** | ||
10 | + * 获取 HttpServletRequest | ||
11 | + * | ||
12 | + * @date 2018-11-24 | ||
13 | + */ | ||
14 | +public class RequestHolder { | ||
15 | + | ||
16 | + public static HttpServletRequest getHttpServletRequest() { | ||
17 | + return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); | ||
18 | + } | ||
19 | +} |
src/main/java/com/order/erp/common/utils/SecurityUtils.java
0 → 100644
1 | +package com.order.erp.common.utils; | ||
2 | + | ||
3 | +import cn.hutool.json.JSONObject; | ||
4 | +import com.canrd.shop.common.constant.ServerResultCode; | ||
5 | +import com.order.erp.common.exception.BusinessException; | ||
6 | +import org.springframework.security.core.context.SecurityContextHolder; | ||
7 | +import org.springframework.security.core.userdetails.UserDetails; | ||
8 | + | ||
9 | +/** | ||
10 | + * 获取当前登录的用户 | ||
11 | + * | ||
12 | + * @date 2019-01-17 | ||
13 | + */ | ||
14 | +public class SecurityUtils { | ||
15 | + | ||
16 | + public static UserDetails getUserDetails() { | ||
17 | + UserDetails userDetails; | ||
18 | + try { | ||
19 | + userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | ||
20 | + } catch (Exception e) { | ||
21 | + throw new BusinessException(ServerResultCode.PARAM_ERROR); | ||
22 | + } | ||
23 | + return userDetails; | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * 获取系统用户名称 | ||
28 | + * | ||
29 | + * @return 系统用户名称 | ||
30 | + */ | ||
31 | + public static String getUsername() { | ||
32 | + UserDetails userDetails = getUserDetails(); | ||
33 | + return userDetails.getUsername(); | ||
34 | + } | ||
35 | +} |
src/main/java/com/order/erp/config/DataScope.java
0 → 100644
1 | +package com.order.erp.config; | ||
2 | + | ||
3 | +import com.order.erp.common.utils.SecurityUtils; | ||
4 | +import com.order.erp.domain.vo.UserVO; | ||
5 | +import com.order.erp.service.admin.AdminUserService; | ||
6 | +import org.springframework.stereotype.Component; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | + | ||
10 | +/** | ||
11 | + * 数据权限配置 | ||
12 | + * | ||
13 | + * @date 2019-4-1 | ||
14 | + */ | ||
15 | +@Component | ||
16 | +public class DataScope { | ||
17 | + | ||
18 | + @Resource | ||
19 | + private AdminUserService userService; | ||
20 | + | ||
21 | + /** | ||
22 | + * @return | ||
23 | + */ | ||
24 | + public Long getLoginUserId() { | ||
25 | + UserVO user = userService.findByUserName(SecurityUtils.getUsername()); | ||
26 | + return user.getId(); | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * @return | ||
31 | + */ | ||
32 | + public UserVO getUser() { | ||
33 | + return userService.findByUserName(SecurityUtils.getUsername()); | ||
34 | + } | ||
35 | +} |
src/main/java/com/order/erp/config/ElPermissionConfig.java
0 → 100644
1 | +package com.order.erp.config; | ||
2 | + | ||
3 | +import com.order.erp.common.utils.SecurityUtils; | ||
4 | +import org.springframework.security.core.GrantedAuthority; | ||
5 | +import org.springframework.stereotype.Service; | ||
6 | + | ||
7 | +import java.util.Arrays; | ||
8 | +import java.util.List; | ||
9 | +import java.util.stream.Collectors; | ||
10 | + | ||
11 | +/** | ||
12 | + * | ||
13 | + */ | ||
14 | +@Service(value = "el") | ||
15 | +public class ElPermissionConfig { | ||
16 | + | ||
17 | + public Boolean check(String... permissions) { | ||
18 | + // 获取当前用户的所有权限 | ||
19 | + List<String> elPermissions = SecurityUtils.getUserDetails().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()); | ||
20 | + // 判断当前用户的所有权限是否包含接口上定义的权限 | ||
21 | + return elPermissions.contains("admin") || Arrays.stream(permissions).anyMatch(elPermissions::contains); | ||
22 | + } | ||
23 | +} |
src/main/java/com/order/erp/controller/LoginController.java
0 → 100644
1 | +package com.order.erp.controller; | ||
2 | + | ||
3 | +import com.order.erp.common.annotation.AnonymousAccess; | ||
4 | +import com.order.erp.common.constant.ServerResult; | ||
5 | +import com.order.erp.domain.vo.admin.*; | ||
6 | +import com.order.erp.log.Log; | ||
7 | +import com.order.erp.security.TokenProvider; | ||
8 | +import com.order.erp.security.service.OnlineUserService; | ||
9 | +import com.order.erp.service.admin.AdminUserService; | ||
10 | +import org.springframework.validation.annotation.Validated; | ||
11 | +import org.springframework.web.bind.annotation.PostMapping; | ||
12 | +import org.springframework.web.bind.annotation.RequestBody; | ||
13 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
14 | +import org.springframework.web.bind.annotation.RestController; | ||
15 | + | ||
16 | +import javax.annotation.Resource; | ||
17 | +import javax.servlet.http.HttpServletRequest; | ||
18 | + | ||
19 | + | ||
20 | +@RestController | ||
21 | +@RequestMapping("/order/erp/auth") | ||
22 | +public class LoginController { | ||
23 | + | ||
24 | + @Resource | ||
25 | + private AdminUserService userService; | ||
26 | + | ||
27 | + @Resource | ||
28 | + private OnlineUserService onlineUserService; | ||
29 | + | ||
30 | + @Resource | ||
31 | + private TokenProvider tokenProvider; | ||
32 | + | ||
33 | + /** | ||
34 | + * 手机注册 | ||
35 | + * | ||
36 | + * @param registerVO 查询条件 | ||
37 | + * @return 查询结果 | ||
38 | + */ | ||
39 | + @AnonymousAccess | ||
40 | + @PostMapping("/phone_register") | ||
41 | + public ServerResult phoneRegister(@RequestBody @Validated AdminUserRegisterVO registerVO) { | ||
42 | + return userService.phoneRegister(registerVO); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 手机登录 | ||
47 | + * | ||
48 | + * @param loginByPhoneVO 查询条件 | ||
49 | + * @return 查询结果 | ||
50 | + */ | ||
51 | + @AnonymousAccess | ||
52 | + @PostMapping("/login_by_phone") | ||
53 | + public ServerResult loginByPhone(@RequestBody @Validated AdminUserLoginByPhoneVO loginByPhoneVO) { | ||
54 | + return userService.loginByPhone(loginByPhoneVO); | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * 密码登录 | ||
59 | + * | ||
60 | + * @param loginByPwdVO 查询条件 | ||
61 | + * @return 查询结果 | ||
62 | + */ | ||
63 | + @AnonymousAccess | ||
64 | + @Log("用户登录") | ||
65 | + @PostMapping("/login_by_pwd") | ||
66 | + public ServerResult loginByPwd(@RequestBody @Validated AdminUserLoginByPwdVO loginByPwdVO) { | ||
67 | + return userService.loginByPwd(loginByPwdVO); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * 发送密码找回邮件 | ||
72 | + * | ||
73 | + * @param recoverEmailVO 查询条件 | ||
74 | + * @return 查询结果 | ||
75 | + */ | ||
76 | + @AnonymousAccess | ||
77 | + @PostMapping("/send_password_recover_mail") | ||
78 | + public ServerResult sendPasswordRecoverMail(@RequestBody @Validated AdminUserPasswordRecoverEmailVO recoverEmailVO) { | ||
79 | + return userService.sendPasswordRecoverMail(recoverEmailVO); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * 密码修改 | ||
84 | + * | ||
85 | + * @param modifyPwdVO 查询条件 | ||
86 | + * @return 查询结果 | ||
87 | + */ | ||
88 | + @AnonymousAccess | ||
89 | + @PostMapping("/password_modify") | ||
90 | + public ServerResult passwordModify(@RequestBody @Validated AdminUserModifyPwdVO modifyPwdVO) { | ||
91 | + return userService.passwordModify(modifyPwdVO); | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * 退出登录 | ||
96 | + * | ||
97 | + * @param request | ||
98 | + * @return 查询结果 | ||
99 | + */ | ||
100 | + @AnonymousAccess | ||
101 | + @PostMapping("/login_out") | ||
102 | + public ServerResult loginOut(HttpServletRequest request) { | ||
103 | + onlineUserService.logout(tokenProvider.getToken(request)); | ||
104 | + return ServerResult.success(); | ||
105 | + } | ||
106 | +} |
src/main/java/com/order/erp/controller/RoleController.java
0 → 100644
1 | +package com.order.erp.controller; | ||
2 | + | ||
3 | +import com.order.erp.common.constant.ServerResult; | ||
4 | +import com.order.erp.domain.vo.admin.AdminRoleQueryVO; | ||
5 | +import com.order.erp.domain.vo.admin.AdminRoleVO; | ||
6 | +import com.order.erp.log.Log; | ||
7 | +import com.order.erp.service.admin.AdminRoleService; | ||
8 | +import com.order.erp.service.admin.AdminUserService; | ||
9 | +import io.swagger.annotations.Api; | ||
10 | +import io.swagger.annotations.ApiOperation; | ||
11 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
12 | +import org.springframework.validation.annotation.Validated; | ||
13 | +import org.springframework.web.bind.annotation.PostMapping; | ||
14 | +import org.springframework.web.bind.annotation.RequestBody; | ||
15 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
16 | +import org.springframework.web.bind.annotation.RestController; | ||
17 | + | ||
18 | +import javax.annotation.Resource; | ||
19 | + | ||
20 | +/** | ||
21 | + * @date 2018-12-03 | ||
22 | + */ | ||
23 | +@Api(tags = "系统:角色管理") | ||
24 | +@RestController | ||
25 | +@RequestMapping("/order/erp/roles") | ||
26 | +public class RoleController { | ||
27 | + | ||
28 | + @Resource | ||
29 | + private AdminRoleService roleService; | ||
30 | + | ||
31 | + @Resource | ||
32 | + private AdminUserService userService; | ||
33 | + | ||
34 | + private static final String ENTITY_NAME = "role"; | ||
35 | + | ||
36 | + | ||
37 | + @ApiOperation("获取单个role") | ||
38 | + @PostMapping(value = "/detail") | ||
39 | + @PreAuthorize("@el.check('roles:list')") | ||
40 | + public ServerResult detail(@RequestBody @Validated AdminRoleQueryVO queryVO) { | ||
41 | + return ServerResult.success(roleService.getById(queryVO.getId())); | ||
42 | + } | ||
43 | + | ||
44 | + @ApiOperation("返回全部的角色") | ||
45 | + @PostMapping(value = "/all") | ||
46 | + @PreAuthorize("@el.check('roles:list','user:add','user:edit')") | ||
47 | + public ServerResult getAll(@RequestBody @Validated AdminRoleQueryVO queryVO) { | ||
48 | + return roleService.listByLevel(queryVO.getLevel()); | ||
49 | + } | ||
50 | + | ||
51 | + @Log("查询角色") | ||
52 | + @ApiOperation("查询角色") | ||
53 | + @PostMapping(value = "/list_by_page") | ||
54 | + @PreAuthorize("@el.check('roles:list')") | ||
55 | + public ServerResult listByPage(@RequestBody @Validated AdminRoleQueryVO queryVO) { | ||
56 | + return roleService.listByPage(queryVO); | ||
57 | + } | ||
58 | + | ||
59 | + @Log("新增角色") | ||
60 | + @ApiOperation("新增角色") | ||
61 | + @PostMapping(value = "/add") | ||
62 | + @PreAuthorize("@el.check('roles:add')") | ||
63 | + public ServerResult add(@RequestBody @Validated AdminRoleVO roleVO) { | ||
64 | + return ServerResult.success(); | ||
65 | + } | ||
66 | + | ||
67 | + @Log("修改角色") | ||
68 | + @ApiOperation("修改角色") | ||
69 | + @PostMapping(value = "/edit") | ||
70 | + @PreAuthorize("@el.check('roles:edit')") | ||
71 | + public ServerResult edit(@RequestBody @Validated AdminRoleVO roleVO) { | ||
72 | + return ServerResult.success(); | ||
73 | + } | ||
74 | + | ||
75 | + @Log("修改角色菜单") | ||
76 | + @ApiOperation("修改角色菜单") | ||
77 | + @PostMapping(value = "/edit_menu") | ||
78 | + @PreAuthorize("@el.check('roles:edit')") | ||
79 | + public ServerResult editMenu(@RequestBody @Validated AdminRoleVO roleVO) { | ||
80 | + return ServerResult.success(); | ||
81 | + } | ||
82 | + | ||
83 | + @Log("删除角色") | ||
84 | + @ApiOperation("删除角色") | ||
85 | + @PostMapping(value = "/delete") | ||
86 | + @PreAuthorize("@el.check('roles:del')") | ||
87 | + public ServerResult delete(@RequestBody @Validated AdminRoleQueryVO queryVO) { | ||
88 | + return ServerResult.success(); | ||
89 | + } | ||
90 | +} |
src/main/java/com/order/erp/controller/SysLogController.java
0 → 100644
1 | +package com.order.erp.controller; | ||
2 | + | ||
3 | +import com.order.erp.common.constant.ServerResult; | ||
4 | +import com.order.erp.domain.vo.SysLogQueryVO; | ||
5 | +import com.order.erp.domain.vo.SysLogVO; | ||
6 | +import com.order.erp.service.SysLogService; | ||
7 | +import org.springframework.validation.annotation.Validated; | ||
8 | +import org.springframework.web.bind.annotation.PostMapping; | ||
9 | +import org.springframework.web.bind.annotation.RequestBody; | ||
10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
11 | +import org.springframework.web.bind.annotation.RestController; | ||
12 | + | ||
13 | +import javax.annotation.Resource; | ||
14 | + | ||
15 | +/** | ||
16 | + * 系统日志(SysLog)表控制层 | ||
17 | + * | ||
18 | + * @author makejava | ||
19 | + * @since 2023-09-06 16:24:52 | ||
20 | + */ | ||
21 | +@RestController | ||
22 | +@RequestMapping("/order/erp/logs") | ||
23 | +public class SysLogController { | ||
24 | + /** | ||
25 | + * 服务对象 | ||
26 | + */ | ||
27 | + @Resource | ||
28 | + private SysLogService sysLogService; | ||
29 | + | ||
30 | + /** | ||
31 | + * 分页查询 | ||
32 | + * | ||
33 | + * @param sysLogQueryVO 查询条件 | ||
34 | + * @return 查询结果 | ||
35 | + */ | ||
36 | + @PostMapping("/list") | ||
37 | + public ServerResult list(@RequestBody @Validated SysLogQueryVO sysLogQueryVO) { | ||
38 | + return sysLogService.list(sysLogQueryVO); | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * 通过主键查询单条数据 | ||
43 | + * | ||
44 | + * @param sysLogQueryVO 查询条件 | ||
45 | + * @return 单条数据 | ||
46 | + */ | ||
47 | + @PostMapping("/query_by_id") | ||
48 | + public ServerResult queryById(@RequestBody SysLogQueryVO sysLogQueryVO) { | ||
49 | + return sysLogService.queryById(sysLogQueryVO); | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * 新增数据 | ||
54 | + * | ||
55 | + * @param sysLogVO 数据VO | ||
56 | + * @return 新增结果 | ||
57 | + */ | ||
58 | + @PostMapping("/add") | ||
59 | + public ServerResult add(@RequestBody SysLogVO sysLogVO) { | ||
60 | + return sysLogService.add(sysLogVO); | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * 编辑数据 | ||
65 | + * | ||
66 | + * @param sysLogVO 数据VO | ||
67 | + * @return 编辑结果 | ||
68 | + */ | ||
69 | + @PostMapping("/edit") | ||
70 | + public ServerResult edit(@RequestBody SysLogVO sysLogVO) { | ||
71 | + return sysLogService.edit(sysLogVO); | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * 删除数据 | ||
76 | + * | ||
77 | + * @param sysLogQueryVO 查询条件 | ||
78 | + * @return 删除是否成功 | ||
79 | + */ | ||
80 | + @PostMapping("/delete_by_id") | ||
81 | + public ServerResult deleteById(@RequestBody SysLogQueryVO sysLogQueryVO) { | ||
82 | + return sysLogService.deleteById(sysLogQueryVO); | ||
83 | + } | ||
84 | + | ||
85 | +} | ||
86 | + |
src/main/java/com/order/erp/domain/dto/BaseDO.java
1 | package com.order.erp.domain.dto; | 1 | package com.order.erp.domain.dto; |
2 | 2 | ||
3 | -import com.baomidou.mybatisplus.annotation.FieldFill; | ||
4 | -import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | -import com.baomidou.mybatisplus.annotation.TableLogic; | 3 | +import cn.hutool.core.date.DatePattern; |
4 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
6 | import lombok.AllArgsConstructor; | 5 | import lombok.AllArgsConstructor; |
7 | import lombok.Data; | 6 | import lombok.Data; |
8 | import lombok.NoArgsConstructor; | 7 | import lombok.NoArgsConstructor; |
9 | import lombok.experimental.SuperBuilder; | 8 | import lombok.experimental.SuperBuilder; |
10 | -import org.apache.ibatis.type.LocalDateTimeTypeHandler; | ||
11 | 9 | ||
12 | import java.io.Serializable; | 10 | import java.io.Serializable; |
13 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
@@ -18,37 +16,32 @@ import java.time.LocalDateTime; | @@ -18,37 +16,32 @@ import java.time.LocalDateTime; | ||
18 | @NoArgsConstructor | 16 | @NoArgsConstructor |
19 | @AllArgsConstructor | 17 | @AllArgsConstructor |
20 | public class BaseDO implements Serializable { | 18 | public class BaseDO implements Serializable { |
21 | - private static final long serialVersionUID = -2584005549195792084L; | ||
22 | 19 | ||
23 | /** | 20 | /** |
24 | * 创建时间 | 21 | * 创建时间 |
25 | */ | 22 | */ |
26 | - @TableField(fill = FieldFill.INSERT, typeHandler = LocalDateTimeTypeHandler.class) | 23 | + @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
27 | private LocalDateTime createTime; | 24 | private LocalDateTime createTime; |
28 | 25 | ||
29 | /** | 26 | /** |
30 | * 创建人 | 27 | * 创建人 |
31 | */ | 28 | */ |
32 | - @TableField(fill = FieldFill.INSERT) | ||
33 | private String createBy; | 29 | private String createBy; |
34 | 30 | ||
35 | /** | 31 | /** |
36 | * 修改时间 | 32 | * 修改时间 |
37 | */ | 33 | */ |
38 | - @TableField(fill = FieldFill.INSERT_UPDATE, typeHandler = LocalDateTimeTypeHandler.class) | 34 | + @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
39 | private LocalDateTime modifyTime; | 35 | private LocalDateTime modifyTime; |
40 | 36 | ||
41 | /** | 37 | /** |
42 | * 修改人 | 38 | * 修改人 |
43 | */ | 39 | */ |
44 | - @TableField(fill = FieldFill.INSERT_UPDATE) | ||
45 | private String modifyBy; | 40 | private String modifyBy; |
46 | 41 | ||
47 | /** | 42 | /** |
48 | * 是否可用 10-可用 20-删除 30-禁用 | 43 | * 是否可用 10-可用 20-删除 30-禁用 |
49 | */ | 44 | */ |
50 | - @TableLogic | ||
51 | - @TableField(fill = FieldFill.INSERT) | ||
52 | private Integer enableFlag; | 45 | private Integer enableFlag; |
53 | 46 | ||
54 | /** | 47 | /** |
src/main/java/com/order/erp/domain/dto/SysLogDO.java
0 → 100644
1 | +package com.order.erp.domain.dto; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
4 | +import lombok.*; | ||
5 | +import lombok.experimental.SuperBuilder; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | + | ||
9 | +/** | ||
10 | + * 系统日志(SysLog)实体类 | ||
11 | + * | ||
12 | + * @author makejava | ||
13 | + * @since 2023-09-06 16:22:34 | ||
14 | + */ | ||
15 | +@TableName("sys_log") | ||
16 | +@Data | ||
17 | +@AllArgsConstructor | ||
18 | +@ToString | ||
19 | +@NoArgsConstructor | ||
20 | +@EqualsAndHashCode(callSuper = false) | ||
21 | +@SuperBuilder | ||
22 | +public class SysLogDO extends BaseDO implements Serializable { | ||
23 | + /** | ||
24 | + * ID | ||
25 | + */ | ||
26 | + private Long id; | ||
27 | + | ||
28 | + private String description; | ||
29 | + | ||
30 | + private String logType; | ||
31 | + | ||
32 | + private String method; | ||
33 | + | ||
34 | + private String params; | ||
35 | + | ||
36 | + private String requestIp; | ||
37 | + | ||
38 | + private Long time; | ||
39 | + | ||
40 | + private String username; | ||
41 | + | ||
42 | + private String address; | ||
43 | + | ||
44 | + private String browser; | ||
45 | + | ||
46 | + private String exceptionDetail; | ||
47 | + | ||
48 | +} |
src/main/java/com/order/erp/domain/dto/admin/AdminUserDO.java
@@ -81,7 +81,6 @@ public class AdminUserDO extends BaseDO implements Serializable { | @@ -81,7 +81,6 @@ public class AdminUserDO extends BaseDO implements Serializable { | ||
81 | /** | 81 | /** |
82 | * 修改密码的时间 | 82 | * 修改密码的时间 |
83 | */ | 83 | */ |
84 | - @TableField(fill = FieldFill.INSERT_UPDATE, typeHandler = LocalDateTimeTypeHandler.class) | ||
85 | - private LocalDateTime passResetTime; | 84 | + private LocalDateTime pwdResetTime; |
86 | 85 | ||
87 | } | 86 | } |
src/main/java/com/order/erp/domain/vo/SysLogQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo; | ||
2 | + | ||
3 | +import lombok.*; | ||
4 | +import lombok.experimental.SuperBuilder; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * 系统日志(SysLog)实体类 | ||
11 | + * | ||
12 | + * @author makejava | ||
13 | + * @since 2023-09-06 16:24:52 | ||
14 | + */ | ||
15 | +@Data | ||
16 | +@AllArgsConstructor | ||
17 | +@ToString | ||
18 | +@NoArgsConstructor | ||
19 | +@EqualsAndHashCode(callSuper = false) | ||
20 | +@SuperBuilder | ||
21 | +public class SysLogQueryVO extends BasePageVO implements Serializable { | ||
22 | + private static final long serialVersionUID = -14754920802833616L; | ||
23 | + | ||
24 | + private List<Long> ids; | ||
25 | + | ||
26 | + /** | ||
27 | + * ID | ||
28 | + */ | ||
29 | + private Long id; | ||
30 | + | ||
31 | + private String description; | ||
32 | + | ||
33 | + private String logType; | ||
34 | + | ||
35 | + private String method; | ||
36 | + | ||
37 | + private String params; | ||
38 | + | ||
39 | + private String requestIp; | ||
40 | + | ||
41 | + private Long time; | ||
42 | + | ||
43 | + private String username; | ||
44 | + | ||
45 | + private String address; | ||
46 | + | ||
47 | + private String browser; | ||
48 | + | ||
49 | + private String exceptionDetail; | ||
50 | + | ||
51 | + | ||
52 | +} | ||
53 | + |
src/main/java/com/order/erp/domain/vo/SysLogVO.java
0 → 100644
1 | +package com.order.erp.domain.vo; | ||
2 | + | ||
3 | +import lombok.*; | ||
4 | +import lombok.experimental.SuperBuilder; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | + | ||
8 | +/** | ||
9 | + * 系统日志(SysLog)实体类 | ||
10 | + * | ||
11 | + * @author makejava | ||
12 | + * @since 2023-09-06 16:24:51 | ||
13 | + */ | ||
14 | +@Data | ||
15 | +@AllArgsConstructor | ||
16 | +@ToString | ||
17 | +@NoArgsConstructor | ||
18 | +@EqualsAndHashCode(callSuper = false) | ||
19 | +@SuperBuilder | ||
20 | +public class SysLogVO implements Serializable { | ||
21 | + private static final long serialVersionUID = -31035692987156236L; | ||
22 | + /** | ||
23 | + * ID | ||
24 | + */ | ||
25 | + private Long id; | ||
26 | + | ||
27 | + private String description; | ||
28 | + | ||
29 | + private String logType; | ||
30 | + | ||
31 | + private String method; | ||
32 | + | ||
33 | + private String params; | ||
34 | + | ||
35 | + private String requestIp; | ||
36 | + | ||
37 | + private Long time; | ||
38 | + | ||
39 | + private String username; | ||
40 | + | ||
41 | + private String address; | ||
42 | + | ||
43 | + private String browser; | ||
44 | + | ||
45 | + private String exceptionDetail; | ||
46 | + | ||
47 | + | ||
48 | +} |
src/main/java/com/order/erp/domain/vo/UserVO.java
@@ -19,29 +19,41 @@ public class UserVO implements Serializable { | @@ -19,29 +19,41 @@ public class UserVO implements Serializable { | ||
19 | @ApiModelProperty(hidden = true) | 19 | @ApiModelProperty(hidden = true) |
20 | private Long id; | 20 | private Long id; |
21 | 21 | ||
22 | - private String username; | 22 | + private String userName; |
23 | 23 | ||
24 | private String nickName; | 24 | private String nickName; |
25 | 25 | ||
26 | - private String sex; | 26 | + /** |
27 | + * 性别 | ||
28 | + */ | ||
29 | + private String gender; | ||
27 | 30 | ||
28 | - private String avatar; | 31 | + /** |
32 | + * 手机号码 | ||
33 | + */ | ||
34 | + private String phone; | ||
29 | 35 | ||
36 | + /** | ||
37 | + * 邮箱 | ||
38 | + */ | ||
30 | private String email; | 39 | private String email; |
31 | 40 | ||
32 | - private String phone; | 41 | + /** |
42 | + * 头像地址 | ||
43 | + */ | ||
44 | + private String avatarName; | ||
33 | 45 | ||
34 | /** | 46 | /** |
35 | - * 工作性质 | 47 | + * 头像真实路径 |
36 | */ | 48 | */ |
37 | - private String workerType; | 49 | + private String avatarPath; |
38 | 50 | ||
39 | private Boolean enabled; | 51 | private Boolean enabled; |
40 | 52 | ||
41 | @JsonIgnore | 53 | @JsonIgnore |
42 | private String password; | 54 | private String password; |
43 | 55 | ||
44 | - private Date lastPasswordResetTime; | 56 | + private LocalDateTime pwdResetTime; |
45 | 57 | ||
46 | @ApiModelProperty(hidden = true) | 58 | @ApiModelProperty(hidden = true) |
47 | private Set<RoleSmallVO> roles; | 59 | private Set<RoleSmallVO> roles; |
src/main/java/com/order/erp/domain/vo/admin/AdminRoleResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import cn.hutool.core.date.DatePattern; | ||
4 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
5 | +import lombok.*; | ||
6 | +import lombok.experimental.SuperBuilder; | ||
7 | + | ||
8 | +import java.io.Serializable; | ||
9 | +import java.time.LocalDateTime; | ||
10 | + | ||
11 | +/** | ||
12 | + * 角色表(AdminRole)实体类 | ||
13 | + * | ||
14 | + * @author makejava | ||
15 | + * @since 2023-08-30 17:51:48 | ||
16 | + */ | ||
17 | +@Data | ||
18 | +@AllArgsConstructor | ||
19 | +@ToString | ||
20 | +@NoArgsConstructor | ||
21 | +@EqualsAndHashCode(callSuper = false) | ||
22 | +@SuperBuilder | ||
23 | +public class AdminRoleResultVO implements Serializable { | ||
24 | + | ||
25 | + private Long id; | ||
26 | + /** | ||
27 | + * 角色名称 | ||
28 | + */ | ||
29 | + private String name; | ||
30 | + /** | ||
31 | + * 备注 | ||
32 | + */ | ||
33 | + private String remark; | ||
34 | + /** | ||
35 | + * 权限 | ||
36 | + */ | ||
37 | + private String permission; | ||
38 | + /** | ||
39 | + * 数据权限类型 全部 、 本级 、 自定义 | ||
40 | + */ | ||
41 | + private String dataScope; | ||
42 | + /** | ||
43 | + * 数值越小,级别越大 | ||
44 | + */ | ||
45 | + private Integer level; | ||
46 | + | ||
47 | + /** | ||
48 | + * 创建时间 | ||
49 | + */ | ||
50 | + @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) | ||
51 | + private LocalDateTime createTime; | ||
52 | + | ||
53 | + /** | ||
54 | + * 创建人 | ||
55 | + */ | ||
56 | + private String createBy; | ||
57 | + | ||
58 | + /** | ||
59 | + * 修改时间 | ||
60 | + */ | ||
61 | + @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) | ||
62 | + private LocalDateTime modifyTime; | ||
63 | + | ||
64 | + /** | ||
65 | + * 修改人 | ||
66 | + */ | ||
67 | + private String modifyBy; | ||
68 | + | ||
69 | +} |
src/main/java/com/order/erp/domain/vo/admin/AdminUserLoginByPhoneVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.order.erp.common.constant.Constant; | ||
4 | +import com.order.erp.domain.vo.BasePageVO; | ||
5 | +import lombok.*; | ||
6 | +import lombok.experimental.SuperBuilder; | ||
7 | + | ||
8 | +import javax.validation.constraints.NotBlank; | ||
9 | +import javax.validation.constraints.Pattern; | ||
10 | +import java.io.Serializable; | ||
11 | + | ||
12 | +/** | ||
13 | + * (Member)登录 | ||
14 | + * | ||
15 | + * @author makejava | ||
16 | + * @since 2023-08-22 17:02:39 | ||
17 | + */ | ||
18 | +@Data | ||
19 | +@AllArgsConstructor | ||
20 | +@ToString | ||
21 | +@NoArgsConstructor | ||
22 | +@EqualsAndHashCode(callSuper = false) | ||
23 | +@SuperBuilder | ||
24 | +public class AdminUserLoginByPhoneVO extends BasePageVO implements Serializable { | ||
25 | + | ||
26 | + /** | ||
27 | + * 手机号码 | ||
28 | + */ | ||
29 | + @NotBlank(message = "手机号码不能为空!") | ||
30 | + @Pattern(message = "手机号码格式不正确", regexp = Constant.PHONE_REGEXP) | ||
31 | + private String phone; | ||
32 | + | ||
33 | + /** | ||
34 | + * 手机验证码 | ||
35 | + */ | ||
36 | + @NotBlank(message = "手机验证码不能为空!") | ||
37 | + private String smsCaptchaCode; | ||
38 | +} | ||
39 | + |
src/main/java/com/order/erp/domain/vo/admin/AdminUserLoginByPwdVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.order.erp.domain.vo.BasePageVO; | ||
4 | +import lombok.*; | ||
5 | +import lombok.experimental.SuperBuilder; | ||
6 | + | ||
7 | +import javax.validation.constraints.NotBlank; | ||
8 | +import java.io.Serializable; | ||
9 | + | ||
10 | +/** | ||
11 | + * (Member)登录 | ||
12 | + * | ||
13 | + * @author makejava | ||
14 | + * @since 2023-08-22 17:02:39 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@AllArgsConstructor | ||
18 | +@ToString | ||
19 | +@NoArgsConstructor | ||
20 | +@EqualsAndHashCode(callSuper = false) | ||
21 | +@SuperBuilder | ||
22 | +public class AdminUserLoginByPwdVO extends BasePageVO implements Serializable { | ||
23 | + | ||
24 | + /** | ||
25 | + * 用户登录名称 | ||
26 | + */ | ||
27 | + @NotBlank(message = "用户登录名称不能为空!") | ||
28 | + private String userName; | ||
29 | + | ||
30 | + /** | ||
31 | + * 密码 | ||
32 | + */ | ||
33 | + @NotBlank(message = "密码不能为空!") | ||
34 | + private String password; | ||
35 | + | ||
36 | + | ||
37 | + /** | ||
38 | + * 图片验证码 | ||
39 | + */ | ||
40 | + @NotBlank(message = "图片验证码不能为空!") | ||
41 | + private String imgCaptchaCode; | ||
42 | + | ||
43 | + /** | ||
44 | + * 图片验证码标识 | ||
45 | + */ | ||
46 | + @NotBlank(message = "图片验证码标识不能为空!") | ||
47 | + private String imgCaptchaUuid; | ||
48 | +} | ||
49 | + |
src/main/java/com/order/erp/domain/vo/admin/AdminUserModifyPwdVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.order.erp.domain.vo.BasePageVO; | ||
4 | +import lombok.*; | ||
5 | +import lombok.experimental.SuperBuilder; | ||
6 | + | ||
7 | +import javax.validation.constraints.NotBlank; | ||
8 | +import java.io.Serializable; | ||
9 | + | ||
10 | +/** | ||
11 | + * (Member)修改密码 | ||
12 | + * | ||
13 | + * @author xms | ||
14 | + * @since 2023-08-22 17:02:39 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@AllArgsConstructor | ||
18 | +@ToString | ||
19 | +@NoArgsConstructor | ||
20 | +@EqualsAndHashCode(callSuper = false) | ||
21 | +@SuperBuilder | ||
22 | +public class AdminUserModifyPwdVO extends BasePageVO implements Serializable { | ||
23 | + | ||
24 | + /** | ||
25 | + * 密钥id | ||
26 | + */ | ||
27 | + @NotBlank(message = "密钥id不存在!") | ||
28 | + private String id; | ||
29 | + | ||
30 | + /** | ||
31 | + * 密钥密码 | ||
32 | + */ | ||
33 | + @NotBlank(message = "密钥密码不能为空") | ||
34 | + private String passwordRecoverKey; | ||
35 | + | ||
36 | + /** | ||
37 | + * 密码 | ||
38 | + */ | ||
39 | + @NotBlank(message = "要修改的密码不能为空") | ||
40 | + private String password; | ||
41 | + | ||
42 | + /** | ||
43 | + * 确认密码 | ||
44 | + */ | ||
45 | + @NotBlank(message = "请二次确认要修改的密码") | ||
46 | + private String confirmPassword; | ||
47 | +} | ||
48 | + |
src/main/java/com/order/erp/domain/vo/admin/AdminUserPasswordRecoverEmailVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.order.erp.domain.vo.BasePageVO; | ||
4 | +import lombok.*; | ||
5 | +import lombok.experimental.SuperBuilder; | ||
6 | + | ||
7 | +import javax.validation.constraints.NotBlank; | ||
8 | +import java.io.Serializable; | ||
9 | + | ||
10 | +/** | ||
11 | + * (Member)发送密码找回邮件 | ||
12 | + * | ||
13 | + * @author makejava | ||
14 | + * @since 2023-08-22 17:02:39 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@AllArgsConstructor | ||
18 | +@ToString | ||
19 | +@NoArgsConstructor | ||
20 | +@EqualsAndHashCode(callSuper = false) | ||
21 | +@SuperBuilder | ||
22 | +public class AdminUserPasswordRecoverEmailVO extends BasePageVO implements Serializable { | ||
23 | + | ||
24 | + /** | ||
25 | + * 用户登录名称 | ||
26 | + */ | ||
27 | + @NotBlank(message = "用户登录名称不能为空!") | ||
28 | + private String userName; | ||
29 | +} | ||
30 | + |
src/main/java/com/order/erp/domain/vo/admin/AdminUserRegisterVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.order.erp.common.constant.Constant; | ||
4 | +import com.order.erp.domain.vo.BasePageVO; | ||
5 | +import lombok.*; | ||
6 | +import lombok.experimental.SuperBuilder; | ||
7 | + | ||
8 | +import javax.validation.constraints.NotBlank; | ||
9 | +import javax.validation.constraints.NotNull; | ||
10 | +import javax.validation.constraints.Pattern; | ||
11 | +import java.io.Serializable; | ||
12 | + | ||
13 | +/** | ||
14 | + * (Member)注册 | ||
15 | + * | ||
16 | + * @author makejava | ||
17 | + * @since 2023-08-22 17:02:39 | ||
18 | + */ | ||
19 | +@Data | ||
20 | +@AllArgsConstructor | ||
21 | +@ToString | ||
22 | +@NoArgsConstructor | ||
23 | +@EqualsAndHashCode(callSuper = false) | ||
24 | +@SuperBuilder | ||
25 | +public class AdminUserRegisterVO extends BasePageVO implements Serializable { | ||
26 | + private static final long serialVersionUID = -98570856671998407L; | ||
27 | + | ||
28 | + /** | ||
29 | + * 注册协议,true/false | ||
30 | + */ | ||
31 | + @NotNull(message = "必须勾选协议!") | ||
32 | + private Boolean isAgreeAgreement; | ||
33 | + | ||
34 | + /** | ||
35 | + * 手机号码 | ||
36 | + */ | ||
37 | + @NotBlank(message = "手机号码不能为空!") | ||
38 | + @Pattern(message = "手机号码格式不正确", regexp = Constant.PHONE_REGEXP) | ||
39 | + private String phone; | ||
40 | + | ||
41 | + /** | ||
42 | + * 手机验证码 | ||
43 | + */ | ||
44 | + @NotBlank(message = "手机验证码不能为空!") | ||
45 | + private String smsCaptchaCode; | ||
46 | + | ||
47 | + /** | ||
48 | + * 用户名称 | ||
49 | + */ | ||
50 | + @NotBlank(message = "用户名称不能为空!") | ||
51 | + private String userName; | ||
52 | + | ||
53 | + /** | ||
54 | |||
55 | + */ | ||
56 | + @NotBlank(message = "email不能为空!") | ||
57 | + private String email; | ||
58 | + | ||
59 | + /** | ||
60 | + * 密码 | ||
61 | + */ | ||
62 | + @NotBlank(message = "请设置密码!") | ||
63 | + private String password; | ||
64 | + | ||
65 | + /** | ||
66 | + * 确认密码 | ||
67 | + */ | ||
68 | + @NotBlank(message = "请二次确认密码!") | ||
69 | + private String confirmPassword; | ||
70 | + | ||
71 | + /** | ||
72 | + * 安全问题 | ||
73 | + */ | ||
74 | + private String safeQuestion; | ||
75 | + | ||
76 | + /** | ||
77 | + * 安全问题回答 | ||
78 | + */ | ||
79 | + private String safeAnswer; | ||
80 | + | ||
81 | +} | ||
82 | + |
src/main/java/com/order/erp/domain/vo/admin/DeptSmallVO.java
1 | package com.order.erp.domain.vo.admin; | 1 | package com.order.erp.domain.vo.admin; |
2 | 2 | ||
3 | -import lombok.Data; | 3 | +import lombok.*; |
4 | +import lombok.experimental.SuperBuilder; | ||
4 | 5 | ||
5 | import java.io.Serializable; | 6 | import java.io.Serializable; |
6 | 7 | ||
7 | 8 | ||
8 | @Data | 9 | @Data |
10 | +@AllArgsConstructor | ||
11 | +@ToString | ||
12 | +@NoArgsConstructor | ||
13 | +@EqualsAndHashCode(callSuper = false) | ||
14 | +@SuperBuilder | ||
9 | public class DeptSmallVO implements Serializable { | 15 | public class DeptSmallVO implements Serializable { |
10 | 16 | ||
11 | private Long id; | 17 | private Long id; |
src/main/java/com/order/erp/domain/vo/admin/JobSmallVO.java
1 | package com.order.erp.domain.vo.admin; | 1 | package com.order.erp.domain.vo.admin; |
2 | 2 | ||
3 | -import lombok.Data; | ||
4 | -import lombok.NoArgsConstructor; | 3 | +import lombok.*; |
4 | +import lombok.experimental.SuperBuilder; | ||
5 | 5 | ||
6 | import java.io.Serializable; | 6 | import java.io.Serializable; |
7 | 7 | ||
8 | 8 | ||
9 | @Data | 9 | @Data |
10 | +@AllArgsConstructor | ||
11 | +@ToString | ||
10 | @NoArgsConstructor | 12 | @NoArgsConstructor |
13 | +@EqualsAndHashCode(callSuper = false) | ||
14 | +@SuperBuilder | ||
11 | public class JobSmallVO implements Serializable { | 15 | public class JobSmallVO implements Serializable { |
12 | 16 | ||
13 | private Long id; | 17 | private Long id; |
src/main/java/com/order/erp/domain/vo/admin/MemberQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.order.erp.domain.vo.BasePageVO; | ||
4 | +import lombok.*; | ||
5 | +import lombok.experimental.SuperBuilder; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | +import java.util.Date; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * (Member)实体类 | ||
13 | + * | ||
14 | + * @author makejava | ||
15 | + * @since 2023-08-22 17:02:39 | ||
16 | + */ | ||
17 | +@Data | ||
18 | +@AllArgsConstructor | ||
19 | +@ToString | ||
20 | +@NoArgsConstructor | ||
21 | +@EqualsAndHashCode(callSuper = false) | ||
22 | +@SuperBuilder | ||
23 | +public class MemberQueryVO extends BasePageVO implements Serializable { | ||
24 | + private static final long serialVersionUID = -98570856671998407L; | ||
25 | + | ||
26 | + private List<Long> ids; | ||
27 | + | ||
28 | + | ||
29 | + private String id; | ||
30 | + | ||
31 | + private Date createdate; | ||
32 | + | ||
33 | + private Date modifydate; | ||
34 | + | ||
35 | + private Double deposit; | ||
36 | + | ||
37 | + private String email; | ||
38 | + | ||
39 | + private String phone; | ||
40 | + | ||
41 | + private String research; | ||
42 | + | ||
43 | + private Byte isaccountenabled; | ||
44 | + | ||
45 | + private Byte isaccountlocked; | ||
46 | + | ||
47 | + private Date lockeddate; | ||
48 | + | ||
49 | + private Date logindate; | ||
50 | + | ||
51 | + private Integer loginfailurecount; | ||
52 | + | ||
53 | + private String loginip; | ||
54 | + | ||
55 | + private String password; | ||
56 | + | ||
57 | + private String passwordrecoverkey; | ||
58 | + | ||
59 | + private Integer point; | ||
60 | + | ||
61 | + private String registerip; | ||
62 | + | ||
63 | + private String safeanswer; | ||
64 | + | ||
65 | + private String safequestion; | ||
66 | + | ||
67 | + private String username; | ||
68 | + | ||
69 | + private String memberrankId; | ||
70 | + | ||
71 | + | ||
72 | +} | ||
73 | + |
src/main/java/com/order/erp/domain/vo/admin/MemberUserVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
4 | +import lombok.*; | ||
5 | +import lombok.experimental.SuperBuilder; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | +import java.util.Date; | ||
9 | + | ||
10 | +/** | ||
11 | + * (Member)实体类 | ||
12 | + * | ||
13 | + * @author makejava | ||
14 | + * @since 2023-08-22 17:02:38 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@AllArgsConstructor | ||
18 | +@ToString | ||
19 | +@NoArgsConstructor | ||
20 | +@EqualsAndHashCode(callSuper = false) | ||
21 | +@SuperBuilder | ||
22 | +public class MemberUserVO implements Serializable { | ||
23 | + private static final long serialVersionUID = 705600886314888547L; | ||
24 | + | ||
25 | + private String id; | ||
26 | + | ||
27 | + private Date createdate; | ||
28 | + | ||
29 | + private Date modifydate; | ||
30 | + | ||
31 | + private Double deposit; | ||
32 | + | ||
33 | + private String email; | ||
34 | + | ||
35 | + private String phone; | ||
36 | + | ||
37 | + private String research; | ||
38 | + | ||
39 | + private Boolean isaccountenabled; | ||
40 | + | ||
41 | + private Boolean isaccountlocked; | ||
42 | + | ||
43 | + private Date lockeddate; | ||
44 | + | ||
45 | + private Date logindate; | ||
46 | + | ||
47 | + private Integer loginfailurecount; | ||
48 | + | ||
49 | + private String loginip; | ||
50 | + | ||
51 | + /** | ||
52 | + * 密码 | ||
53 | + */ | ||
54 | + @JsonIgnore | ||
55 | + private String password; | ||
56 | + | ||
57 | + private String passwordrecoverkey; | ||
58 | + | ||
59 | + private Integer point; | ||
60 | + | ||
61 | + private String registerip; | ||
62 | + | ||
63 | + private String safeanswer; | ||
64 | + | ||
65 | + private String safequestion; | ||
66 | + | ||
67 | + private String username; | ||
68 | + | ||
69 | + private String memberrankId; | ||
70 | + | ||
71 | + | ||
72 | +} |
src/main/java/com/order/erp/domain/vo/admin/MemberVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.admin; | ||
2 | + | ||
3 | +import lombok.*; | ||
4 | +import lombok.experimental.SuperBuilder; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.Date; | ||
8 | + | ||
9 | +/** | ||
10 | + * (Member)实体类 | ||
11 | + * | ||
12 | + * @author makejava | ||
13 | + * @since 2023-08-22 17:02:38 | ||
14 | + */ | ||
15 | +@Data | ||
16 | +@AllArgsConstructor | ||
17 | +@ToString | ||
18 | +@NoArgsConstructor | ||
19 | +@EqualsAndHashCode(callSuper = false) | ||
20 | +@SuperBuilder | ||
21 | +public class MemberVO implements Serializable { | ||
22 | + private static final long serialVersionUID = 705600886314888547L; | ||
23 | + | ||
24 | + private String id; | ||
25 | + | ||
26 | + private Date createdate; | ||
27 | + | ||
28 | + private Date modifydate; | ||
29 | + | ||
30 | + private Double deposit; | ||
31 | + | ||
32 | + private String email; | ||
33 | + | ||
34 | + private String phone; | ||
35 | + | ||
36 | + private String research; | ||
37 | + | ||
38 | + private Byte isaccountenabled; | ||
39 | + | ||
40 | + private Byte isaccountlocked; | ||
41 | + | ||
42 | + private Date lockeddate; | ||
43 | + | ||
44 | + private Date logindate; | ||
45 | + | ||
46 | + private Integer loginfailurecount; | ||
47 | + | ||
48 | + private String loginip; | ||
49 | + | ||
50 | + private String password; | ||
51 | + | ||
52 | + private String passwordrecoverkey; | ||
53 | + | ||
54 | + private Integer point; | ||
55 | + | ||
56 | + private String registerip; | ||
57 | + | ||
58 | + private String safeanswer; | ||
59 | + | ||
60 | + private String safequestion; | ||
61 | + | ||
62 | + private String username; | ||
63 | + | ||
64 | + private String memberrankId; | ||
65 | + | ||
66 | + | ||
67 | +} |
src/main/java/com/order/erp/domain/vo/admin/RoleSmallVO.java
1 | package com.order.erp.domain.vo.admin; | 1 | package com.order.erp.domain.vo.admin; |
2 | 2 | ||
3 | -import lombok.Data; | 3 | +import lombok.*; |
4 | +import lombok.experimental.SuperBuilder; | ||
4 | 5 | ||
5 | import java.io.Serializable; | 6 | import java.io.Serializable; |
6 | 7 | ||
7 | 8 | ||
8 | @Data | 9 | @Data |
10 | +@AllArgsConstructor | ||
11 | +@ToString | ||
12 | +@NoArgsConstructor | ||
13 | +@EqualsAndHashCode(callSuper = false) | ||
14 | +@SuperBuilder | ||
9 | public class RoleSmallVO implements Serializable { | 15 | public class RoleSmallVO implements Serializable { |
10 | 16 | ||
11 | private Long id; | 17 | private Long id; |
src/main/java/com/order/erp/log/Log.java
0 → 100644
1 | +package com.order.erp.log; | ||
2 | + | ||
3 | +import java.lang.annotation.ElementType; | ||
4 | +import java.lang.annotation.Retention; | ||
5 | +import java.lang.annotation.RetentionPolicy; | ||
6 | +import java.lang.annotation.Target; | ||
7 | + | ||
8 | +/** | ||
9 | + * | ||
10 | + * @date 2018-11-24 | ||
11 | + */ | ||
12 | +@Target(ElementType.METHOD) | ||
13 | +@Retention(RetentionPolicy.RUNTIME) | ||
14 | +public @interface Log { | ||
15 | + String value() default ""; | ||
16 | +} |
src/main/java/com/order/erp/log/LogAspect.java
0 → 100644
1 | +package com.order.erp.log; | ||
2 | + | ||
3 | +import cn.hutool.json.JSONObject; | ||
4 | +import com.baomidou.mybatisplus.core.toolkit.StringUtils; | ||
5 | +import com.order.erp.common.constant.Constant; | ||
6 | +import com.order.erp.common.utils.RequestHolder; | ||
7 | +import com.order.erp.common.utils.RequestStringUtils; | ||
8 | +import com.order.erp.common.utils.SecurityUtils; | ||
9 | +import com.order.erp.common.utils.ThrowableUtil; | ||
10 | +import com.order.erp.domain.dto.SysLogDO; | ||
11 | +import com.order.erp.service.SysLogService; | ||
12 | +import lombok.extern.slf4j.Slf4j; | ||
13 | +import org.aspectj.lang.JoinPoint; | ||
14 | +import org.aspectj.lang.ProceedingJoinPoint; | ||
15 | +import org.aspectj.lang.annotation.AfterThrowing; | ||
16 | +import org.aspectj.lang.annotation.Around; | ||
17 | +import org.aspectj.lang.annotation.Aspect; | ||
18 | +import org.aspectj.lang.annotation.Pointcut; | ||
19 | +import org.aspectj.lang.reflect.MethodSignature; | ||
20 | +import org.springframework.stereotype.Component; | ||
21 | + | ||
22 | +import javax.annotation.Resource; | ||
23 | +import javax.servlet.http.HttpServletRequest; | ||
24 | +import java.lang.reflect.Method; | ||
25 | +import java.time.LocalDateTime; | ||
26 | + | ||
27 | +/** | ||
28 | + * @date 2018-11-24 | ||
29 | + */ | ||
30 | +@Component | ||
31 | +@Aspect | ||
32 | +@Slf4j | ||
33 | +public class LogAspect { | ||
34 | + | ||
35 | + @Resource | ||
36 | + private SysLogService logService; | ||
37 | + | ||
38 | + ThreadLocal<Long> currentTime = new ThreadLocal<>(); | ||
39 | + | ||
40 | + /** | ||
41 | + * 配置切入点 | ||
42 | + */ | ||
43 | + @Pointcut("@annotation(com.order.erp.log.Log)") | ||
44 | + public void logPointcut() { | ||
45 | + // 该方法无方法体,主要为了让同类中其他方法使用此切入点 | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 配置环绕通知,使用在方法logPointcut()上注册的切入点 | ||
50 | + * | ||
51 | + * @param joinPoint join point for advice | ||
52 | + */ | ||
53 | + @Around("logPointcut()") | ||
54 | + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { | ||
55 | + Object result; | ||
56 | + currentTime.set(System.currentTimeMillis()); | ||
57 | + result = joinPoint.proceed(); | ||
58 | + logService.save(wrapperLog(joinPoint)); | ||
59 | + currentTime.remove(); | ||
60 | + return result; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * @param joinPoint | ||
65 | + * @return | ||
66 | + */ | ||
67 | + private SysLogDO wrapperLog(ProceedingJoinPoint joinPoint) { | ||
68 | + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); | ||
69 | + Method method = signature.getMethod(); | ||
70 | + Log aopLog = method.getAnnotation(Log.class); | ||
71 | + | ||
72 | + // 方法路径 | ||
73 | + String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()"; | ||
74 | + | ||
75 | + StringBuilder params = new StringBuilder("{"); | ||
76 | + //参数值 | ||
77 | + Object[] argValues = joinPoint.getArgs(); | ||
78 | + //参数名称 | ||
79 | + String[] argNames = ((MethodSignature) joinPoint.getSignature()).getParameterNames(); | ||
80 | + if (argValues != null) { | ||
81 | + for (int i = 0; i < argValues.length; i++) { | ||
82 | + params.append(" ").append(argNames[i]).append(": ").append(argValues[i]); | ||
83 | + } | ||
84 | + } | ||
85 | + HttpServletRequest request = RequestHolder.getHttpServletRequest(); | ||
86 | + SysLogDO sysLogDO = SysLogDO.builder() | ||
87 | + .logType("INFO") | ||
88 | + .time(System.currentTimeMillis() - currentTime.get()) | ||
89 | + .browser(RequestStringUtils.getBrowser(request)) | ||
90 | + .requestIp(RequestStringUtils.getIp(request)) | ||
91 | + .build(); | ||
92 | + // 描述 | ||
93 | + if (sysLogDO != null) { | ||
94 | + sysLogDO.setDescription(aopLog.value()); | ||
95 | + } | ||
96 | + assert sysLogDO != null; | ||
97 | + | ||
98 | + String loginPath = "login"; | ||
99 | + String userName = null; | ||
100 | + if (loginPath.equals(signature.getName())) { | ||
101 | + try { | ||
102 | + assert argValues != null; | ||
103 | + userName = new JSONObject(argValues[0]).get("userName").toString(); | ||
104 | + } catch (Exception e) { | ||
105 | + e.printStackTrace(); | ||
106 | + } | ||
107 | + } else { | ||
108 | + userName = getUsername(); | ||
109 | + } | ||
110 | + if (StringUtils.isBlank(userName)) { | ||
111 | + sysLogDO.setCreateTime(LocalDateTime.now()); | ||
112 | + sysLogDO.setCreateBy("system"); | ||
113 | + } else { | ||
114 | + sysLogDO.setCreateTime(LocalDateTime.now()); | ||
115 | + sysLogDO.setCreateBy(userName); | ||
116 | + } | ||
117 | + sysLogDO.setAddress(RequestStringUtils.getCityInfo(sysLogDO.getRequestIp())); | ||
118 | + sysLogDO.setMethod(methodName); | ||
119 | + sysLogDO.setUsername(userName); | ||
120 | + sysLogDO.setParams(params.toString() + " }"); | ||
121 | + sysLogDO.setEnableFlag(Constant.ENABLE_TEN); | ||
122 | + return sysLogDO; | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * 配置异常通知 | ||
127 | + * | ||
128 | + * @param joinPoint join point for advice | ||
129 | + * @param e exception | ||
130 | + */ | ||
131 | + @AfterThrowing(pointcut = "logPointcut()", throwing = "e") | ||
132 | + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { | ||
133 | + SysLogDO sysLogDO = wrapperLog((ProceedingJoinPoint) joinPoint); | ||
134 | + currentTime.remove(); | ||
135 | + sysLogDO.setExceptionDetail(String.valueOf(ThrowableUtil.getStackTrace(e).getBytes())); | ||
136 | + logService.save(sysLogDO); | ||
137 | + } | ||
138 | + | ||
139 | + /** | ||
140 | + * @return | ||
141 | + */ | ||
142 | + public String getUsername() { | ||
143 | + try { | ||
144 | + return SecurityUtils.getUsername(); | ||
145 | + } catch (Exception e) { | ||
146 | + return ""; | ||
147 | + } | ||
148 | + } | ||
149 | +} |
src/main/java/com/order/erp/mapper/SysLogMapper.java
0 → 100644
1 | +package com.order.erp.mapper; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import com.order.erp.domain.dto.SysLogDO; | ||
5 | + | ||
6 | +/** | ||
7 | + * 系统日志(SysLog)表数据库访问层 | ||
8 | + * | ||
9 | + * @author makejava | ||
10 | + * @since 2023-09-06 16:24:53 | ||
11 | + */ | ||
12 | +public interface SysLogMapper extends BaseMapper<SysLogDO> { | ||
13 | + | ||
14 | + | ||
15 | +} | ||
16 | + |
src/main/java/com/order/erp/security/service/OnlineUserService.java
@@ -9,6 +9,8 @@ import com.order.erp.security.vo.JwtUser; | @@ -9,6 +9,8 @@ import com.order.erp.security.vo.JwtUser; | ||
9 | import com.order.erp.security.vo.OnlineUser; | 9 | import com.order.erp.security.vo.OnlineUser; |
10 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
11 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
12 | +import org.springframework.web.context.request.RequestContextHolder; | ||
13 | +import org.springframework.web.context.request.ServletRequestAttributes; | ||
12 | 14 | ||
13 | import javax.annotation.Resource; | 15 | import javax.annotation.Resource; |
14 | import javax.servlet.http.HttpServletRequest; | 16 | import javax.servlet.http.HttpServletRequest; |
@@ -27,6 +29,29 @@ public class OnlineUserService { | @@ -27,6 +29,29 @@ public class OnlineUserService { | ||
27 | @Resource | 29 | @Resource |
28 | private RedisUtil redisUtil; | 30 | private RedisUtil redisUtil; |
29 | 31 | ||
32 | + /** | ||
33 | + * 保存在线用户信息 | ||
34 | + * | ||
35 | + * @param jwtUser / | ||
36 | + * @param token / | ||
37 | + */ | ||
38 | + public void save(JwtUser jwtUser, String token) { | ||
39 | + // 1. obtain request | ||
40 | + final ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); | ||
41 | + HttpServletRequest request = attributes.getRequest(); | ||
42 | + String email = jwtUser.getEmail(); | ||
43 | + String phone = jwtUser.getPhone(); | ||
44 | + String ip = RequestStringUtils.getIp(request); | ||
45 | + String browser = RequestStringUtils.getBrowser(request); | ||
46 | + String address = RequestStringUtils.getCityInfo(ip); | ||
47 | + OnlineUser onlineUser = null; | ||
48 | + try { | ||
49 | + onlineUser = new OnlineUser(jwtUser.getUsername(), phone, email, browser, ip, address, EncryptUtils.desEncrypt(token), new Date()); | ||
50 | + } catch (Exception e) { | ||
51 | + e.printStackTrace(); | ||
52 | + } | ||
53 | + redisUtil.set(properties.getOnlineKey() + token, JSON.toJSONString(onlineUser), properties.getTokenValidityInSeconds() / 1000); | ||
54 | + } | ||
30 | 55 | ||
31 | /** | 56 | /** |
32 | * 保存在线用户信息 | 57 | * 保存在线用户信息 |
src/main/java/com/order/erp/security/service/UserDetailsServiceImpl.java
@@ -5,7 +5,7 @@ import com.order.erp.domain.vo.UserVO; | @@ -5,7 +5,7 @@ import com.order.erp.domain.vo.UserVO; | ||
5 | import com.order.erp.domain.vo.admin.DeptSmallVO; | 5 | import com.order.erp.domain.vo.admin.DeptSmallVO; |
6 | import com.order.erp.domain.vo.admin.JobSmallVO; | 6 | import com.order.erp.domain.vo.admin.JobSmallVO; |
7 | import com.order.erp.security.vo.JwtUser; | 7 | import com.order.erp.security.vo.JwtUser; |
8 | -import com.order.erp.service.admin.AdminRoleMenuService; | 8 | +import com.order.erp.service.admin.AdminRoleService; |
9 | import com.order.erp.service.admin.AdminUserService; | 9 | import com.order.erp.service.admin.AdminUserService; |
10 | import org.springframework.security.core.userdetails.UserDetails; | 10 | import org.springframework.security.core.userdetails.UserDetails; |
11 | import org.springframework.security.core.userdetails.UserDetailsService; | 11 | import org.springframework.security.core.userdetails.UserDetailsService; |
@@ -28,7 +28,7 @@ public class UserDetailsServiceImpl implements UserDetailsService { | @@ -28,7 +28,7 @@ public class UserDetailsServiceImpl implements UserDetailsService { | ||
28 | private AdminUserService userService; | 28 | private AdminUserService userService; |
29 | 29 | ||
30 | @Resource | 30 | @Resource |
31 | - private AdminRoleMenuService roleService; | 31 | + private AdminRoleService roleService; |
32 | 32 | ||
33 | 33 | ||
34 | @Override | 34 | @Override |
@@ -43,24 +43,26 @@ public class UserDetailsServiceImpl implements UserDetailsService { | @@ -43,24 +43,26 @@ public class UserDetailsServiceImpl implements UserDetailsService { | ||
43 | return createJwtUser(user); | 43 | return createJwtUser(user); |
44 | } | 44 | } |
45 | 45 | ||
46 | + /** | ||
47 | + * @param user | ||
48 | + * @return | ||
49 | + */ | ||
46 | private UserDetails createJwtUser(UserVO user) { | 50 | private UserDetails createJwtUser(UserVO user) { |
47 | return new JwtUser( | 51 | return new JwtUser( |
48 | user.getId(), | 52 | user.getId(), |
49 | - user.getUsername(), | 53 | + user.getUserName(), |
50 | user.getNickName(), | 54 | user.getNickName(), |
51 | - user.getSex(), | 55 | + user.getGender(), |
52 | user.getPassword(), | 56 | user.getPassword(), |
53 | - user.getAvatar(), | ||
54 | - user.getWorkerType(), | 57 | + user.getAvatarName(), |
55 | user.getEmail(), | 58 | user.getEmail(), |
56 | user.getPhone(), | 59 | user.getPhone(), |
57 | Optional.ofNullable(user.getDept()).map(DeptSmallVO::getName).orElse(null), | 60 | Optional.ofNullable(user.getDept()).map(DeptSmallVO::getName).orElse(null), |
58 | Optional.ofNullable(user.getJob()).map(JobSmallVO::getName).orElse(null), | 61 | Optional.ofNullable(user.getJob()).map(JobSmallVO::getName).orElse(null), |
59 | -// roleService.mapToGrantedAuthorities(user), | ||
60 | - null, | 62 | + roleService.mapToGrantedAuthorities(user), |
61 | user.getEnabled(), | 63 | user.getEnabled(), |
62 | user.getCreateTime(), | 64 | user.getCreateTime(), |
63 | - user.getLastPasswordResetTime() | 65 | + user.getPwdResetTime() |
64 | ); | 66 | ); |
65 | } | 67 | } |
66 | } | 68 | } |
src/main/java/com/order/erp/security/vo/JwtUser.java
@@ -31,8 +31,6 @@ public class JwtUser implements UserDetails { | @@ -31,8 +31,6 @@ public class JwtUser implements UserDetails { | ||
31 | 31 | ||
32 | private final String avatar; | 32 | private final String avatar; |
33 | 33 | ||
34 | - private final String workerType; | ||
35 | - | ||
36 | private final String email; | 34 | private final String email; |
37 | 35 | ||
38 | private final String phone; | 36 | private final String phone; |
@@ -49,7 +47,7 @@ public class JwtUser implements UserDetails { | @@ -49,7 +47,7 @@ public class JwtUser implements UserDetails { | ||
49 | private LocalDateTime createTime; | 47 | private LocalDateTime createTime; |
50 | 48 | ||
51 | @JsonIgnore | 49 | @JsonIgnore |
52 | - private final Date lastPasswordResetDate; | 50 | + private final LocalDateTime lastPasswordResetDate; |
53 | 51 | ||
54 | @JsonIgnore | 52 | @JsonIgnore |
55 | @Override | 53 | @Override |
src/main/java/com/order/erp/service/SysLogService.java
0 → 100644
1 | +package com.order.erp.service; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
4 | +import com.order.erp.common.constant.ServerResult; | ||
5 | +import com.order.erp.domain.dto.SysLogDO; | ||
6 | +import com.order.erp.domain.vo.SysLogQueryVO; | ||
7 | +import com.order.erp.domain.vo.SysLogVO; | ||
8 | + | ||
9 | +/** | ||
10 | + * 系统日志(SysLog)表服务接口 | ||
11 | + * | ||
12 | + * @author makejava | ||
13 | + * @since 2023-09-06 16:24:58 | ||
14 | + */ | ||
15 | +public interface SysLogService extends IService<SysLogDO> { | ||
16 | + | ||
17 | + /** | ||
18 | + * 通过ID查询单条数据 | ||
19 | + * | ||
20 | + * @param sysLogQueryVO 主键 | ||
21 | + * @return 实例对象 | ||
22 | + */ | ||
23 | + ServerResult queryById(SysLogQueryVO sysLogQueryVO); | ||
24 | + | ||
25 | + /** | ||
26 | + * 分页查询 | ||
27 | + * | ||
28 | + * @param sysLogQueryVO 筛选条件 | ||
29 | + * @return 查询结果 | ||
30 | + */ | ||
31 | + ServerResult list(SysLogQueryVO sysLogQueryVO); | ||
32 | + | ||
33 | + /** | ||
34 | + * 新增数据 | ||
35 | + * | ||
36 | + * @param sysLogVO 数据VO | ||
37 | + * @return 新增结果 | ||
38 | + */ | ||
39 | + ServerResult add(SysLogVO sysLogVO); | ||
40 | + | ||
41 | + /** | ||
42 | + * 修改数据 | ||
43 | + * | ||
44 | + * @param sysLogVO 数据VO | ||
45 | + * @return 编辑结果 | ||
46 | + */ | ||
47 | + ServerResult edit(SysLogVO sysLogVO); | ||
48 | + | ||
49 | + /** | ||
50 | + * 通过主键删除数据 | ||
51 | + * | ||
52 | + * @param sysLogQueryVO 筛选条件 | ||
53 | + * @return 是否成功 | ||
54 | + */ | ||
55 | + ServerResult deleteById(SysLogQueryVO sysLogQueryVO); | ||
56 | + | ||
57 | +} |
src/main/java/com/order/erp/service/admin/AdminRoleService.java
@@ -3,8 +3,12 @@ package com.order.erp.service.admin; | @@ -3,8 +3,12 @@ package com.order.erp.service.admin; | ||
3 | import com.baomidou.mybatisplus.extension.service.IService; | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | import com.order.erp.common.constant.ServerResult; | 4 | import com.order.erp.common.constant.ServerResult; |
5 | import com.order.erp.domain.dto.admin.AdminRoleDO; | 5 | import com.order.erp.domain.dto.admin.AdminRoleDO; |
6 | +import com.order.erp.domain.vo.UserVO; | ||
6 | import com.order.erp.domain.vo.admin.AdminRoleQueryVO; | 7 | import com.order.erp.domain.vo.admin.AdminRoleQueryVO; |
7 | import com.order.erp.domain.vo.admin.AdminRoleVO; | 8 | import com.order.erp.domain.vo.admin.AdminRoleVO; |
9 | +import org.springframework.security.core.GrantedAuthority; | ||
10 | + | ||
11 | +import java.util.Collection; | ||
8 | 12 | ||
9 | /** | 13 | /** |
10 | * 角色表(AdminRole)表服务接口 | 14 | * 角色表(AdminRole)表服务接口 |
@@ -28,9 +32,21 @@ public interface AdminRoleService extends IService<AdminRoleDO> { | @@ -28,9 +32,21 @@ public interface AdminRoleService extends IService<AdminRoleDO> { | ||
28 | * @param adminRoleQueryVO 筛选条件 | 32 | * @param adminRoleQueryVO 筛选条件 |
29 | * @return 查询结果 | 33 | * @return 查询结果 |
30 | */ | 34 | */ |
35 | + ServerResult listByPage(AdminRoleQueryVO adminRoleQueryVO); | ||
36 | + | ||
37 | + /** | ||
38 | + * @param adminRoleQueryVO | ||
39 | + * @return | ||
40 | + */ | ||
31 | ServerResult list(AdminRoleQueryVO adminRoleQueryVO); | 41 | ServerResult list(AdminRoleQueryVO adminRoleQueryVO); |
32 | 42 | ||
33 | /** | 43 | /** |
44 | + * @param level | ||
45 | + * @return | ||
46 | + */ | ||
47 | + ServerResult listByLevel(Integer level); | ||
48 | + | ||
49 | + /** | ||
34 | * 新增数据 | 50 | * 新增数据 |
35 | * | 51 | * |
36 | * @param adminRoleVO 数据VO | 52 | * @param adminRoleVO 数据VO |
@@ -54,4 +70,10 @@ public interface AdminRoleService extends IService<AdminRoleDO> { | @@ -54,4 +70,10 @@ public interface AdminRoleService extends IService<AdminRoleDO> { | ||
54 | */ | 70 | */ |
55 | ServerResult deleteById(AdminRoleQueryVO adminRoleQueryVO); | 71 | ServerResult deleteById(AdminRoleQueryVO adminRoleQueryVO); |
56 | 72 | ||
73 | + /** | ||
74 | + * @param user | ||
75 | + * @return | ||
76 | + */ | ||
77 | + public Collection<GrantedAuthority> mapToGrantedAuthorities(UserVO user); | ||
78 | + | ||
57 | } | 79 | } |
src/main/java/com/order/erp/service/admin/AdminUserService.java
@@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | @@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||
4 | import com.order.erp.common.constant.ServerResult; | 4 | import com.order.erp.common.constant.ServerResult; |
5 | import com.order.erp.domain.dto.admin.AdminUserDO; | 5 | import com.order.erp.domain.dto.admin.AdminUserDO; |
6 | import com.order.erp.domain.vo.UserVO; | 6 | import com.order.erp.domain.vo.UserVO; |
7 | -import com.order.erp.domain.vo.admin.AdminUserQueryVO; | ||
8 | -import com.order.erp.domain.vo.admin.AdminUserVO; | 7 | +import com.order.erp.domain.vo.admin.*; |
9 | 8 | ||
10 | /** | 9 | /** |
11 | * 用户表(AdminUser)表服务接口 | 10 | * 用户表(AdminUser)表服务接口 |
@@ -63,4 +62,42 @@ public interface AdminUserService extends IService<AdminUserDO> { | @@ -63,4 +62,42 @@ public interface AdminUserService extends IService<AdminUserDO> { | ||
63 | */ | 62 | */ |
64 | UserVO findByUserName(String userName); | 63 | UserVO findByUserName(String userName); |
65 | 64 | ||
65 | + | ||
66 | + /** | ||
67 | + * @param registerVO | ||
68 | + * @return | ||
69 | + */ | ||
70 | + ServerResult phoneRegister(AdminUserRegisterVO registerVO); | ||
71 | + | ||
72 | + /** | ||
73 | + * @param loginByPhoneVO | ||
74 | + * @return | ||
75 | + */ | ||
76 | + ServerResult loginByPhone(AdminUserLoginByPhoneVO loginByPhoneVO); | ||
77 | + | ||
78 | + /** | ||
79 | + * @param loginByPwdVO | ||
80 | + * @return | ||
81 | + */ | ||
82 | + ServerResult loginByPwd(AdminUserLoginByPwdVO loginByPwdVO); | ||
83 | + | ||
84 | + /** | ||
85 | + * @param modifyPwdVO | ||
86 | + * @return | ||
87 | + */ | ||
88 | + ServerResult passwordModify(AdminUserModifyPwdVO modifyPwdVO); | ||
89 | + | ||
90 | + /** | ||
91 | + * @param recoverEmailVO | ||
92 | + * @return | ||
93 | + */ | ||
94 | + ServerResult sendPasswordRecoverMail(AdminUserPasswordRecoverEmailVO recoverEmailVO); | ||
95 | + | ||
96 | + /** | ||
97 | + * @param username | ||
98 | + * @return | ||
99 | + */ | ||
100 | + MemberUserVO findByNameOrPhone(String username); | ||
101 | + | ||
102 | + | ||
66 | } | 103 | } |
src/main/java/com/order/erp/service/admin/impl/AdminRoleServiceImpl.java
@@ -2,20 +2,39 @@ package com.order.erp.service.admin.impl; | @@ -2,20 +2,39 @@ package com.order.erp.service.admin.impl; | ||
2 | 2 | ||
3 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | import cn.hutool.core.collection.CollUtil; | 4 | import cn.hutool.core.collection.CollUtil; |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
7 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
8 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||
9 | +import com.baomidou.mybatisplus.core.toolkit.StringUtils; | ||
10 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | import com.order.erp.common.constant.Constant; | 12 | import com.order.erp.common.constant.Constant; |
8 | import com.order.erp.common.constant.ServerResult; | 13 | import com.order.erp.common.constant.ServerResult; |
14 | +import com.order.erp.domain.dto.BaseDO; | ||
15 | +import com.order.erp.domain.dto.admin.AdminMenuDO; | ||
9 | import com.order.erp.domain.dto.admin.AdminRoleDO; | 16 | import com.order.erp.domain.dto.admin.AdminRoleDO; |
17 | +import com.order.erp.domain.dto.admin.AdminRoleMenuDO; | ||
18 | +import com.order.erp.domain.vo.UserVO; | ||
10 | import com.order.erp.domain.vo.admin.AdminRoleQueryVO; | 19 | import com.order.erp.domain.vo.admin.AdminRoleQueryVO; |
20 | +import com.order.erp.domain.vo.admin.AdminRoleResultVO; | ||
11 | import com.order.erp.domain.vo.admin.AdminRoleVO; | 21 | import com.order.erp.domain.vo.admin.AdminRoleVO; |
22 | +import com.order.erp.domain.vo.admin.RoleSmallVO; | ||
12 | import com.order.erp.mapper.admin.AdminRoleMapper; | 23 | import com.order.erp.mapper.admin.AdminRoleMapper; |
24 | +import com.order.erp.service.admin.AdminMenuService; | ||
25 | +import com.order.erp.service.admin.AdminRoleMenuService; | ||
13 | import com.order.erp.service.admin.AdminRoleService; | 26 | import com.order.erp.service.admin.AdminRoleService; |
27 | +import com.order.erp.service.admin.AdminUserRoleService; | ||
14 | import lombok.extern.slf4j.Slf4j; | 28 | import lombok.extern.slf4j.Slf4j; |
29 | +import org.springframework.beans.BeanUtils; | ||
30 | +import org.springframework.cache.annotation.Cacheable; | ||
31 | +import org.springframework.security.core.GrantedAuthority; | ||
32 | +import org.springframework.security.core.authority.SimpleGrantedAuthority; | ||
15 | import org.springframework.stereotype.Service; | 33 | import org.springframework.stereotype.Service; |
16 | 34 | ||
17 | -import java.util.List; | ||
18 | -import java.util.Objects; | 35 | +import javax.annotation.Resource; |
36 | +import java.util.*; | ||
37 | +import java.util.stream.Collectors; | ||
19 | 38 | ||
20 | /** | 39 | /** |
21 | * 角色表(AdminRole)表服务实现类 | 40 | * 角色表(AdminRole)表服务实现类 |
@@ -27,6 +46,15 @@ import java.util.Objects; | @@ -27,6 +46,15 @@ import java.util.Objects; | ||
27 | @Service | 46 | @Service |
28 | public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRoleDO> implements AdminRoleService { | 47 | public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRoleDO> implements AdminRoleService { |
29 | 48 | ||
49 | + @Resource | ||
50 | + private AdminUserRoleService userRoleService; | ||
51 | + | ||
52 | + @Resource | ||
53 | + private AdminRoleMenuService roleMenuService; | ||
54 | + | ||
55 | + @Resource | ||
56 | + private AdminMenuService menuService; | ||
57 | + | ||
30 | 58 | ||
31 | /** | 59 | /** |
32 | * 通过ID查询单条数据 | 60 | * 通过ID查询单条数据 |
@@ -59,6 +87,45 @@ public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole | @@ -59,6 +87,45 @@ public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole | ||
59 | return ServerResult.success(); | 87 | return ServerResult.success(); |
60 | } | 88 | } |
61 | 89 | ||
90 | + @Override | ||
91 | + public ServerResult listByPage(AdminRoleQueryVO queryVO) { | ||
92 | + LambdaQueryWrapper<AdminRoleDO> queryWrapper = buildQueryByParam(queryVO); | ||
93 | + Page page = new Page<>(queryVO.getPageNo(), queryVO.getPageSize()); | ||
94 | + IPage<AdminRoleDO> iPage = page(page, queryWrapper); | ||
95 | + | ||
96 | + Page<AdminRoleResultVO> webVOPage = new Page<>(); | ||
97 | + List<AdminRoleDO> locationStockEmptyBarcodeDOList = iPage.getRecords(); | ||
98 | + if (CollectionUtils.isNotEmpty(locationStockEmptyBarcodeDOList)) { | ||
99 | + List<AdminRoleResultVO> queryVos = locationStockEmptyBarcodeDOList.stream().map(x -> { | ||
100 | + AdminRoleResultVO resultVO = new AdminRoleResultVO(); | ||
101 | + BeanUtils.copyProperties(x, resultVO); | ||
102 | + return resultVO; | ||
103 | + }).collect(Collectors.toList()); | ||
104 | + webVOPage.setRecords(queryVos); | ||
105 | + } | ||
106 | + BeanUtils.copyProperties(page, webVOPage, "records"); | ||
107 | + return ServerResult.success(webVOPage); | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * @param queryVO | ||
112 | + * @return | ||
113 | + */ | ||
114 | + private LambdaQueryWrapper<AdminRoleDO> buildQueryByParam(AdminRoleQueryVO queryVO) { | ||
115 | + return new LambdaQueryWrapper<AdminRoleDO>() | ||
116 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
117 | + .eq(Objects.nonNull(queryVO.getLevel()), AdminRoleDO::getLevel, queryVO.getLevel()) | ||
118 | + .eq(StringUtils.isNotBlank(queryVO.getName()), AdminRoleDO::getName, queryVO.getName()) | ||
119 | + .eq(StringUtils.isNotBlank(queryVO.getDataScope()), AdminRoleDO::getDataScope, queryVO.getDataScope()); | ||
120 | + } | ||
121 | + | ||
122 | + @Override | ||
123 | + public ServerResult listByLevel(Integer level) { | ||
124 | + return ServerResult.success(list(new LambdaQueryWrapper<AdminRoleDO>() | ||
125 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
126 | + .eq(Objects.nonNull(level), AdminRoleDO::getLevel, level))); | ||
127 | + } | ||
128 | + | ||
62 | /** | 129 | /** |
63 | * 新增数据 | 130 | * 新增数据 |
64 | * | 131 | * |
@@ -120,4 +187,29 @@ public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole | @@ -120,4 +187,29 @@ public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole | ||
120 | update(updateWrapper); | 187 | update(updateWrapper); |
121 | return ServerResult.success(); | 188 | return ServerResult.success(); |
122 | } | 189 | } |
190 | + | ||
191 | + | ||
192 | + @Override | ||
193 | + @Cacheable(key = "'loadPermissionByUser:' + #p0.username") | ||
194 | + public Collection<GrantedAuthority> mapToGrantedAuthorities(UserVO user) { | ||
195 | + Set<RoleSmallVO> roleSmallVOS = user.getRoles(); | ||
196 | + if (CollectionUtils.isEmpty(roleSmallVOS)) { | ||
197 | + return Collections.emptyList(); | ||
198 | + } | ||
199 | + Set<Long> roleIds = roleSmallVOS.stream().map(RoleSmallVO::getId).collect(Collectors.toSet()); | ||
200 | + | ||
201 | + List<AdminRoleMenuDO> roleMenuDOS = roleMenuService.list(new LambdaQueryWrapper<AdminRoleMenuDO>().in(AdminRoleMenuDO::getRoleId, roleIds)); | ||
202 | + | ||
203 | + if (CollectionUtils.isEmpty(roleMenuDOS)) { | ||
204 | + return Collections.emptyList(); | ||
205 | + } | ||
206 | + Set<Long> menuIds = roleMenuDOS.stream().map(AdminRoleMenuDO::getMenuId).collect(Collectors.toSet()); | ||
207 | + List<AdminMenuDO> menuDOList = menuService.listByIds(menuIds); | ||
208 | + Set<String> permissions = menuDOList.stream().filter(menuDO -> StringUtils.isNotBlank(menuDO.getPermission())).map(AdminMenuDO::getPermission).collect(Collectors.toSet()); | ||
209 | + if (CollectionUtils.isEmpty(permissions)) { | ||
210 | + return Collections.emptyList(); | ||
211 | + } | ||
212 | + return permissions.stream().map(SimpleGrantedAuthority::new) | ||
213 | + .collect(Collectors.toList()); | ||
214 | + } | ||
123 | } | 215 | } |
src/main/java/com/order/erp/service/admin/impl/AdminUserServiceImpl.java
@@ -2,21 +2,37 @@ package com.order.erp.service.admin.impl; | @@ -2,21 +2,37 @@ package com.order.erp.service.admin.impl; | ||
2 | 2 | ||
3 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | import cn.hutool.core.collection.CollUtil; | 4 | import cn.hutool.core.collection.CollUtil; |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
7 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||
6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | +import com.canrd.shop.common.constant.ServerResultCode; | ||
7 | import com.order.erp.common.constant.Constant; | 10 | import com.order.erp.common.constant.Constant; |
8 | import com.order.erp.common.constant.ServerResult; | 11 | import com.order.erp.common.constant.ServerResult; |
9 | -import com.order.erp.domain.dto.admin.AdminUserDO; | 12 | +import com.order.erp.common.exception.BusinessException; |
13 | +import com.order.erp.common.utils.ImgCaptchaUtils; | ||
14 | +import com.order.erp.common.utils.RedisUtil; | ||
15 | +import com.order.erp.domain.dto.BaseDO; | ||
16 | +import com.order.erp.domain.dto.admin.*; | ||
10 | import com.order.erp.domain.vo.UserVO; | 17 | import com.order.erp.domain.vo.UserVO; |
11 | -import com.order.erp.domain.vo.admin.AdminUserQueryVO; | ||
12 | -import com.order.erp.domain.vo.admin.AdminUserVO; | 18 | +import com.order.erp.domain.vo.admin.*; |
13 | import com.order.erp.mapper.admin.AdminUserMapper; | 19 | import com.order.erp.mapper.admin.AdminUserMapper; |
14 | -import com.order.erp.service.admin.AdminUserService; | 20 | +import com.order.erp.security.TokenProvider; |
21 | +import com.order.erp.security.config.SecurityProperties; | ||
22 | +import com.order.erp.security.service.OnlineUserService; | ||
23 | +import com.order.erp.security.vo.JwtUser; | ||
24 | +import com.order.erp.service.admin.*; | ||
15 | import lombok.extern.slf4j.Slf4j; | 25 | import lombok.extern.slf4j.Slf4j; |
26 | +import org.springframework.beans.BeanUtils; | ||
27 | +import org.springframework.security.authentication.AuthenticationManager; | ||
28 | +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | ||
29 | +import org.springframework.security.core.Authentication; | ||
30 | +import org.springframework.security.core.context.SecurityContextHolder; | ||
16 | import org.springframework.stereotype.Service; | 31 | import org.springframework.stereotype.Service; |
17 | 32 | ||
18 | -import java.util.List; | ||
19 | -import java.util.Objects; | 33 | +import javax.annotation.Resource; |
34 | +import java.util.*; | ||
35 | +import java.util.stream.Collectors; | ||
20 | 36 | ||
21 | /** | 37 | /** |
22 | * 用户表(AdminUser)表服务实现类 | 38 | * 用户表(AdminUser)表服务实现类 |
@@ -28,6 +44,39 @@ import java.util.Objects; | @@ -28,6 +44,39 @@ import java.util.Objects; | ||
28 | @Service | 44 | @Service |
29 | public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUserDO> implements AdminUserService { | 45 | public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUserDO> implements AdminUserService { |
30 | 46 | ||
47 | + @Resource | ||
48 | + private ImgCaptchaUtils imgCaptchaUtils; | ||
49 | + | ||
50 | + @Resource | ||
51 | + private RedisUtil redisUtil; | ||
52 | + | ||
53 | + @Resource | ||
54 | + private AuthenticationManager authenticationManager; | ||
55 | + | ||
56 | + @Resource | ||
57 | + private TokenProvider tokenProvider; | ||
58 | + | ||
59 | + @Resource | ||
60 | + private OnlineUserService onlineUserService; | ||
61 | + | ||
62 | + | ||
63 | + @Resource | ||
64 | + private SecurityProperties securityProperties; | ||
65 | + | ||
66 | + @Resource | ||
67 | + private AdminUserJobService userJobService; | ||
68 | + | ||
69 | + @Resource | ||
70 | + private AdminJobService jobService; | ||
71 | + | ||
72 | + @Resource | ||
73 | + private AdminDeptService deptService; | ||
74 | + | ||
75 | + @Resource | ||
76 | + private AdminUserRoleService userRoleService; | ||
77 | + | ||
78 | + @Resource | ||
79 | + private AdminRoleService roleService; | ||
31 | 80 | ||
32 | /** | 81 | /** |
33 | * 通过ID查询单条数据 | 82 | * 通过ID查询单条数据 |
@@ -124,6 +173,104 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser | @@ -124,6 +173,104 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser | ||
124 | 173 | ||
125 | @Override | 174 | @Override |
126 | public UserVO findByUserName(String userName) { | 175 | public UserVO findByUserName(String userName) { |
176 | + AdminUserDO userDO = getOne(new LambdaQueryWrapper<AdminUserDO>() | ||
177 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
178 | + .and(q -> q.eq(AdminUserDO::getUserName, userName).or().eq(AdminUserDO::getPhone, userName)) | ||
179 | + .last("limit 1")); | ||
180 | + if (Objects.isNull(userDO)) { | ||
181 | + throw new BusinessException(ServerResultCode.USER_NOT_EXIT); | ||
182 | + } | ||
183 | + UserVO userVO = new UserVO(); | ||
184 | + BeanUtils.copyProperties(userDO, userVO); | ||
185 | + userVO.setEnabled(Constant.ENABLE_TEN == userDO.getEnableFlag()); | ||
186 | + AdminUserJobDO userJobDO = userJobService.getOne(new LambdaQueryWrapper<AdminUserJobDO>().eq(AdminUserJobDO::getUserId, userDO.getId())); | ||
187 | + if (Objects.nonNull(userJobDO)) { | ||
188 | + AdminJobDO jobDO = jobService.getById(userJobDO.getJobId()); | ||
189 | + userVO.setJob(JobSmallVO.builder().id(jobDO.getId()).name(jobDO.getName()).build()); | ||
190 | + } | ||
191 | + AdminDeptDO deptDO = deptService.getById(userDO.getDeptId()); | ||
192 | + if (Objects.nonNull(deptDO)) { | ||
193 | + userVO.setDept(DeptSmallVO.builder().id(deptDO.getId()).name(deptDO.getName()).build()); | ||
194 | + } | ||
195 | + List<AdminUserRoleDO> userRoleDOList = userRoleService.list(new LambdaQueryWrapper<AdminUserRoleDO>().eq(AdminUserRoleDO::getUserId, userDO.getId())); | ||
196 | + if (CollectionUtils.isNotEmpty(userRoleDOList)) { | ||
197 | + Set<Long> roleIds = userRoleDOList.stream().map(AdminUserRoleDO::getRoleId).collect(Collectors.toSet()); | ||
198 | + List<AdminRoleDO> roleDOList = roleService.listByIds(roleIds); | ||
199 | + if (CollectionUtils.isNotEmpty(roleDOList)) { | ||
200 | + userVO.setRoles(roleDOList.stream().map(x -> { | ||
201 | + return RoleSmallVO.builder().id(x.getId()).name(x.getName()).dataScope(x.getDataScope()).level(x.getLevel()).build(); | ||
202 | + }).collect(Collectors.toSet())); | ||
203 | + } | ||
204 | + } | ||
205 | + return userVO; | ||
206 | + } | ||
207 | + | ||
208 | + | ||
209 | + @Override | ||
210 | + public ServerResult phoneRegister(AdminUserRegisterVO registerVO) { | ||
211 | + return null; | ||
212 | + } | ||
213 | + | ||
214 | + @Override | ||
215 | + public ServerResult loginByPhone(AdminUserLoginByPhoneVO loginByPhoneVO) { | ||
216 | + return null; | ||
217 | + } | ||
218 | + | ||
219 | + @Override | ||
220 | + public ServerResult loginByPwd(AdminUserLoginByPwdVO loginByPwdVO) { | ||
221 | + imgCaptchaUtils.validateImgCaptcha(loginByPwdVO.getImgCaptchaCode(), loginByPwdVO.getImgCaptchaUuid()); | ||
222 | + | ||
223 | + return ServerResult.success(buildLoginUser(loginByPwdVO)); | ||
224 | + } | ||
225 | + | ||
226 | + | ||
227 | + /** | ||
228 | + * @param loginByPwdVO | ||
229 | + * @return | ||
230 | + */ | ||
231 | + private Map<String, Object> buildLoginUser(AdminUserLoginByPwdVO loginByPwdVO) { | ||
232 | + Authentication authentication = auth(loginByPwdVO); | ||
233 | + // 生成令牌 | ||
234 | + String token = tokenProvider.createToken(authentication); | ||
235 | + final JwtUser jwtUser = (JwtUser) authentication.getPrincipal(); | ||
236 | + // 保存在线信息 | ||
237 | + onlineUserService.save(jwtUser, token); | ||
238 | + // 返回 token 与 用户信息 | ||
239 | + Map<String, Object> authInfo = new HashMap<String, Object>(2) {{ | ||
240 | + put("token", securityProperties.getTokenStartWith() + token); | ||
241 | + put("user", jwtUser); | ||
242 | + }}; | ||
243 | + | ||
244 | + return authInfo; | ||
245 | + } | ||
246 | + | ||
247 | + /** | ||
248 | + * @param loginByPwdVO | ||
249 | + * @return | ||
250 | + */ | ||
251 | + private Authentication auth(AdminUserLoginByPwdVO loginByPwdVO) { | ||
252 | + | ||
253 | + UsernamePasswordAuthenticationToken authenticationToken = | ||
254 | + new UsernamePasswordAuthenticationToken(loginByPwdVO.getUserName(), loginByPwdVO.getPassword()); | ||
255 | + | ||
256 | + Authentication authentication = authenticationManager.authenticate(authenticationToken); | ||
257 | + SecurityContextHolder.getContext().setAuthentication(authentication); | ||
258 | + | ||
259 | + return authentication; | ||
260 | + } | ||
261 | + | ||
262 | + @Override | ||
263 | + public ServerResult passwordModify(AdminUserModifyPwdVO modifyPwdVO) { | ||
264 | + return null; | ||
265 | + } | ||
266 | + | ||
267 | + @Override | ||
268 | + public ServerResult sendPasswordRecoverMail(AdminUserPasswordRecoverEmailVO recoverEmailVO) { | ||
269 | + return null; | ||
270 | + } | ||
271 | + | ||
272 | + @Override | ||
273 | + public MemberUserVO findByNameOrPhone(String username) { | ||
127 | return null; | 274 | return null; |
128 | } | 275 | } |
129 | } | 276 | } |
src/main/java/com/order/erp/service/impl/SysLogServiceImpl.java
0 → 100644
1 | +package com.order.erp.service.impl; | ||
2 | + | ||
3 | +import cn.hutool.core.bean.BeanUtil; | ||
4 | +import cn.hutool.core.collection.CollUtil; | ||
5 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
7 | +import com.order.erp.common.constant.Constant; | ||
8 | +import com.order.erp.common.constant.ServerResult; | ||
9 | +import com.order.erp.domain.dto.SysLogDO; | ||
10 | +import com.order.erp.domain.vo.SysLogQueryVO; | ||
11 | +import com.order.erp.domain.vo.SysLogVO; | ||
12 | +import com.order.erp.mapper.SysLogMapper; | ||
13 | +import com.order.erp.service.SysLogService; | ||
14 | +import lombok.extern.slf4j.Slf4j; | ||
15 | +import org.springframework.stereotype.Service; | ||
16 | + | ||
17 | +import java.util.List; | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +/** | ||
21 | + * 系统日志(SysLog)表服务实现类 | ||
22 | + * | ||
23 | + * @author makejava | ||
24 | + * @since 2023-09-06 16:24:59 | ||
25 | + */ | ||
26 | +@Slf4j | ||
27 | +@Service | ||
28 | +public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLogDO> implements SysLogService { | ||
29 | + | ||
30 | + | ||
31 | + /** | ||
32 | + * 通过ID查询单条数据 | ||
33 | + * <p> | ||
34 | + * sysLogQueryVO 主键 | ||
35 | + * | ||
36 | + * @return 实例对象 | ||
37 | + */ | ||
38 | + @Override | ||
39 | + public ServerResult queryById(SysLogQueryVO sysLogQueryVO) { | ||
40 | + if (Objects.isNull(sysLogQueryVO.getId())) { | ||
41 | + return ServerResult.fail("id 不能为空"); | ||
42 | + } | ||
43 | + SysLogDO SysLogDo = getById(sysLogQueryVO.getId()); | ||
44 | + if (Objects.isNull(SysLogDo)) { | ||
45 | + return ServerResult.success(null); | ||
46 | + } | ||
47 | + return ServerResult.success(BeanUtil.copyProperties(SysLogDo, SysLogVO.class)); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 分页查询 | ||
52 | + * | ||
53 | + * @param sysLogQueryVO 筛选条件 | ||
54 | + * @return 查询结果 | ||
55 | + */ | ||
56 | + @Override | ||
57 | + public ServerResult list(SysLogQueryVO sysLogQueryVO) { | ||
58 | + return ServerResult.success(); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * 新增数据 | ||
63 | + * | ||
64 | + * @param sysLogVO 实例对象 | ||
65 | + * @return 实例对象 | ||
66 | + */ | ||
67 | + @Override | ||
68 | + public ServerResult add(SysLogVO sysLogVO) { | ||
69 | + //todo 校验 | ||
70 | + if (Objects.nonNull(sysLogVO.getId())) { | ||
71 | + sysLogVO.setId(null); | ||
72 | + } | ||
73 | + SysLogDO sysLogDo = BeanUtil.copyProperties(sysLogVO, SysLogDO.class); | ||
74 | + | ||
75 | + save(sysLogDo); | ||
76 | + | ||
77 | + return ServerResult.success(); | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 修改数据 | ||
82 | + * | ||
83 | + * @param sysLogVO 实例对象 | ||
84 | + * @return 实例对象 | ||
85 | + */ | ||
86 | + @Override | ||
87 | + public ServerResult edit(SysLogVO sysLogVO) { | ||
88 | + //todo 校验 | ||
89 | + if (Objects.isNull(sysLogVO.getId())) { | ||
90 | + return ServerResult.fail("id 不能为空"); | ||
91 | + } | ||
92 | + SysLogDO sysLogDo = BeanUtil.copyProperties(sysLogVO, SysLogDO.class); | ||
93 | + | ||
94 | + updateById(sysLogDo); | ||
95 | + | ||
96 | + return ServerResult.success(); | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * 通过主键删除数据 | ||
101 | + * | ||
102 | + * @param sysLogQueryVO 筛选条件 | ||
103 | + * @return 是否成功 | ||
104 | + */ | ||
105 | + @Override | ||
106 | + public ServerResult deleteById(SysLogQueryVO sysLogQueryVO) { | ||
107 | + List<Long> ids = sysLogQueryVO.getIds(); | ||
108 | + if (CollUtil.isEmpty(ids)) { | ||
109 | + return ServerResult.fail("ids 参数不能为空"); | ||
110 | + } | ||
111 | + List<SysLogDO> sysLogList = listByIds(ids); | ||
112 | + if (CollUtil.isEmpty(sysLogList)) { | ||
113 | + return ServerResult.success(); | ||
114 | + } | ||
115 | + //todo 校验是否可以逻辑删除 | ||
116 | + LambdaUpdateWrapper<SysLogDO> updateWrapper = new LambdaUpdateWrapper<SysLogDO>() | ||
117 | + .in(SysLogDO::getId, ids) | ||
118 | + .set(SysLogDO::getEnableFlag, Constant.UNABLE_TWENTY); | ||
119 | + update(updateWrapper); | ||
120 | + return ServerResult.success(); | ||
121 | + } | ||
122 | +} |