mirror of https://github.com/jeecgboot/jeecg-boot
JeecgBoot3.5.0 版本发布,开源的企业级低代码平台
parent
a3c0127a7a
commit
b679fb75ba
|
@ -7,13 +7,13 @@
|
|||
JEECG BOOT 低代码开发平台
|
||||
===============
|
||||
|
||||
当前最新版本: 3.4.4(发布日期:2022-11-21)
|
||||
当前最新版本: 3.5.0(发布日期:2023-03-08)
|
||||
|
||||
|
||||
[![AUR](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
||||
[![](https://img.shields.io/badge/Author-北京敲敲云科技-orange.svg)](http://www.jeecg.com)
|
||||
[![](https://img.shields.io/badge/Blog-官方博客-blue.svg)](https://jeecg.blog.csdn.net)
|
||||
[![](https://img.shields.io/badge/version-3.4.4-brightgreen.svg)](https://github.com/zhangdaiscott/jeecg-boot)
|
||||
[![](https://img.shields.io/badge/version-3.5.0-brightgreen.svg)](https://github.com/zhangdaiscott/jeecg-boot)
|
||||
[![GitHub stars](https://img.shields.io/github/stars/zhangdaiscott/jeecg-boot.svg?style=social&label=Stars)](https://github.com/zhangdaiscott/jeecg-boot)
|
||||
[![GitHub forks](https://img.shields.io/github/forks/zhangdaiscott/jeecg-boot.svg?style=social&label=Fork)](https://github.com/zhangdaiscott/jeecg-boot)
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,161 @@
|
|||
-- 升级说明:系统敏感接口加了权限注解,此部分是补请求注解配置
|
||||
|
||||
-- author: wangshuai---date:20221118 -for: [VUEN-2735] jeecgboot敏感接口权限加注解 vue3
|
||||
-- 用户管理
|
||||
UPDATE sys_permission SET perms = 'system:user:changepwd' WHERE id = '1588513553652436993';
|
||||
|
||||
UPDATE sys_permission SET name = '用户导入', perms = 'system:user:import' WHERE id = 'f15543b0263cf6c5fac85afdd3eba3f2';
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593185714482880514', '3f915b2769fc80648e92d04e84ca059d', '用户导出', NULL, NULL, 0, NULL, NULL, 2, 'system:user:export', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 18:14:09', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 数据字典子项
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593160905216663554', '1438782641187074050', '字典子项新增', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:35:34', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593160959633563650', '1438782641187074050', '字典子项编辑', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:35:47', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161025790320641', '1438782641187074050', '字典子项删除', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:36:03', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161089787011074', '1438782641187074050', '字典子项批量删除', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:36:18', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 定时任务
|
||||
UPDATE sys_permission SET is_leaf = 0 WHERE id = '1439488251473993730';
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161421350936578', '1439488251473993730', '添加定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:37:37', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161483627962370', '1439488251473993730', '更新定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:37:52', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161551202394114', '1439488251473993730', '删除定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:08', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161608362369026', '1439488251473993730', '批量删除定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:22', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161657385394177', '1439488251473993730', '停止定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:pause', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:33', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161697348722689', '1439488251473993730', '启动定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:resume', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:43', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161743607701505', '1439488251473993730', '立即执行定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:execute', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- oos上传
|
||||
UPDATE sys_permission SET is_leaf = 0 WHERE id = '1442055284830769154';
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593173018886709250', '1442055284830769154', '文件oos上传', NULL, NULL, 0, NULL, NULL, 2, 'system:ossFile:upload', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 17:23:42', NULL, NULL, 0, 0, '1', 0);
|
||||
-- author: wangshuai---date:20221118 -for: [VUEN-2735] jeecgboot敏感接口权限加注解 vue3
|
||||
|
||||
-- author: wangshuai---date:20221118 -for: [VUEN-2735] jeecgboot敏感接口权限加注解 vue2
|
||||
-- 用户管理
|
||||
UPDATE sys_permission_v2 SET perms = 'system:user:changepwd' WHERE id = '1588513553652436993';
|
||||
UPDATE sys_permission_v2 SET name = '用户导入', perms = 'system:user:import' WHERE id = 'f15543b0263cf6c5fac85afdd3eba3f2';
|
||||
UPDATE sys_permission_v2 SET perms = 'system:user:export' WHERE id = '1305812030117220354';
|
||||
|
||||
-- 数据字典子项
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593160905216663554', 'f1cb187abf927c88b89470d08615f5ac', '字典子项新增', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:35:34', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593160959633563650', 'f1cb187abf927c88b89470d08615f5ac', '字典子项编辑', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:35:47', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161025790320641', 'f1cb187abf927c88b89470d08615f5ac', '字典子项删除', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:36:03', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161089787011074', 'f1cb187abf927c88b89470d08615f5ac', '字典子项批量删除', NULL, NULL, 0, NULL, NULL, 2, 'system:dict:item:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:36:18', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 定时任务
|
||||
UPDATE sys_permission_v2 SET is_leaf = 0 WHERE id = 'b1cb0a3fedf7ed0e4653cb5a229837ee';
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161421350936578', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '添加定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:37:37', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161483627962370', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '更新定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:37:52', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161551202394114', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '删除定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:08', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161608362369026', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '批量删除定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:22', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161657385394177', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '停止定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:pause', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:33', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161697348722689', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '启动定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:resume', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:43', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593161743607701505', 'b1cb0a3fedf7ed0e4653cb5a229837ee', '立即执行定时任务', NULL, NULL, 0, NULL, NULL, 2, 'system:quartzJob:execute', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 16:38:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- oos上传
|
||||
UPDATE sys_permission_v2 SET is_leaf = 0 WHERE id = '1166535831146504193';
|
||||
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1593173018886709250', '1166535831146504193', '文件oos上传', NULL, NULL, 0, NULL, NULL, 2, 'system:ossFile:upload', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-17 17:23:42', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- author: wangshuai---date:20221118 -for: [VUEN-2735] jeecgboot敏感接口权限加注解 vue2
|
||||
|
||||
-- author: wangshuai---date:20221126 -for:首页用户设置用户编辑敏感权限
|
||||
UPDATE sys_permission SET parent_id = 'd7d6e2e4e2934f2c9385a623fd98c6f3', name = '用户设置', url = '/system/usersetting', component = 'system/usersetting/UserSetting', is_route = 1, component_name = '', redirect = NULL, menu_type = 1, perms = NULL, perms_type = '0', sort_no = 12.00, always_show = 0, icon = 'ant-design:setting-twotone', is_leaf = 0, keep_alive = 0, hidden = 0, hide_tab = 0, description = NULL, create_by = 'admin', create_time = '2022-11-25 22:01:08', update_by = 'admin', update_time = '2022-11-26 10:50:07', del_flag = 0, rule_flag = 0, status = NULL, internal_or_external = 0 WHERE id = '1596141938193747970';
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1596335805278990338', '1596141938193747970', '账户设置用户编辑权限', NULL, NULL, 0, NULL, NULL, 2, 'system:user:setting:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-26 10:51:29', NULL, NULL, 0, 0, '1', 0);
|
||||
-- author: wangshuai---date:20221126 -for:首页用户设置用户编辑敏感权限
|
||||
|
||||
|
||||
|
||||
-- 租户邀请用户按钮权限菜单
|
||||
UPDATE sys_permission SET is_leaf = 0 WHERE id = '1280350452934307841';
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1600105607009165314', '1280350452934307841', '邀请用户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:invitation:user', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-06 20:31:20', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1600108123037917186', '1280350452934307841', '通过租户id获取用户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:user:list', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-06 20:41:20', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1600129606082650113', '1280350452934307841', '租户请离', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:leave', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-06 22:06:42', NULL, NULL, 0, 0, '1', 0);
|
||||
-- author: wangshuai---date:20221209--for:租户改造新增字段、菜单权限、字典-----
|
||||
|
||||
|
||||
|
||||
-- -author:scott---date:2022-12-30---for:增加查询全部用户接口、原用户接口改成租户下的用户接口,支持租户隔离---
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('1592135223910765570', '3f915b2769fc80648e92d04e84ca059d', '查询全部用户', NULL, NULL, 0, NULL, NULL, 2, 'system:user:listAll', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-14 19:20:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`)
|
||||
VALUES ('119213522910765570', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '租户用户', '/system/user/tenantUserList', 'system/user/TenantUserList', 1, NULL, NULL, 1, NULL, NULL, 3.2, 0, 'ant-design:user', 1, 0, 0, 0, NULL, NULL, '2018-12-25 20:34:38', 'admin', '2022-12-30 10:11:27', 0, 0, NULL, 0);
|
||||
-- -author:scott---date:2022-12-30---for:增加查询全部用户接口、原用户接口改成租户下的用户接口,支持租户隔离---
|
||||
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1609123240547344385', '1280350452934307841', '产品包分页列表查询', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:packList', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-31 17:44:11', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1609123437247619074', '1280350452934307841', '创建租户产品包', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:add:pack', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-31 17:44:58', 'admin', '2022-12-31 20:27:56', 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1609164542165012482', '1280350452934307841', '编辑租户产品包', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:edit:pack', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-31 20:28:18', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1609164635442139138', '1280350452934307841', '批量删除租户产品包', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:delete:pack', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-31 20:28:41', NULL, NULL, 0, 0, '1', 0);
|
||||
-- -author:wangshuai---date:2023-01-04---for: 产品包升级sql
|
||||
|
||||
|
||||
-- 新增接口权限菜单:分页获取租户用户数据/通过用户id获取租户列表/更新用户租户关系状态/注销租户
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1611620416187969538', '1280350452934307841', '分页获取租户用户数据', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:tenantPageList', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-07 15:07:04', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1611620600003342337', '1280350452934307841', '通过用户id获取租户列表', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:getTenantListByUserId', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-07 15:07:48', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1611620654621569026', '1280350452934307841', '更新用户租户关系状态', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:updateUserTenantStatus', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-07 15:08:01', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1611620772498288641', '1280350452934307841', '注销租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:cancelTenant', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-07 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
-- author:wangshuai---date:2023-01-09---for: 关系表状态修改/租户表增加逻辑删除/新增接口权限菜单
|
||||
|
||||
-- author:scott---date:2023-01-09---for: 租户修改注解权限
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('1612438989792034818', '1280350452934307841', '编辑租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-07 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
-- author:scott---date:2023-01-09---for: 租户修改注解权限
|
||||
|
||||
-- -author:scott---date:2023-01-11--for:租户安全加强,因为id规则暴露了,很不安全
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1611620772498218641', '1280350452934307841', '查询租户列表', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:list', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-11 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1621620772498288641', '1280350452934307841', '添加租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-11 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1611650772498288641', '1280350452934307841', '删除租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-11 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1613620712498288641', '1280350452934307841', '批量删除租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-11 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES
|
||||
('1697220712498288641', '1280350452934307841', '根据ids查询租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:queryList', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-11 15:08:29', NULL, NULL, 0, 0, '1', 0);
|
||||
-- -author:scott---date:2023-01-11--for:租户安全加强,因为id规则暴露了,很不安全
|
||||
|
||||
|
||||
-- -author:scott---date:2023-01-11--for:增加一个查询全部角色,不做租户隔离的接口
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1592120224120850434', '190c2b43bec6a5f7a4194a85db67d96a', '查询全部角色不租户隔离', NULL, NULL, 0, NULL, NULL, 2, 'system:role:queryallNoByTenant', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-11 19:41:18', NULL, NULL, 0, 0, '1', 0);
|
||||
-- -author:scott---date:2023-01-11--for:增加一个查询全部角色,不做租户隔离的接口
|
||||
|
||||
|
||||
|
||||
-- -author:scott---date:2023-01-31--for:用户敏感接口【通过id获取用户信息、通过id查询用户角色】,加权限
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1d592115213910765570', '3f915b2769fc80648e92d04e84ca059d', '通过ID查询用户拥有的角色', NULL, NULL, 0, NULL, NULL, 2, 'system:user:queryUserRole', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-14 19:20:22', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('15c92115213910765570', '3f915b2769fc80648e92d04e84ca059d', '通过ID查询用户信息接口', NULL, NULL, 0, NULL, NULL, 2, 'system:user:queryById', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-14 19:20:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('159d2115213910765570', '3f915b2769fc80648e92d04e84ca059d', '通过ID查询用户拥有的角色', NULL, NULL, 0, NULL, NULL, 2, 'system:user:queryUserRole', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-14 19:20:22', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('15s92115213910765570', '3f915b2769fc80648e92d04e84ca059d', '通过ID查询用户信息接口', NULL, NULL, 0, NULL, NULL, 2, 'system:user:queryById', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-14 19:20:22', NULL, NULL, 0, 0, '1', 0);
|
||||
-- -author:scott---date:2023-01-31--for:用户敏感接口【通过id获取用户信息、通过id查询用户角色】,加权限
|
||||
|
||||
|
||||
|
||||
-- -author:wangshuai---date:2023-02-02--for:[QQYUN-3959]新增回收站接口权限
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1620261087828418562', '1280350452934307841', '获取租户删除的列表', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:recycleBinPageList', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-31 11:22:01', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1620305415648989186', '1280350452934307841', '彻底删除租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:deleteTenantLogic', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-31 14:18:10', 'admin', '2023-01-31 14:19:51', 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1620327825894981634', '1280350452934307841', '租户还原', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:revertTenantLogic', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-31 15:47:13', NULL, NULL, 0, 0, '1', 0);
|
||||
-- -author:wangshuai---date:2023-02-02--for:[QQYUN-3959]新增回收站接口权限
|
||||
|
||||
|
||||
-- -author:wangshuai---date:2023-02-02--for:[QQYUN-3959]vue2菜单新增租户回收站接口权限
|
||||
UPDATE sys_permission_v2 SET is_leaf = 0 WHERE id = '1280350452934307841';
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1620261087828418562', '1280350452934307841', '获取租户删除的列表', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:recycleBinPageList', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-31 11:22:01', NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1620305415648989186', '1280350452934307841', '彻底删除租户', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:deleteTenantLogic', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-31 14:18:10', 'admin', '2023-01-31 14:19:51', 0, 0, '1', 0);
|
||||
INSERT INTO sys_permission_v2(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1620327825894981634', '1280350452934307841', '租户还原', NULL, NULL, 0, NULL, NULL, 2, 'system:tenant:revertTenantLogic', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-01-31 15:47:13', NULL, NULL, 0, 0, '1', 0);
|
||||
-- -author:wangshuai---date:2023-02-02--for:[QQYUN-3959]vue2菜单新增租户回收站接口权限
|
||||
|
||||
|
||||
|
||||
|
||||
-- author:wangshuai ---date:2022-11-23 for:新增在线用户菜单----
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1594930803956920321', '1439398677984878593', '在线用户', '/system/onlineuser', 'system/onlineuser/OnlineUserList', 1, '', NULL, 1, NULL, '0', 12.00, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-22 13:48:31', 'admin', '2022-11-23 19:35:10', 0, 0, NULL, 0);
|
||||
-- author:wangshuai ---date:2022-11-23 for:新增在线用户菜单----
|
||||
|
||||
-- author:wangshuai ---date:2022-11-25 for:新增用户设置菜单----
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1596141938193747970', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '用户设置', '/system/usersetting', 'system/usersetting/UserSetting', 1, '', NULL, 1, NULL, '0', 12.00, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-11-25 22:01:08', 'admin', '2022-11-25 22:01:21', 0, 0, NULL, 0);
|
||||
-- author:wangshuai ---date:2022-11-25 for:新增用户设置菜单----
|
||||
|
||||
-- author:scott ---date:2022-11-29 for:新增租户角色功能----
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1597419994965786625', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '租户角色', '/system/role/TenantRoleList', 'system/role/TenantRoleList', 1, '', NULL, 1, NULL, '0', 3.10, 0, 'ant-design:line-height-outlined', 1, 0, 0, 0, NULL, 'admin', '2022-11-29 10:39:40', 'admin', '2022-11-29 11:08:05', 0, 0, NULL, 0);
|
||||
-- author:scott ---date:2022-11-29 for:新增租户角色功能----
|
||||
|
||||
-- author:wangshuai ---date:2022-11-30 for:用户设置菜单路由隐藏----
|
||||
UPDATE sys_permission SET hidden = 1 WHERE id = '1596141938193747970';
|
||||
-- author:wangshuai ---date:2022-11-30 for:用户设置菜单路由隐藏----
|
|
@ -0,0 +1,257 @@
|
|||
-- author: scott---date:20221009 -for: 乐观锁测试
|
||||
ALTER TABLE `demo`
|
||||
ADD COLUMN `update_count` int NULL COMMENT '乐观锁测试' AFTER `tenant_id`;
|
||||
-- author: scott---date:20221009 -for: 乐观锁测试
|
||||
|
||||
-- author: scott---date:20221108 -for:VUEN-2064 改造登录选择部门和租户逻辑
|
||||
ALTER TABLE `sys_user`
|
||||
ADD COLUMN `login_tenant_id` int NULL COMMENT '上次登录选择租户ID' AFTER `client_id`;
|
||||
-- author: scott---date:20221108 -for:VUEN-2064 改造登录选择部门和租户逻辑
|
||||
|
||||
-- author: scott---date:20221129-for: 系统管理模块支持多租户机制,默认加字段[tenant_id]-----
|
||||
ALTER TABLE `sys_depart`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_role`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_dict`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_position`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_category`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_data_source`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_announcement`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
|
||||
ALTER TABLE `sys_user_role`
|
||||
ADD COLUMN `tenant_id` int(10) NULL DEFAULT 0 COMMENT '租户ID';
|
||||
-- author: scott---date:20221129--for:系统管理模块支持多租户机制,默认加字段[tenant_id]-----
|
||||
|
||||
-- author: wangshuai---date:20221209--for:租户改造新增字段、菜单权限、字典-----
|
||||
ALTER TABLE sys_tenant
|
||||
ADD COLUMN trade varchar(10) NULL COMMENT '所属行业' AFTER status,
|
||||
ADD COLUMN company_size varchar(10) NULL COMMENT '公司规模' AFTER trade,
|
||||
ADD COLUMN company_address varchar(100) NULL COMMENT '公司地址' AFTER company_size,
|
||||
ADD COLUMN company_logo varchar(200) NULL COMMENT '公司logo' AFTER company_address;
|
||||
|
||||
-- 所属行业字典
|
||||
INSERT INTO sys_dict(id, dict_name, dict_code, description, del_flag, create_by, create_time, update_by, update_time, type, tenant_id) VALUES ('1600042215909134338', '所属行业', 'trade', '行业', 0, 'admin', '2022-12-06 16:19:26', 'admin', '2022-12-06 16:20:50', 0, 0);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600042651777011713', '1600042215909134338', '信息传输、软件和信息技术服务业', '1', NULL, 1, 1, 'admin', '2022-12-06 16:21:10', 'admin', '2022-12-06 16:21:27');
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600042736254488578', '1600042215909134338', '制造业', '2', NULL, 1, 1, 'admin', '2022-12-06 16:21:30', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600042785646612481', '1600042215909134338', '租赁和商务服务业', '3', NULL, 1, 1, 'admin', '2022-12-06 16:21:42', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600042835433000961', '1600042215909134338', '教育', '4', NULL, 1, 1, 'admin', '2022-12-06 16:21:54', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600042892072882177', '1600042215909134338', '金融业', '5', NULL, 1, 1, 'admin', '2022-12-06 16:22:07', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600042975539531778', '1600042215909134338', '建筑业', '6', NULL, 1, 1, 'admin', '2022-12-06 16:22:27', 'admin', '2022-12-06 16:22:32');
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043052177854466', '1600042215909134338', '科学研究和技术服务业', '7', NULL, 1, 1, 'admin', '2022-12-06 16:22:46', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043101976825857', '1600042215909134338', '批发和零售业', '8', NULL, 1, 1, 'admin', '2022-12-06 16:22:58', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043157069008898', '1600042215909134338', '住宿和餐饮业', '9', NULL, 1, 1, 'admin', '2022-12-06 16:23:11', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043203105689601', '1600042215909134338', '电子商务', '10', NULL, 1, 1, 'admin', '2022-12-06 16:23:22', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043277504253953', '1600042215909134338', '线下零售与服务业', '11', NULL, 1, 1, 'admin', '2022-12-06 16:23:39', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043334618091521', '1600042215909134338', '文化、体育和娱乐业', '12', NULL, 1, 1, 'admin', '2022-12-06 16:23:53', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043401030701058', '1600042215909134338', '房地产业', '13', NULL, 1, 1, 'admin', '2022-12-06 16:24:09', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043476440092673', '1600042215909134338', '交通运输、仓储和邮政业', '14', NULL, 1, 1, 'admin', '2022-12-06 16:24:27', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043553837584386', '1600042215909134338', '卫生和社会工作', '15', NULL, 1, 1, 'admin', '2022-12-06 16:24:45', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043628793991170', '1600042215909134338', '公共管理、社会保障和社会组织', '16', NULL, 1, 1, 'admin', '2022-12-06 16:25:03', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043675329794050', '1600042215909134338', '电力、热力、燃气及水生产和供应业', '18', NULL, 1, 1, 'admin', '2022-12-06 16:25:14', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043734607892482', '1600042215909134338', '水利、环境和公共设施管理业', '19', NULL, 1, 1, 'admin', '2022-12-06 16:25:28', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043783068880897', '1600042215909134338', '居民服务、修理和其他服务业', '20', NULL, 1, 1, 'admin', '2022-12-06 16:25:40', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043822679887874', '1600042215909134338', '政府机构', '21', NULL, 1, 1, 'admin', '2022-12-06 16:25:49', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043859539431426', '1600042215909134338', '农、林、牧、渔业', '22', NULL, 1, 1, 'admin', '2022-12-06 16:25:58', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043907551629313', '1600042215909134338', '采矿业', '23', NULL, 1, 1, 'admin', '2022-12-06 16:26:10', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043955731599362', '1600042215909134338', '国际组织', '24', NULL, 1, 1, 'admin', '2022-12-06 16:26:21', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600043991685173249', '1600042215909134338', '其他', '25', NULL, 1, 1, 'admin', '2022-12-06 16:26:30', NULL, NULL);
|
||||
|
||||
-- 公司规模字典
|
||||
INSERT INTO sys_dict(id, dict_name, dict_code, description, del_flag, create_by, create_time, update_by, update_time, type, tenant_id) VALUES ('1600044537800331266', '公司规模', 'company_size', '公司规模', 0, 'admin', '2022-12-06 16:28:40', 'admin', '2022-12-06 16:30:23', 0, 0);
|
||||
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600044644096577538', '1600044537800331266', '20人以下', '1', NULL, 1, 1, 'admin', '2022-12-06 16:29:05', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600044698618335233', '1600044537800331266', '21-99人', '2', NULL, 1, 1, 'admin', '2022-12-06 16:29:18', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600044744172670978', '1600044537800331266', '100-499人', '3', NULL, 1, 1, 'admin', '2022-12-06 16:29:29', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600044792306503681', '1600044537800331266', '500-999人', '4', NULL, 1, 1, 'admin', '2022-12-06 16:29:41', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600044861302804481', '1600044537800331266', '1000-9999人', '5', NULL, 1, 1, 'admin', '2022-12-06 16:29:57', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1600044924313833473', '1600044537800331266', '10000人以上', '6', NULL, 1, 1, 'admin', '2022-12-06 16:30:12', NULL, NULL);
|
||||
|
||||
|
||||
|
||||
-- author: scott---date:20221227--for:字典增加应用ID-----
|
||||
ALTER TABLE `sys_dict`
|
||||
ADD COLUMN `low_app_id` varchar(32) NULL COMMENT '低代码应用ID' AFTER `tenant_id`;
|
||||
-- author: scott---date:20221227--for:字典增加应用ID-----
|
||||
|
||||
-- author: scott---date:20221227--for:租户ID改成10位整数-----
|
||||
ALTER TABLE `sys_tenant`
|
||||
MODIFY COLUMN `id` int(10) NOT NULL COMMENT '租户编码' FIRST;
|
||||
-- author: scott---date:20221227--for:租户ID改成10位整数-----
|
||||
|
||||
-- author: wangshuai---date:20221229--for:[QQYUN-3608]租户逻辑改造-----
|
||||
-- 新增租户中间表
|
||||
CREATE TABLE sys_user_tenant(
|
||||
id varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键id',
|
||||
user_id varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户id',
|
||||
tenant_id int(10) NULL DEFAULT NULL COMMENT '租户id',
|
||||
status varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态(0 冻结 1 正常)',
|
||||
create_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人登录名称',
|
||||
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
|
||||
update_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人登录名称',
|
||||
update_time datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
|
||||
PRIMARY KEY (id) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户租户关系表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- 职级字典
|
||||
INSERT INTO sys_dict(id, dict_name, dict_code, description, del_flag, create_by, create_time, update_by, update_time, type, tenant_id) VALUES ('1606645341269299201', '职级', 'company_rank', '公司职级', 0, 'admin', '2022-12-24 21:37:54', 'admin', '2022-12-24 21:38:25', 0, 0);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606645562573361153', '1606645341269299201', '总裁/总经理/CEO', '1', NULL, 1, 1, 'admin', '2022-12-24 21:38:47', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606645619930468354', '1606645341269299201', '副总裁/副总经理/VP', '2', NULL, 2, 1, 'admin', '2022-12-24 21:39:00', 'admin', '2022-12-24 21:40:00');
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606645660241924097', '1606645341269299201', '总监/主管/经理', '3', NULL, 3, 1, 'admin', '2022-12-24 21:39:10', 'admin', '2022-12-24 21:39:41');
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606645696715591682', '1606645341269299201', '员工/专员/执行', '4', NULL, 4, 1, 'admin', '2022-12-24 21:39:19', 'admin', '2022-12-24 21:39:37');
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606645744023146497', '1606645341269299201', '其他', '5', NULL, 5, 1, 'admin', '2022-12-24 21:39:30', NULL, NULL);
|
||||
-- 部门字典
|
||||
INSERT INTO sys_dict(id, dict_name, dict_code, description, del_flag, create_by, create_time, update_by, update_time, type, tenant_id) VALUES ('1606646440684457986', '公司部门', 'company_department', '公司部门', 0, 'admin', '2022-12-24 21:42:16', NULL, NULL, 0, 0);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647668965412866', '1606646440684457986', '总经办', '1', NULL, 1, 1, 'admin', '2022-12-24 21:47:09', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647703098658817', '1606646440684457986', '技术/IT/研发', '2', NULL, 2, 1, 'admin', '2022-12-24 21:47:17', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647737919770625', '1606646440684457986', '产品/设计', '3', NULL, 3, 1, 'admin', '2022-12-24 21:47:25', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647789614567425', '1606646440684457986', '销售/市场/运营', '4', '', 4, 1, 'admin', '2022-12-24 21:47:38', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647827921145857', '1606646440684457986', '人事/财务/行政', '5', NULL, 5, 1, 'admin', '2022-12-24 21:47:47', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647860955484162', '1606646440684457986', '资源/仓储/采购', '6', NULL, 6, 1, 'admin', '2022-12-24 21:47:55', NULL, NULL);
|
||||
INSERT INTO sys_dict_item(id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time) VALUES ('1606647915473047553', '1606646440684457986', '其他', '7', NULL, 7, 1, 'admin', '2022-12-24 21:48:08', NULL, NULL);
|
||||
|
||||
-- 租户新增字段
|
||||
ALTER TABLE sys_tenant
|
||||
ADD COLUMN house_number varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门牌号' AFTER company_logo,
|
||||
ADD COLUMN work_place varchar(100) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '工作地点' AFTER house_number,
|
||||
ADD COLUMN secondary_domain varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '二级域名' AFTER work_place,
|
||||
ADD COLUMN login_bkgd_img varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录背景图片' AFTER secondary_domain,
|
||||
ADD COLUMN position varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '职级' AFTER login_bkgd_img,
|
||||
ADD COLUMN department varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门' AFTER position;
|
||||
|
||||
-- 移除用户多租户id
|
||||
ALTER TABLE sys_user
|
||||
DROP COLUMN rel_tenant_ids;
|
||||
-- author: wangshuai---date:20221229--for:[QQYUN-3608]租户逻辑改造-----
|
||||
|
||||
-- author: wangshuai---date:20221229--for:租户表创建查询索引,避免数据量大查询慢-----
|
||||
ALTER TABLE sys_user_tenant
|
||||
ADD INDEX idx_sut_user_id(user_id) USING BTREE,
|
||||
ADD INDEX idx_sut_tenant_id(tenant_id) USING BTREE;
|
||||
-- author: wangshuai---date:20221229--for:租户表创建查询索引,避免数据量大查询慢-----
|
||||
|
||||
|
||||
-- -author:wangshuai---date:2023-01-04---for: 产品包升级sql
|
||||
CREATE TABLE sys_pack_permission (
|
||||
id varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键编号',
|
||||
pack_id varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户产品包名称',
|
||||
permission_id varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单id',
|
||||
create_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
create_time date NULL DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
update_time date NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (id) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租户产品包和菜单关系表' ROW_FORMAT = Dynamic;
|
||||
|
||||
CREATE TABLE sys_tenant_pack (
|
||||
id varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键id',
|
||||
tenant_id int(10) NULL DEFAULT NULL COMMENT '租户id',
|
||||
pack_name varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品包名',
|
||||
status varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '开启状态(0 未开启 1开启)',
|
||||
remarks varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||
create_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
create_time date NULL DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
update_time date NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (id) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租户产品包' ROW_FORMAT = Dynamic;
|
||||
|
||||
|
||||
|
||||
-- author:wangshuai---date:2023-01-09---for: 关系表状态修改/租户表增加逻辑删除/新增接口权限菜单
|
||||
-- 关系表状态修改
|
||||
ALTER TABLE sys_user_tenant
|
||||
MODIFY COLUMN status varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态(1 正常 2 冻结 3 待审核 4 拒绝)' AFTER tenant_id;
|
||||
|
||||
-- 租户表增加逻辑删除
|
||||
ALTER TABLE sys_tenant
|
||||
ADD COLUMN del_flag tinyint(1) NULL DEFAULT NULL COMMENT '删除状态(0-正常,1-已删除)' AFTER department;
|
||||
|
||||
ALTER TABLE `sys_tenant`
|
||||
MODIFY COLUMN `del_flag` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态(0-正常,1-已删除)' AFTER `department`;
|
||||
|
||||
-- 需要将租户删除状态改成0正常,否则可能导致数据出不来
|
||||
update sys_tenant set del_flag = 0;
|
||||
|
||||
|
||||
-- -author:wangshuai---date:2023-01-11--for:【QQYUN-3938】租户表加修改人、修改时间
|
||||
ALTER TABLE sys_tenant
|
||||
ADD COLUMN update_by varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人' AFTER del_flag,
|
||||
ADD COLUMN update_time datetime(0) NULL DEFAULT NULL COMMENT '更新时间' AFTER update_by;
|
||||
-- -author:wangshuai---date:2023-01-11--for:【QQYUN-3938】租户表加修改人、修改时间
|
||||
|
||||
-- -author:wangshuai---date:2023-01-11--for:用户租户修改离职状态
|
||||
ALTER TABLE sys_user_tenant
|
||||
MODIFY COLUMN status varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态(1 正常 2 离职 3 待审核 4 审核未通过)' AFTER tenant_id;
|
||||
-- -author:wangshuai---date:2023-01-11--for:用户租户修改离职状态
|
||||
|
||||
|
||||
|
||||
-- -author:wangshuai---date:2023-02-02--for:[QQYUN-3988]租户产品包表改名
|
||||
ALTER TABLE sys_pack_permission RENAME sys_tenant_pack_perms;
|
||||
-- -author:wangshuai---date:2023-02-02--for:[QQYUN-3988]租户产品包表改名
|
||||
|
||||
-- -author:zyf---date:2023-02-02--for:添加流程离职入职状态
|
||||
ALTER TABLE sys_user
|
||||
ADD COLUMN bpm_status varchar(2) NULL DEFAULT NULL COMMENT '流程入职离职状态';
|
||||
-- -author:zyf---date:2023-02-02--for:添加流程离职入职状态
|
||||
|
||||
-- -author:scott---date:2023-02-08--for:尽量不要用大字段,会出问题
|
||||
ALTER TABLE `sys_user`
|
||||
MODIFY COLUMN `depart_ids` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负责部门' AFTER `user_identity`;
|
||||
-- -author:scott---date:2023-02-08--for:尽量不要用大字段,会出问题
|
||||
|
||||
-- -author:wangshuai---date:2023-02-16--for:[QQYUN-4163]部门新增是否叶子结点
|
||||
ALTER TABLE sys_depart
|
||||
ADD COLUMN iz_leaf tinyint(1) NULL DEFAULT 0 COMMENT '是否有叶子节点: 1是0否' AFTER tenant_id;
|
||||
-- 更新父级部门不为叶子结点
|
||||
update sys_depart set iz_leaf = 0 where id in ( select a.parent_id from (select parent_id from sys_depart where parent_id!='' and parent_id is not null) as a);
|
||||
-- -author:wangshuai---date:2023-02-16--for:[QQYUN-4163]部门新增是否叶子结点
|
||||
|
||||
|
||||
-- -author: taoyan---date:2023-02-17--for:QQYUN-3851【租户】租户管理员功能
|
||||
ALTER TABLE `sys_tenant_pack`
|
||||
ADD COLUMN `pack_code` varchar(50) NULL COMMENT '编码,默认添加的三个管理员需要设置编码' AFTER `update_time`;
|
||||
|
||||
ALTER TABLE `sys_log`
|
||||
ADD COLUMN `tenant_id` int(10) NULL COMMENT '租户ID' AFTER `update_time`;
|
||||
|
||||
|
||||
CREATE TABLE `sys_tenant_pack_user` (
|
||||
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`pack_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户产品包ID',
|
||||
`user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户ID',
|
||||
`tenant_id` int(10) NULL DEFAULT NULL COMMENT '租户ID',
|
||||
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租户套餐人员表' ROW_FORMAT = Dynamic;
|
||||
|
||||
ALTER TABLE `sys_tenant_pack_user`
|
||||
ADD COLUMN `status` int(3) NULL COMMENT '状态 正常状态1 申请状态0' AFTER `update_time`;
|
||||
|
||||
ALTER TABLE `sys_tenant`
|
||||
ADD COLUMN `apply_status` int(3) NULL COMMENT '允许申请管理员 1允许 0不允许' AFTER `update_time`;
|
||||
update sys_tenant set apply_status = 1;
|
||||
|
||||
ALTER TABLE `sys_log`
|
||||
MODIFY COLUMN `log_type` int(3) NULL DEFAULT NULL COMMENT '日志类型(1登录日志,2操作日志, 3.租户操作日志)' AFTER `id`;
|
||||
-- -author: taoyan---date:2023-02-17--for:QQYUN-3851【租户】租户管理员功能
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -2,14 +2,43 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.4.4</version>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<name>aliyun Repository</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jeecg</id>
|
||||
<name>jeecg Repository</name>
|
||||
<url>https://maven.jeecg.org/nexus/content/repositories/jeecg</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jeecg-snapshots</id>
|
||||
<name>jeecg-snapshots Repository</name>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!--jeecg-tools-->
|
||||
<dependency>
|
||||
|
@ -174,8 +203,18 @@
|
|||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<groupId>xerces</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.2</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- mini文件存储服务 -->
|
||||
<dependency>
|
||||
|
@ -209,6 +248,10 @@
|
|||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-kotlin</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -50,6 +50,11 @@ public class LogDTO implements Serializable {
|
|||
/**操作人用户账户*/
|
||||
private String userid;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private Integer tenantId;
|
||||
|
||||
public LogDTO(){
|
||||
|
||||
}
|
||||
|
|
|
@ -71,7 +71,12 @@ public class MessageDTO implements Serializable {
|
|||
protected Map<String, Object> data;
|
||||
//update-end---author:taoyan ---date::20220705 for:支持自定义推送类型,邮件、钉钉、企业微信、系统消息-----------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 抄送人
|
||||
*/
|
||||
private String copyToUser;
|
||||
|
||||
public MessageDTO(){
|
||||
}
|
||||
|
|
|
@ -152,10 +152,11 @@ public interface CommonConstant {
|
|||
Integer RULE_FLAG_1 = 1;
|
||||
|
||||
/**
|
||||
* 是否用户已被冻结 1正常(解冻) 2冻结
|
||||
* 是否用户已被冻结 1正常(解冻) 2冻结 3离职
|
||||
*/
|
||||
Integer USER_UNFREEZE = 1;
|
||||
Integer USER_FREEZE = 2;
|
||||
Integer USER_QUIT = 3;
|
||||
|
||||
/**字典翻译文本后缀*/
|
||||
String DICT_TEXT_SUFFIX = "_dictText";
|
||||
|
@ -312,8 +313,8 @@ public interface CommonConstant {
|
|||
String X_ACCESS_TOKEN = "X-Access-Token";
|
||||
String X_SIGN = "X-Sign";
|
||||
String X_TIMESTAMP = "X-TIMESTAMP";
|
||||
/** 租户 请求头*/
|
||||
String TENANT_ID = "tenant-id";
|
||||
/** 租户请求头 更名为:X-Tenant-Id */
|
||||
String TENANT_ID = "X-Tenant-Id";
|
||||
/**===============================================================================================*/
|
||||
|
||||
String TOKEN_IS_INVALID_MSG = "Token失效,请重新登录!";
|
||||
|
@ -425,4 +426,68 @@ public interface CommonConstant {
|
|||
*/
|
||||
String PHONE_REDIS_KEY_PRE = "phone_msg";
|
||||
|
||||
/**
|
||||
* 是文件夹
|
||||
*/
|
||||
String IT_IS_FOLDER = "1";
|
||||
|
||||
/**
|
||||
* 文件拥有者
|
||||
*/
|
||||
String FILE_OWNER = "owner";
|
||||
|
||||
/**
|
||||
* 文件管理员
|
||||
*/
|
||||
String FILE_ADMIN = "admin";
|
||||
|
||||
/**
|
||||
* 只允许编辑
|
||||
*/
|
||||
String FILE_EDITABLE = "editable";
|
||||
|
||||
/**
|
||||
* 登录失败,用于记录失败次数的key
|
||||
*/
|
||||
String LOGIN_FAIL = "LOGIN_FAIL_";
|
||||
|
||||
/**
|
||||
* 入职事件
|
||||
*/
|
||||
Integer BPM_USER_EVENT_ADD = 1;
|
||||
|
||||
/**
|
||||
* 离职事件
|
||||
*/
|
||||
Integer BPM_USER_EVENT_LEVEL = 2;
|
||||
|
||||
/**
|
||||
* 用户租户状态(正常/已通过审核的)
|
||||
*/
|
||||
String USER_TENANT_NORMAL = "1";
|
||||
|
||||
/**
|
||||
* 用户租户状态(离职)
|
||||
*/
|
||||
String USER_TENANT_QUIT = "2";
|
||||
|
||||
/**
|
||||
* 用户租户状态(审核中)
|
||||
*/
|
||||
String USER_TENANT_UNDER_REVIEW = "3";
|
||||
|
||||
/**
|
||||
* 用户租户状态(拒绝)
|
||||
*/
|
||||
String USER_TENANT_REFUSE = "4";
|
||||
|
||||
/**
|
||||
* 不是叶子节点
|
||||
*/
|
||||
Integer NOT_LEAF = 0;
|
||||
|
||||
/**
|
||||
* 是叶子节点
|
||||
*/
|
||||
Integer IS_LEAF = 1;
|
||||
}
|
||||
|
|
|
@ -139,16 +139,6 @@ public interface DataBaseConstant {
|
|||
public static final String BPM_STATUS_TABLE = "bpm_status";
|
||||
//*********系统建表标准字段****************************************
|
||||
|
||||
|
||||
/**
|
||||
* 租户ID 实体字段名
|
||||
*/
|
||||
String TENANT_ID = "tenantId";
|
||||
/**
|
||||
* 租户ID 数据库字段名
|
||||
*/
|
||||
String TENANT_ID_TABLE = "tenant_id";
|
||||
|
||||
/**
|
||||
* sql语句 where
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,18 @@ public interface ServiceNameConstants {
|
|||
* 微服务名: demo模块
|
||||
*/
|
||||
String SERVICE_DEMO = "jeecg-demo";
|
||||
/**
|
||||
* 微服务名:online在线模块
|
||||
*/
|
||||
String SERVICE_ONLINE = "jeecg-online";
|
||||
/**
|
||||
* 微服务名:OA模块
|
||||
*/
|
||||
String SERVICE_EOA = "jeecg-eoa";
|
||||
/**
|
||||
* 微服务名:表单设计模块
|
||||
*/
|
||||
String SERVICE_FORM = "jeecg-desform";
|
||||
|
||||
/**
|
||||
* gateway通过header传递根路径 basePath
|
||||
|
|
|
@ -6,17 +6,45 @@ package org.jeecg.common.constant;
|
|||
* @date: 2022年08月29日 15:29
|
||||
*/
|
||||
public interface TenantConstant {
|
||||
|
||||
/*------【低代码应用参数】----------------------------------------------*/
|
||||
/**
|
||||
* 应用ID——表字段
|
||||
* header的lowAppId标识
|
||||
*/
|
||||
String DB_FIELD_LOW_APP_ID = "low_app_id";
|
||||
String X_LOW_APP_ID = "X-Low-App-ID";
|
||||
/**
|
||||
* 应用ID——实体字段
|
||||
*/
|
||||
String FIELD_LOW_APP_ID = "lowAppId";
|
||||
/**
|
||||
* 租户ID
|
||||
* 应用ID——表字段
|
||||
*/
|
||||
String DB_FIELD_LOW_APP_ID = "low_app_id";
|
||||
/*------【低代码应用参数】---------------------------------------------*/
|
||||
|
||||
/*--------【租户参数】-----------------------------------------------*/
|
||||
/**
|
||||
* 租户ID(实体字段名 和 url参数名)
|
||||
*/
|
||||
String TENANT_ID = "tenantId";
|
||||
/**
|
||||
* 租户ID 数据库字段名
|
||||
*/
|
||||
String TENANT_ID_TABLE = "tenant_id";
|
||||
/*-------【租户参数】-----------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 超级管理员
|
||||
*/
|
||||
String SUPER_ADMIN = "superAdmin";
|
||||
|
||||
/**
|
||||
* 组织账户管理员
|
||||
*/
|
||||
String ACCOUNT_ADMIN = "accountAdmin";
|
||||
|
||||
/**
|
||||
* 组织应用管理员
|
||||
*/
|
||||
String APP_ADMIN = "appAdmin";
|
||||
|
||||
}
|
||||
|
|
|
@ -21,5 +21,10 @@ public enum LowAppAopEnum {
|
|||
/**
|
||||
* Online表单专用:数据库表转Online表单
|
||||
*/
|
||||
CGFORM_DB_IMPORT
|
||||
CGFORM_DB_IMPORT,
|
||||
|
||||
/**
|
||||
* 表单设计器专用:子表转工作表
|
||||
*/
|
||||
DESFORM_SUB2WORK
|
||||
}
|
||||
|
|
|
@ -63,11 +63,12 @@ public class SensitiveInfoUtil {
|
|||
* @throws IllegalAccessException
|
||||
*/
|
||||
public static Object handlerObject(Object obj, boolean isEncode) throws IllegalAccessException {
|
||||
log.debug(" obj --> "+ obj.toString());
|
||||
long startTime=System.currentTimeMillis();
|
||||
if (oConvertUtils.isEmpty(obj)) {
|
||||
return obj;
|
||||
}
|
||||
long startTime=System.currentTimeMillis();
|
||||
log.debug(" obj --> "+ obj.toString());
|
||||
|
||||
// 判断是不是一个对象
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
|
|
|
@ -238,7 +238,7 @@ public class QueryGenerator {
|
|||
if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
|
||||
order = parameterMap.get(ORDER_TYPE)[0];
|
||||
}
|
||||
log.info("排序规则>>列:" + column + ",排序方式:" + order);
|
||||
log.debug("排序规则>>列:" + column + ",排序方式:" + order);
|
||||
|
||||
//update-begin-author:scott date:2022-11-07 for:避免用户自定义表无默认字段{创建时间},导致排序报错
|
||||
//TODO 避免用户自定义表无默认字段创建时间,导致排序报错
|
||||
|
|
|
@ -31,10 +31,22 @@ public enum QueryRuleEnum {
|
|||
RIGHT_LIKE("RIGHT_LIKE","right_like","右模糊"),
|
||||
/**查询规则 带加号等于*/
|
||||
EQ_WITH_ADD("EQWITHADD","eq_with_add","带加号等于"),
|
||||
// ------- 当前表单设计器内专用 -------
|
||||
/** 值为空 */
|
||||
EMPTY("EMPTY","empty","值为空"),
|
||||
/** 值不为空 */
|
||||
NOT_EMPTY("NOT_EMPTY","not_empty","值不为空"),
|
||||
/**查询规则 不包含*/
|
||||
NOT_IN("NOT_IN","not_in","不包含"),
|
||||
// ------- 当前表单设计器内专用 -------
|
||||
/**查询规则 多词模糊匹配*/
|
||||
LIKE_WITH_AND("LIKEWITHAND","like_with_and","多词模糊匹配————暂时未用上"),
|
||||
/**查询规则 自定义SQL片段*/
|
||||
SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段");
|
||||
SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段"),
|
||||
/**查询规则 多词匹配*/
|
||||
ELE_MATCH("ELE_MATCH","elemMatch","多词匹配"),
|
||||
/**查询规则 范围查询*/
|
||||
RANGE("RANGE","range","范围查询");
|
||||
|
||||
private String value;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.DataBaseConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.constant.TenantConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.system.vo.SysUserCacheInfo;
|
||||
|
@ -50,6 +51,7 @@ public class JwtUtil {
|
|||
// issues/I4YH95浏览器显示乱码问题
|
||||
httpServletResponse.setHeader("Content-type", "text/html;charset=UTF-8");
|
||||
Result jsonResult = new Result(code, errorMsg);
|
||||
jsonResult.setSuccess(false);
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = httpServletResponse.getOutputStream();
|
||||
|
@ -233,12 +235,8 @@ public class JwtUtil {
|
|||
returnValue = "1";
|
||||
}
|
||||
//update-begin-author:taoyan date:20210330 for:多租户ID作为系统变量
|
||||
else if (key.equals(DataBaseConstant.TENANT_ID) || key.toLowerCase().equals(DataBaseConstant.TENANT_ID_TABLE)){
|
||||
returnValue = sysUser.getRelTenantIds();
|
||||
boolean flag = returnValue != null && returnValue.indexOf(SymbolConstant.COMMA) > 0;
|
||||
if(oConvertUtils.isEmpty(returnValue) || flag){
|
||||
returnValue = SpringContextUtils.getHttpServletRequest().getHeader(CommonConstant.TENANT_ID);
|
||||
}
|
||||
else if (key.equals(TenantConstant.TENANT_ID) || key.toLowerCase().equals(TenantConstant.TENANT_ID_TABLE)){
|
||||
returnValue = SpringContextUtils.getHttpServletRequest().getHeader(CommonConstant.TENANT_ID);
|
||||
}
|
||||
//update-end-author:taoyan date:20210330 for:多租户ID作为系统变量
|
||||
if(returnValue!=null){returnValue = returnValue + moshi;}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class LoginUser {
|
|||
@SensitiveField
|
||||
private String telephone;
|
||||
|
||||
/**多租户id配置,编辑用户的时候设置*/
|
||||
/** 多租户ids临时用,不持久化数据库(数据库字段不存在) */
|
||||
private String relTenantIds;
|
||||
|
||||
/**设备id uniapp推送用*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
|
@ -351,4 +352,44 @@ public class CommonUtils {
|
|||
log.debug("-----Common getBaseUrl----- : " + baseDomainPath);
|
||||
return baseDomainPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归合并 fastJSON 对象
|
||||
*
|
||||
* @param target 目标对象
|
||||
* @param sources 来源对象,允许多个,优先级从左到右,最右侧的优先级最高
|
||||
*/
|
||||
public static JSONObject mergeJSON(JSONObject target, JSONObject... sources) {
|
||||
for (JSONObject source : sources) {
|
||||
CommonUtils.mergeJSON(target, source);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归合并 fastJSON 对象
|
||||
*
|
||||
* @param target 目标对象
|
||||
* @param source 来源对象
|
||||
*/
|
||||
public static JSONObject mergeJSON(JSONObject target, JSONObject source) {
|
||||
for (String key : source.keySet()) {
|
||||
Object sourceItem = source.get(key);
|
||||
// 是否是 JSONObject
|
||||
if (sourceItem instanceof Map) {
|
||||
// target中存在此key
|
||||
if (target.containsKey(key)) {
|
||||
// 两个都是 JSONObject,继续合并
|
||||
if (target.get(key) instanceof Map) {
|
||||
CommonUtils.mergeJSON(target.getJSONObject(key), source.getJSONObject(key));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// target不存在此key,或不是 JSONObject,则覆盖
|
||||
target.put(key, sourceItem);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
|
@ -9,9 +12,6 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 类描述:时间操作定义类
|
||||
*
|
||||
|
@ -684,4 +684,80 @@ public class DateUtils extends PropertyEditorSupport {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个时间是否是同一天
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static boolean isSameDay(Date date1, Date date2) {
|
||||
if (date1 == null || date2 == null) {
|
||||
return false;
|
||||
}
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(date1);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(date2);
|
||||
boolean isSameYear = calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
|
||||
boolean isSameMonth = isSameYear && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH);
|
||||
return isSameMonth && calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个时间是否是同一周
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static boolean isSameWeek(Date date1, Date date2) {
|
||||
if (date1 == null || date2 == null) {
|
||||
return false;
|
||||
}
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(date1);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(date2);
|
||||
boolean isSameYear = calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
|
||||
return isSameYear && calendar1.get(Calendar.WEEK_OF_YEAR) == calendar2.get(Calendar.WEEK_OF_YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个时间是否是同一月
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static boolean isSameMonth(Date date1, Date date2) {
|
||||
if (date1 == null || date2 == null) {
|
||||
return false;
|
||||
}
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(date1);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(date2);
|
||||
boolean isSameYear = calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
|
||||
return isSameYear && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个时间是否是同一年
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static boolean isSameYear(Date date1, Date date2) {
|
||||
if (date1 == null || date2 == null) {
|
||||
return false;
|
||||
}
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(date1);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(date2);
|
||||
return calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,15 +9,15 @@ import org.apache.commons.lang3.StringUtils;
|
|||
public enum DySmsEnum {
|
||||
|
||||
/**登录短信模板编码*/
|
||||
LOGIN_TEMPLATE_CODE("SMS_175435174","JEECG","code"),
|
||||
LOGIN_TEMPLATE_CODE("SMS_175435174","敲敲云","code"),
|
||||
/**忘记密码短信模板编码*/
|
||||
FORGET_PASSWORD_TEMPLATE_CODE("SMS_175435174","JEECG","code"),
|
||||
/**注册账号短信模板编码*/
|
||||
REGISTER_TEMPLATE_CODE("SMS_175430166","JEECG","code"),
|
||||
FORGET_PASSWORD_TEMPLATE_CODE("SMS_175435174","敲敲云","code"),
|
||||
/**注册账号短信模板编码*/
|
||||
REGISTER_TEMPLATE_CODE("SMS_175430166","敲敲云","code"),
|
||||
/**会议通知*/
|
||||
MEET_NOTICE_TEMPLATE_CODE("SMS_201480469","H5活动之家","username,title,minute,time"),
|
||||
MEET_NOTICE_TEMPLATE_CODE("SMS_201480469","JEECG","username,title,minute,time"),
|
||||
/**我的计划通知*/
|
||||
PLAN_NOTICE_TEMPLATE_CODE("SMS_201470515","H5活动之家","username,title,time");
|
||||
PLAN_NOTICE_TEMPLATE_CODE("SMS_201470515","JEECG","username,title,time");
|
||||
|
||||
/**
|
||||
* 短信模板编码
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.jeecg.common.util;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.config.JeecgBaseConfig;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
|
@ -22,8 +21,9 @@ import java.util.Map;
|
|||
public class RestUtil {
|
||||
|
||||
private static String domain = null;
|
||||
|
||||
public static String getDomain() {
|
||||
private static String path = null;
|
||||
|
||||
private static String getDomain() {
|
||||
if (domain == null) {
|
||||
domain = SpringContextUtils.getDomain();
|
||||
// issues/2959
|
||||
|
@ -37,9 +37,7 @@ public class RestUtil {
|
|||
return domain;
|
||||
}
|
||||
|
||||
public static String path = null;
|
||||
|
||||
public static String getPath() {
|
||||
private static String getPath() {
|
||||
if (path == null) {
|
||||
path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
|
||||
}
|
||||
|
@ -47,18 +45,7 @@ public class RestUtil {
|
|||
}
|
||||
|
||||
public static String getBaseUrl() {
|
||||
String basepath = null;
|
||||
try {
|
||||
basepath = getDomain() + getPath();
|
||||
} catch (Exception e) {
|
||||
log.warn(e.getMessage(),e);
|
||||
}
|
||||
|
||||
//定时任务情况下,通过request是获取不到domain的,这种情况下通过配置获取pc后台域名
|
||||
if(oConvertUtils.isEmpty(basepath)){
|
||||
JeecgBaseConfig jeecgBaseConfig = SpringContextUtils.getBean(JeecgBaseConfig.class);
|
||||
basepath = jeecgBaseConfig.getDomainUrl().getPc();
|
||||
}
|
||||
String basepath = getDomain() + getPath();
|
||||
log.info(" RestUtil.getBaseUrl: " + basepath);
|
||||
return basepath;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.ServiceNameConstants;
|
||||
import org.springframework.beans.BeansException;
|
||||
|
@ -9,9 +12,6 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Description: spring上下文工具类
|
||||
* @author: jeecg-boot
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.jeecg.common.util;
|
|||
import cn.hutool.crypto.SecureUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.jeecg.common.api.CommonAPI;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.TenantConstant;
|
||||
import org.jeecg.common.desensitization.util.SensitiveInfoUtil;
|
||||
import org.jeecg.common.exception.JeecgBoot401Exception;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
|
@ -34,6 +35,34 @@ public class TokenUtils {
|
|||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 request 里传递的 tenantId (租户ID)
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static String getTenantIdByRequest(HttpServletRequest request) {
|
||||
String tenantId = request.getParameter(TenantConstant.TENANT_ID);
|
||||
if (tenantId == null) {
|
||||
tenantId = oConvertUtils.getString(request.getHeader(CommonConstant.TENANT_ID));
|
||||
}
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 request 里传递的 lowAppId (低代码应用ID)
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static String getLowAppIdByRequest(HttpServletRequest request) {
|
||||
String lowAppId = request.getParameter(TenantConstant.FIELD_LOW_APP_ID);
|
||||
if (lowAppId == null) {
|
||||
lowAppId = oConvertUtils.getString(request.getHeader(TenantConstant.X_LOW_APP_ID));
|
||||
}
|
||||
return lowAppId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证Token
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.aliyun.oss.model.CannedAccessControlList;
|
|||
import com.aliyun.oss.model.OSSObject;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.tomcat.util.http.fileupload.FileItemStream;
|
||||
import org.apache.commons.fileupload.FileItemStream;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.util.CommonUtils;
|
||||
|
@ -20,6 +20,7 @@ import java.io.BufferedInputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -141,10 +142,10 @@ public class OssBootUtil {
|
|||
log.info("------OSS文件上传成功------" + fileUrl);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(),e);
|
||||
return null;
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(),e);
|
||||
return null;
|
||||
}
|
||||
return filePath;
|
||||
|
|
|
@ -108,4 +108,12 @@ public class JeecgBaseConfig {
|
|||
public void setFileViewDomain(String fileViewDomain) {
|
||||
this.fileViewDomain = fileViewDomain;
|
||||
}
|
||||
|
||||
public String getUploadType() {
|
||||
return uploadType;
|
||||
}
|
||||
|
||||
public void setUploadType(String uploadType) {
|
||||
this.uploadType = uploadType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class WebSocketConfig {
|
|||
FilterRegistrationBean bean = new FilterRegistrationBean();
|
||||
bean.setFilter(websocketFilter());
|
||||
//TODO 临时注释掉,测试下线上socket总断的问题
|
||||
bean.addUrlPatterns("/websocket/*","/eoaSocket/*", "/newsWebsocket/*", "/vxeSocket/*");
|
||||
bean.addUrlPatterns("/websocket/*","/eoaSocket/*","/eoaNewChatSocket/*", "/newsWebsocket/*", "/vxeSocket/*");
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ import org.apache.ibatis.mapping.MappedStatement;
|
|||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.TenantConstant;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -82,6 +84,23 @@ public class MybatisInterceptor implements Interceptor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//注入租户ID(是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】)
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
if (TenantConstant.TENANT_ID.equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object localTenantId = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (localTenantId == null) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,12 @@ import java.util.List;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.TenantConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -28,22 +32,41 @@ import net.sf.jsqlparser.expression.LongValue;
|
|||
@Configuration
|
||||
@MapperScan(value={"org.jeecg.modules.**.mapper*"})
|
||||
public class MybatisPlusSaasConfig {
|
||||
|
||||
/**
|
||||
* tenant_id 字段名
|
||||
* 是否开启系统模块的租户隔离
|
||||
* 控制范围:用户、角色、部门、我的部门、字典、分类字典、多数据源、职务、通知公告
|
||||
*
|
||||
* 实现功能
|
||||
* 1.用户表通过硬编码实现租户ID隔离
|
||||
* 2.角色、部门、我的部门、字典、分类字典、多数据源、职务、通知公告除了硬编码还加入的 TENANT_TABLE 配置中,实现租户隔离更安全
|
||||
* 3.菜单表、租户表不做租户隔离
|
||||
* 4.通过拦截器MybatisInterceptor实现,增删改查数据 自动注入租户ID
|
||||
*/
|
||||
private static final String TENANT_FIELD_NAME = "tenant_id";
|
||||
public static final Boolean OPEN_SYSTEM_TENANT_CONTROL = false;
|
||||
|
||||
/**
|
||||
* 哪些表需要做多租户 表需要添加一个字段 tenant_id
|
||||
*/
|
||||
public static final List<String> TENANT_TABLE = new ArrayList<String>();
|
||||
|
||||
static {
|
||||
TENANT_TABLE.add("demo");
|
||||
//1.需要租户隔离的表请在此配置
|
||||
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
//a.系统管理表
|
||||
TENANT_TABLE.add("sys_role");
|
||||
TENANT_TABLE.add("sys_user_role");
|
||||
TENANT_TABLE.add("sys_depart");
|
||||
TENANT_TABLE.add("sys_category");
|
||||
TENANT_TABLE.add("sys_data_source");
|
||||
TENANT_TABLE.add("sys_position");
|
||||
TENANT_TABLE.add("sys_announcement");
|
||||
}
|
||||
|
||||
// //角色、菜单、部门
|
||||
// tenantTable.add("sys_role");
|
||||
// tenantTable.add("sys_permission");
|
||||
// tenantTable.add("sys_depart");
|
||||
//2.示例测试
|
||||
//TENANT_TABLE.add("demo");
|
||||
//3.online租户隔离测试
|
||||
//TENANT_TABLE.add("ceapp_issue");
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,13 +77,24 @@ public class MybatisPlusSaasConfig {
|
|||
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
String tenantId = oConvertUtils.getString(TenantContext.getTenant(),"0");
|
||||
String tenantId = TenantContext.getTenant();
|
||||
//如果通过线程获取租户ID为空,则通过当前请求的request获取租户(shiro排除拦截器的请求会获取不到租户ID)
|
||||
if(oConvertUtils.isEmpty(tenantId)){
|
||||
try {
|
||||
tenantId = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(oConvertUtils.isEmpty(tenantId)){
|
||||
tenantId = "0";
|
||||
}
|
||||
return new LongValue(tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenantIdColumn(){
|
||||
return TENANT_FIELD_NAME;
|
||||
return TenantConstant.TENANT_ID_TABLE;
|
||||
}
|
||||
|
||||
// 返回 true 表示不走租户逻辑
|
||||
|
@ -74,10 +108,12 @@ public class MybatisPlusSaasConfig {
|
|||
return true;
|
||||
}
|
||||
}));
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
//update-begin-author:zyf date:20220425 for:【VUEN-606】注入动态表名适配拦截器解决多表名问题
|
||||
interceptor.addInnerInterceptor(dynamicTableNameInnerInterceptor());
|
||||
//update-end-author:zyf date:20220425 for:【VUEN-606】注入动态表名适配拦截器解决多表名问题
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
//【jeecg-boot/issues/3847】增加@Version乐观锁支持
|
||||
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,19 +111,16 @@ public class ShiroConfig {
|
|||
filterChainDefinitionMap.put("/**/*.png", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.gif", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.ico", "anon");
|
||||
|
||||
// update-begin--Author:sunjianlei Date:20190813 for:排除字体格式的后缀
|
||||
filterChainDefinitionMap.put("/**/*.ttf", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.woff", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.woff2", "anon");
|
||||
// update-begin--Author:sunjianlei Date:20190813 for:排除字体格式的后缀
|
||||
|
||||
filterChainDefinitionMap.put("/druid/**", "anon");
|
||||
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
|
||||
filterChainDefinitionMap.put("/swagger**/**", "anon");
|
||||
filterChainDefinitionMap.put("/webjars/**", "anon");
|
||||
filterChainDefinitionMap.put("/v2/**", "anon");
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/sys/annountCement/show/**", "anon");
|
||||
|
||||
//积木报表排除
|
||||
|
@ -144,10 +141,8 @@ public class ShiroConfig {
|
|||
filterChainDefinitionMap.put("/newsWebsocket/**", "anon");//CMS模块
|
||||
filterChainDefinitionMap.put("/vxeSocket/**", "anon");//JVxeTable无痕刷新示例
|
||||
|
||||
|
||||
//性能监控,放开排除会存在安全漏洞泄露TOEKN(durid连接池也有)
|
||||
//性能监控——安全隐患泄露TOEKN(durid连接池也有)
|
||||
//filterChainDefinitionMap.put("/actuator/**", "anon");
|
||||
|
||||
//测试模块排除
|
||||
filterChainDefinitionMap.put("/test/seata/**", "anon");
|
||||
|
||||
|
|
|
@ -140,12 +140,17 @@ public class ShiroRealm extends AuthorizingRealm {
|
|||
String userTenantIds = loginUser.getRelTenantIds();
|
||||
if(oConvertUtils.isNotEmpty(userTenantIds)){
|
||||
String contextTenantId = TenantContext.getTenant();
|
||||
log.debug("登录租户:" + contextTenantId);
|
||||
log.debug("用户拥有那些租户:" + userTenantIds);
|
||||
//登录用户无租户,前端header中租户ID值为 0
|
||||
String str ="0";
|
||||
if(oConvertUtils.isNotEmpty(contextTenantId) && !str.equals(contextTenantId)){
|
||||
//update-begin-author:taoyan date:20211227 for: /issues/I4O14W 用户租户信息变更判断漏洞
|
||||
String[] arr = userTenantIds.split(",");
|
||||
if(!oConvertUtils.isIn(contextTenantId, arr)){
|
||||
throw new AuthenticationException("用户租户信息变更,请重新登陆!");
|
||||
log.info("租户异常——登录租户:" + contextTenantId);
|
||||
log.info("租户异常——用户拥有租户组:" + userTenantIds);
|
||||
throw new AuthenticationException("登录租户授权变更,请重新登陆!");
|
||||
}
|
||||
//update-end-author:taoyan date:20211227 for: /issues/I4O14W 用户租户信息变更判断漏洞
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.sign.util.BodyReaderHttpServletRequestWrapper;
|
||||
import org.jeecg.config.sign.util.HttpUtils;
|
||||
import org.jeecg.config.sign.util.SignUtil;
|
||||
|
@ -39,6 +40,18 @@ public class SignAuthInterceptor implements HandlerInterceptor {
|
|||
//对参数进行签名验证
|
||||
String headerSign = request.getHeader(CommonConstant.X_SIGN);
|
||||
String xTimestamp = request.getHeader(CommonConstant.X_TIMESTAMP);
|
||||
|
||||
if(oConvertUtils.isEmpty(xTimestamp)){
|
||||
Result<?> result = Result.error("Sign签名校验失败!");
|
||||
log.error("Sign 签名校验失败!Header xTimestamp 为空");
|
||||
//校验失败返回前端
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
PrintWriter out = response.getWriter();
|
||||
out.print(JSON.toJSON(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
//客户端时间
|
||||
Long clientTimestamp = Long.parseLong(xTimestamp);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<!-- 保存日志11 -->
|
||||
<insert id="saveLog" parameterType="Object">
|
||||
insert into sys_log (id, log_type, log_content, method, operate_type, request_url, request_type, request_param, ip, userid, username, cost_time, create_time,create_by)
|
||||
insert into sys_log (id, log_type, log_content, method, operate_type, request_url, request_type, request_param, ip, userid, username, cost_time, create_time,create_by, tenant_id)
|
||||
values(
|
||||
#{dto.id,jdbcType=VARCHAR},
|
||||
#{dto.logType,jdbcType=INTEGER},
|
||||
|
@ -19,7 +19,8 @@
|
|||
#{dto.username,jdbcType=VARCHAR},
|
||||
#{dto.costTime,jdbcType=BIGINT},
|
||||
#{dto.createTime,jdbcType=TIMESTAMP},
|
||||
#{dto.createBy,jdbcType=VARCHAR}
|
||||
#{dto.createBy,jdbcType=VARCHAR},
|
||||
#{dto.tenantId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.demo.test.entity;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
@ -78,5 +79,8 @@ public class JeecgDemo extends JeecgEntity implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/** 乐观锁字段 */
|
||||
@Version
|
||||
private java.lang.Integer updateCount;
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>jeecg-system-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -434,13 +434,13 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||
@RequestMapping("/sys/api/queryDepartsByOrgcodes")
|
||||
List<JSONObject> queryDepartsByOrgcodes(@RequestParam("orgCodes") String orgCodes);
|
||||
|
||||
/**
|
||||
* 39根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryDepartsByOrgIds")
|
||||
List<JSONObject> queryDepartsByOrgIds(@RequestParam("ids") String ids);
|
||||
// /**
|
||||
// * 39根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/sys/api/queryDepartsByOrgIds")
|
||||
// List<JSONObject> queryDepartsByOrgIds(@RequestParam("ids") String ids);
|
||||
|
||||
/**
|
||||
* 40发送邮件消息
|
||||
|
|
|
@ -303,10 +303,10 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByOrgIds(String ids) {
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public List<JSONObject> queryDepartsByOrgIds(String ids) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<String> loadCategoryDictItem(String ids) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>jeecg-system-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>jeecg-module-system</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-module-system</artifactId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.jeecg.modules.aop;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.enums.ModuleType;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 系统日志注解
|
||||
*
|
||||
* @Author scott
|
||||
* @email jeecgos@163.com
|
||||
* @Date 2019年1月14日
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TenantLog {
|
||||
|
||||
/**
|
||||
* 操作日志类型(1查询,2添加,3修改,4删除)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int value() default 0;
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package org.jeecg.modules.aop;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterThrowing;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.jeecg.common.api.dto.LogDTO;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.system.entity.SysTenantPack;
|
||||
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author taoYan
|
||||
* @Date 2023/2/16 14:27
|
||||
**/
|
||||
@Aspect
|
||||
@Component
|
||||
public class TenantPackUserLogAspect {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@Pointcut("@annotation(org.jeecg.modules.aop.TenantLog)")
|
||||
public void tenantLogPointCut() {
|
||||
|
||||
}
|
||||
|
||||
@Around("tenantLogPointCut()")
|
||||
public Object aroundMethod(ProceedingJoinPoint joinPoint)throws Throwable {
|
||||
//System.out.println("环绕通知>>>>>>>>>");
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
TenantLog log = method.getAnnotation(TenantLog.class);
|
||||
if(log != null){
|
||||
int opType = log.value();
|
||||
Integer logType = null;
|
||||
String content = null;
|
||||
Integer tenantId = null;
|
||||
//获取参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
if(args.length>0){
|
||||
for(Object obj: args){
|
||||
if(obj instanceof SysTenantPack){
|
||||
// logType=3 租户操作日志
|
||||
logType = 3;
|
||||
SysTenantPack pack = (SysTenantPack)obj;
|
||||
if(opType==2){
|
||||
content = "创建了角色权限 "+ pack.getPackName();
|
||||
}
|
||||
tenantId = pack.getTenantId();
|
||||
break;
|
||||
}else if(obj instanceof SysTenantPackUser){
|
||||
logType = 3;
|
||||
SysTenantPackUser packUser = (SysTenantPackUser)obj;
|
||||
if(opType==2){
|
||||
content = "将 "+packUser.getRealname()+" 添加到角色 "+ packUser.getPackName();
|
||||
}else if(opType==4){
|
||||
content = "移除了 "+packUser.getPackName()+" 成员 "+ packUser.getRealname();
|
||||
}
|
||||
tenantId = packUser.getTenantId();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(logType!=null){
|
||||
LogDTO dto = new LogDTO();
|
||||
dto.setLogType(logType);
|
||||
dto.setLogContent(content);
|
||||
dto.setOperateType(opType);
|
||||
dto.setTenantId(tenantId);
|
||||
//获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(sysUser!=null){
|
||||
dto.setUserid(sysUser.getUsername());
|
||||
dto.setUsername(sysUser.getRealname());
|
||||
|
||||
}
|
||||
dto.setCreateTime(new Date());
|
||||
//保存系统日志
|
||||
baseCommonService.addLog(dto);
|
||||
}
|
||||
}
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
|
||||
@AfterThrowing("tenantLogPointCut()")
|
||||
public void afterThrowing()throws Throwable{
|
||||
System.out.println("异常通知");
|
||||
}
|
||||
}
|
|
@ -90,7 +90,7 @@ public class CasClientController {
|
|||
if (departs == null || departs.size() == 0) {
|
||||
obj.put("multi_depart", 0);
|
||||
} else if (departs.size() == 1) {
|
||||
sysUserService.updateUserDepart(principal, departs.get(0).getOrgCode());
|
||||
sysUserService.updateUserDepart(principal, departs.get(0).getOrgCode(),null);
|
||||
obj.put("multi_depart", 1);
|
||||
} else {
|
||||
obj.put("multi_depart", 2);
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.message.handle.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
|
@ -42,6 +43,11 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
|||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* 真实姓名变量
|
||||
*/
|
||||
private static final String realNameExp = "{REALNAME}";
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -76,26 +82,81 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
|||
List<SysUser> list = sysUserMapper.selectList(query);
|
||||
String content = messageDTO.getContent();
|
||||
String title = messageDTO.getTitle();
|
||||
String realNameExp = "{REALNAME}";
|
||||
for(SysUser user: list){
|
||||
String email = user.getEmail();
|
||||
if(email==null || "".equals(email)){
|
||||
if (ObjectUtils.isEmpty(email)) {
|
||||
continue;
|
||||
}
|
||||
if(content.indexOf(realNameExp)>0){
|
||||
content = content.replace(realNameExp, user.getRealname());
|
||||
}
|
||||
if(content.indexOf(CommonConstant.LOGIN_TOKEN)>0){
|
||||
String token = getToken(user);
|
||||
try {
|
||||
content = content.replace(CommonConstant.LOGIN_TOKEN, URLEncoder.encode(token, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("邮件消息token编码失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
content=replaceContent(user,content);
|
||||
log.info("邮件内容:"+ content);
|
||||
sendMsg(email, title, content);
|
||||
}
|
||||
//发送给抄送人
|
||||
sendMessageToCopyUser(messageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件给抄送人
|
||||
* @param messageDTO
|
||||
*/
|
||||
public void sendMessageToCopyUser(MessageDTO messageDTO) {
|
||||
String copyToUser = messageDTO.getCopyToUser();
|
||||
if(ObjectUtils.isNotEmpty(copyToUser)) {
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<SysUser>().in(SysUser::getUsername, copyToUser.split(","));
|
||||
List<SysUser> list = sysUserMapper.selectList(query);
|
||||
String content = messageDTO.getContent();
|
||||
String title = messageDTO.getTitle();
|
||||
|
||||
for (SysUser user : list) {
|
||||
String email = user.getEmail();
|
||||
if (ObjectUtils.isEmpty(email)) {
|
||||
continue;
|
||||
}
|
||||
content=replaceContent(user,content);
|
||||
log.info("邮件内容:" + content);
|
||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||
MimeMessage message = mailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
if (oConvertUtils.isEmpty(emailFrom)) {
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
setEmailFrom(staticConfig.getEmailFrom());
|
||||
}
|
||||
try {
|
||||
helper = new MimeMessageHelper(message, true);
|
||||
// 设置发送方邮箱地址
|
||||
helper.setFrom(emailFrom);
|
||||
helper.setTo(email);
|
||||
//设置抄送人
|
||||
helper.setCc(email);
|
||||
helper.setSubject(title);
|
||||
helper.setText(content, true);
|
||||
mailSender.send(message);
|
||||
} catch (MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换邮件内容变量
|
||||
* @param user
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
private String replaceContent(SysUser user,String content){
|
||||
if (content.indexOf(realNameExp) > 0) {
|
||||
content = content.replace("$"+realNameExp,user.getRealname()).replace(realNameExp, user.getRealname());
|
||||
}
|
||||
if (content.indexOf(CommonConstant.LOGIN_TOKEN) > 0) {
|
||||
String token = getToken(user);
|
||||
try {
|
||||
content = content.replace(CommonConstant.LOGIN_TOKEN, URLEncoder.encode(token, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("邮件消息token编码失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.jeecg.modules.message.websocket;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.Resource;
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
|
@ -11,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.jeecg.common.modules.redis.client.JeecgRedisClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class WebSocket {
|
|||
* Redis触发监听名字
|
||||
*/
|
||||
public static final String REDIS_TOPIC_NAME = "socketHandler";
|
||||
@Resource
|
||||
@Autowired
|
||||
private JeecgRedisClient jeecgRedisClient;
|
||||
|
||||
|
||||
|
@ -111,14 +111,14 @@ public class WebSocket {
|
|||
log.debug("【系统 WebSocket】收到客户端消息:" + message);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
JSONObject obj = new JSONObject();
|
||||
//业务类型
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);
|
||||
//消息内容
|
||||
obj.put(WebsocketConst.MSG_TXT, "心跳响应");
|
||||
this.pushMessage(userId, obj.toJSONString());
|
||||
//------------------------------------------------------------------------------
|
||||
// //------------------------------------------------------------------------------
|
||||
// JSONObject obj = new JSONObject();
|
||||
// //业务类型
|
||||
// obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);
|
||||
// //消息内容
|
||||
// obj.put(WebsocketConst.MSG_TXT, "心跳响应");
|
||||
// this.pushMessage(userId, obj.toJSONString());
|
||||
// //------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ public class WebSocket {
|
|||
@OnError
|
||||
public void onError(Session session, Throwable t) {
|
||||
log.warn("【系统 WebSocket】消息出现错误");
|
||||
//t.printStackTrace();
|
||||
t.printStackTrace();
|
||||
}
|
||||
//==========【系统 WebSocket接受、推送消息等方法 —— 具体服务节点推送ws消息】========================================================================================
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ActuatorRedisController {
|
|||
@GetMapping("/info")
|
||||
public Result<?> getRedisInfo() throws Exception {
|
||||
List<RedisInfo> infoList = this.redisService.getRedisInfo();
|
||||
log.info(infoList.toString());
|
||||
//log.info(infoList.toString());
|
||||
return Result.ok(infoList);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.oss.controller;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
@ -46,7 +47,8 @@ public class OssFileController {
|
|||
|
||||
@ResponseBody
|
||||
@PostMapping("/upload")
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:ossFile:upload")
|
||||
public Result upload(@RequestParam("file") MultipartFile multipartFile) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.jeecg.modules.oss.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.CommonUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.util.oss.OssBootUtil;
|
||||
import org.jeecg.modules.oss.entity.OssFile;
|
||||
import org.jeecg.modules.oss.mapper.OssFileMapper;
|
||||
|
@ -25,6 +27,9 @@ public class OssFileServiceImpl extends ServiceImpl<OssFileMapper, OssFile> impl
|
|||
OssFile ossFile = new OssFile();
|
||||
ossFile.setFileName(fileName);
|
||||
String url = OssBootUtil.upload(multipartFile,"upload/test");
|
||||
if(oConvertUtils.isEmpty(url)){
|
||||
throw new JeecgBootException("上传文件失败! ");
|
||||
}
|
||||
//update-begin--Author:scott Date:20201227 for:JT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
|
||||
// 返回阿里云原生域名前缀URL
|
||||
ossFile.setUrl(OssBootUtil.getOriginalUrl(url));
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
@ -78,7 +79,8 @@ public class QuartzJobController {
|
|||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<?> add(@RequestBody QuartzJob quartzJob) {
|
||||
quartzJobService.saveAndScheduleJob(quartzJob);
|
||||
|
@ -91,7 +93,8 @@ public class QuartzJobController {
|
|||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:edit")
|
||||
@RequestMapping(value = "/edit", method ={RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<?> eidt(@RequestBody QuartzJob quartzJob) {
|
||||
try {
|
||||
|
@ -109,7 +112,8 @@ public class QuartzJobController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
|
@ -127,7 +131,8 @@ public class QuartzJobController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
|
@ -146,7 +151,8 @@ public class QuartzJobController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:pause")
|
||||
@GetMapping(value = "/pause")
|
||||
@ApiOperation(value = "停止定时任务")
|
||||
public Result<Object> pauseJob(@RequestParam(name = "id") String id) {
|
||||
|
@ -164,7 +170,8 @@ public class QuartzJobController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:resume")
|
||||
@GetMapping(value = "/resume")
|
||||
@ApiOperation(value = "启动定时任务")
|
||||
public Result<Object> resumeJob(@RequestParam(name = "id") String id) {
|
||||
|
@ -264,7 +271,8 @@ public class QuartzJobController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:quartzJob:execute")
|
||||
@GetMapping("/execute")
|
||||
public Result<?> execute(@RequestParam(name = "id", required = true) String id) {
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.CommonUtils;
|
||||
import org.jeecg.common.util.RestUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.filter.FileTypeFilter;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.server.ServletServerHttpRequest;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
@ -23,7 +28,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 前端控制器
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.jeecg.modules.system.mapper.SysDictMapper;
|
|||
import org.jeecg.modules.system.model.DuplicateCheckVo;
|
||||
import org.jeecg.modules.system.security.DictQueryBlackListHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -47,7 +48,7 @@ public class DuplicateCheckController {
|
|||
public Result<String> doDuplicateCheck(DuplicateCheckVo duplicateCheckVo, HttpServletRequest request) {
|
||||
Long num = null;
|
||||
|
||||
log.info("----duplicate check------:"+ duplicateCheckVo.toString());
|
||||
log.debug("----duplicate check------:"+ duplicateCheckVo.toString());
|
||||
//关联表字典(举例:sys_user,realname,id)
|
||||
//SQL注入校验(只限制非法串改数据库)
|
||||
final String[] sqlInjCheck = {duplicateCheckVo.getTableName(),duplicateCheckVo.getFieldName()};
|
||||
|
@ -84,4 +85,21 @@ public class DuplicateCheckController {
|
|||
return Result.error("该值不可用,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* VUEN-2584【issue】平台sql注入漏洞几个问题
|
||||
* 部分特殊函数 可以将查询结果混夹在错误信息中,导致数据库的信息暴露
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
@ExceptionHandler(java.sql.SQLException.class)
|
||||
public Result<?> handleSQLException(Exception e){
|
||||
String msg = e.getMessage();
|
||||
String extractvalue = "extractvalue";
|
||||
String updatexml = "updatexml";
|
||||
if(msg!=null && (msg.toLowerCase().indexOf(extractvalue)>=0 || msg.toLowerCase().indexOf(updatexml)>=0)){
|
||||
return Result.error("校验失败,sql解析异常!");
|
||||
}
|
||||
return Result.error("校验失败,sql解析异常!" + msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
@ -76,6 +77,11 @@ public class LoginController {
|
|||
Result<JSONObject> result = new Result<JSONObject>();
|
||||
String username = sysLoginModel.getUsername();
|
||||
String password = sysLoginModel.getPassword();
|
||||
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
if(isLoginFailOvertimes(username)){
|
||||
return result.error500("该用户登录失败次数过多,请于10分钟后再次登录!");
|
||||
}
|
||||
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
//update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题
|
||||
//前端密码加密,后端进行密码解密
|
||||
//password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword().replaceAll("%2B", "\\+")).trim();//密码解密
|
||||
|
@ -119,6 +125,9 @@ public class LoginController {
|
|||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
String syspassword = sysUser.getPassword();
|
||||
if (!syspassword.equals(userpassword)) {
|
||||
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
addLoginFailOvertimes(username);
|
||||
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
result.error500("用户名或密码错误");
|
||||
return result;
|
||||
}
|
||||
|
@ -128,6 +137,7 @@ public class LoginController {
|
|||
//update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码
|
||||
redisUtil.del(realKey);
|
||||
//update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码
|
||||
redisUtil.del(CommonConstant.LOGIN_FAIL + username);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
BeanUtils.copyProperties(sysUser, loginUser);
|
||||
baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null,loginUser);
|
||||
|
@ -271,8 +281,12 @@ public class LoginController {
|
|||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
username = sysUser.getUsername();
|
||||
}
|
||||
|
||||
//获取登录部门
|
||||
String orgCode= user.getOrgCode();
|
||||
this.sysUserService.updateUserDepart(username, orgCode);
|
||||
//获取登录租户
|
||||
Integer tenantId = user.getLoginTenantId();
|
||||
this.sysUserService.updateUserDepart(username, orgCode,tenantId);
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("userInfo", sysUser);
|
||||
|
@ -386,7 +400,11 @@ public class LoginController {
|
|||
public Result<JSONObject> phoneLogin(@RequestBody JSONObject jsonObject) {
|
||||
Result<JSONObject> result = new Result<JSONObject>();
|
||||
String phone = jsonObject.getString("mobile");
|
||||
|
||||
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
if(isLoginFailOvertimes(phone)){
|
||||
return result.error500("该用户登录失败次数过多,请于10分钟后再次登录!");
|
||||
}
|
||||
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
//校验用户有效性
|
||||
SysUser sysUser = sysUserService.getUserByPhone(phone);
|
||||
result = sysUserService.checkUserIsEffective(sysUser);
|
||||
|
@ -402,6 +420,9 @@ public class LoginController {
|
|||
//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
|
||||
|
||||
if (!smscode.equals(code)) {
|
||||
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
addLoginFailOvertimes(phone);
|
||||
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
result.setMessage("手机验证码错误");
|
||||
return result;
|
||||
}
|
||||
|
@ -427,46 +448,36 @@ public class LoginController {
|
|||
// 获取用户部门信息
|
||||
JSONObject obj = new JSONObject(new LinkedHashMap<>());
|
||||
|
||||
// 生成token
|
||||
//1.生成token
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
// 设置token缓存有效时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
|
||||
obj.put("token", token);
|
||||
|
||||
// update-begin--Author:sunjianlei Date:20210802 for:获取用户租户信息
|
||||
String tenantIds = sysUser.getRelTenantIds();
|
||||
if (oConvertUtils.isNotEmpty(tenantIds)) {
|
||||
List<Integer> tenantIdList = new ArrayList<>();
|
||||
for(String id: tenantIds.split(SymbolConstant.COMMA)){
|
||||
tenantIdList.add(Integer.valueOf(id));
|
||||
}
|
||||
// 该方法仅查询有效的租户,如果返回0个就说明所有的租户均无效。
|
||||
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
|
||||
if (tenantList.size() == 0) {
|
||||
result.error500("与该用户关联的租户均已被冻结,无法登录!");
|
||||
return result;
|
||||
} else {
|
||||
obj.put("tenantList", tenantList);
|
||||
}
|
||||
//2.设置登录租户
|
||||
Result<JSONObject> loginTenantError = sysUserService.setLoginTenant(sysUser, obj, username,result);
|
||||
if (loginTenantError != null) {
|
||||
return loginTenantError;
|
||||
}
|
||||
// update-end--Author:sunjianlei Date:20210802 for:获取用户租户信息
|
||||
|
||||
//3.设置登录用户信息
|
||||
obj.put("userInfo", sysUser);
|
||||
|
||||
|
||||
//4.设置登录部门
|
||||
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
|
||||
obj.put("departs", departs);
|
||||
if (departs == null || departs.size() == 0) {
|
||||
obj.put("multi_depart", 0);
|
||||
} else if (departs.size() == 1) {
|
||||
sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
|
||||
sysUserService.updateUserDepart(username, departs.get(0).getOrgCode(),null);
|
||||
obj.put("multi_depart", 1);
|
||||
} else {
|
||||
//查询当前是否有登录部门
|
||||
// update-begin--Author:wangshuai Date:20200805 for:如果用戶为选择部门,数据库为存在上一次登录部门,则取一条存进去
|
||||
SysUser sysUserById = sysUserService.getById(sysUser.getId());
|
||||
if(oConvertUtils.isEmpty(sysUserById.getOrgCode())){
|
||||
sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
|
||||
sysUserService.updateUserDepart(username, departs.get(0).getOrgCode(),null);
|
||||
}
|
||||
// update-end--Author:wangshuai Date:20200805 for:如果用戶为选择部门,数据库为存在上一次登录部门,则取一条存进去
|
||||
obj.put("multi_depart", 2);
|
||||
|
@ -529,6 +540,7 @@ public class LoginController {
|
|||
/**
|
||||
* 切换菜单表为vue3的表
|
||||
*/
|
||||
@RequiresRoles({"admin"})
|
||||
@GetMapping(value = "/switchVue3Menu")
|
||||
public Result<String> switchVue3Menu(HttpServletResponse response) {
|
||||
Result<String> res = new Result<String>();
|
||||
|
@ -547,7 +559,13 @@ public class LoginController {
|
|||
Result<JSONObject> result = new Result<JSONObject>();
|
||||
String username = sysLoginModel.getUsername();
|
||||
String password = sysLoginModel.getPassword();
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
if(isLoginFailOvertimes(username)){
|
||||
return result.error500("该用户登录失败次数过多,请于10分钟后再次登录!");
|
||||
}
|
||||
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
//1. 校验用户是否有效
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
result = sysUserService.checkUserIsEffective(sysUser);
|
||||
|
@ -559,10 +577,14 @@ public class LoginController {
|
|||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
String syspassword = sysUser.getPassword();
|
||||
if (!syspassword.equals(userpassword)) {
|
||||
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
addLoginFailOvertimes(username);
|
||||
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
|
||||
result.error500("用户名或密码错误");
|
||||
return result;
|
||||
}
|
||||
|
||||
//3.设置登录部门
|
||||
String orgCode = sysUser.getOrgCode();
|
||||
if(oConvertUtils.isEmpty(orgCode)) {
|
||||
//如果当前用户无选择部门 查看部门关联信息
|
||||
|
@ -574,15 +596,21 @@ public class LoginController {
|
|||
}else{
|
||||
orgCode = departs.get(0).getOrgCode();
|
||||
sysUser.setOrgCode(orgCode);
|
||||
this.sysUserService.updateUserDepart(username, orgCode);
|
||||
this.sysUserService.updateUserDepart(username, orgCode,null);
|
||||
}
|
||||
//update-end-author:taoyan date:20220117 for: JTC-1068【app】新建用户,没有设置部门及角色,点击登录提示暂未归属部,一直在登录页面 使用手机号登录 可正常
|
||||
}
|
||||
JSONObject obj = new JSONObject();
|
||||
//用户登录信息
|
||||
|
||||
//4. 设置登录租户
|
||||
Result<JSONObject> loginTenantError = sysUserService.setLoginTenant(sysUser, obj, username, result);
|
||||
if (loginTenantError != null) {
|
||||
return loginTenantError;
|
||||
}
|
||||
|
||||
//5. 设置登录用户信息
|
||||
obj.put("userInfo", sysUser);
|
||||
|
||||
// 生成token
|
||||
//6. 生成token
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
|
@ -671,4 +699,36 @@ public class LoginController {
|
|||
return Result.OK(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录失败超出次数5 返回true
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
private boolean isLoginFailOvertimes(String username){
|
||||
String key = CommonConstant.LOGIN_FAIL + username;
|
||||
Object failTime = redisUtil.get(key);
|
||||
if(failTime!=null){
|
||||
Integer val = Integer.parseInt(failTime.toString());
|
||||
if(val>5){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录失败次数
|
||||
* @param username
|
||||
*/
|
||||
private void addLoginFailOvertimes(String username){
|
||||
String key = CommonConstant.LOGIN_FAIL + username;
|
||||
Object failTime = redisUtil.get(key);
|
||||
Integer val = 0;
|
||||
if(failTime!=null){
|
||||
val = Integer.parseInt(failTime.toString());
|
||||
}
|
||||
// 1小时
|
||||
redisUtil.set(key, ++val, 3600);
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.CommonSendStatus;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
|
@ -21,6 +22,7 @@ import org.jeecg.common.util.DateUtils;
|
|||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.message.enums.RangeDateEnum;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.jeecg.modules.system.entity.SysAnnouncement;
|
||||
|
@ -93,6 +95,12 @@ public class SysAnnouncementController {
|
|||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysAnnouncement.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, req.getParameterMap());
|
||||
|
@ -547,7 +555,32 @@ public class SysAnnouncementController {
|
|||
sysAnnouncementService.updateReaded(annoceIdList);
|
||||
}
|
||||
}
|
||||
//update-begin-author:taoyan date:2022-9-25 for: VUEN-2261【移动端 系统消息】通知公告显示7条消息,点进去查看后,仍然显示7条;其他地方已读后,未读条数减少
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
//update-end-author:taoyan date:2022-9-25 for: VUEN-2261【移动端 系统消息】通知公告显示7条消息,点进去查看后,仍然显示7条;其他地方已读后,未读条数减少
|
||||
return Result.ok(ls);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户id获取最新一条消息发送时间(创建时间)
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getLastAnnountTime")
|
||||
public Result<Page<SysAnnouncementSend>> getLastAnnountTime(@RequestParam(name = "userId") String userId){
|
||||
Result<Page<SysAnnouncementSend>> result = new Result<>();
|
||||
Page<SysAnnouncementSend> page = new Page<>(1,1);
|
||||
LambdaQueryWrapper<SysAnnouncementSend> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysAnnouncementSend::getUserId,userId);
|
||||
query.select(SysAnnouncementSend::getCreateTime);
|
||||
query.orderByDesc(SysAnnouncementSend::getCreateTime);
|
||||
Page<SysAnnouncementSend> pageList = sysAnnouncementSendService.page(page, query);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
|
@ -16,6 +17,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
|||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.SqlInjectionUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.SysCategory;
|
||||
import org.jeecg.modules.system.model.TreeSelectModel;
|
||||
import org.jeecg.modules.system.service.ISysCategoryService;
|
||||
|
@ -71,6 +73,12 @@ public class SysCategoryController {
|
|||
sysCategory.setPid("0");
|
||||
}
|
||||
Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
|
||||
//--author:liusq---date:20211119 -----for: 【vue3】分类字典页面查询条件配置--------start
|
||||
|
@ -93,6 +101,12 @@ public class SysCategoryController {
|
|||
|
||||
@GetMapping(value = "/childList")
|
||||
public Result<List<SysCategory>> queryPageList(SysCategory sysCategory,HttpServletRequest req) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
Result<List<SysCategory>> result = new Result<List<SysCategory>>();
|
||||
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
|
||||
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
||||
|
@ -199,6 +213,13 @@ public class SysCategoryController {
|
|||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
|
||||
List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
|
||||
|
|
|
@ -97,7 +97,7 @@ public class SysCommentController extends JeecgController<SysComment, ISysCommen
|
|||
sysCommentService.saveOneFileComment(request);
|
||||
return Result.OK("success");
|
||||
} catch (Exception e) {
|
||||
log.error("评论文件上传失败", e.getMessage());
|
||||
log.error("评论文件上传失败:{}", e.getMessage());
|
||||
return Result.error("操作失败," + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public class SysCommentController extends JeecgController<SysComment, ISysCommen
|
|||
* @param req
|
||||
* @return
|
||||
*/
|
||||
////@AutoLog(value = "系统评论回复表-分页列表查询")
|
||||
//@AutoLog(value = "系统评论回复表-分页列表查询")
|
||||
@ApiOperation(value = "系统评论回复表-分页列表查询", notes = "系统评论回复表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysComment>> queryPageList(SysComment sysComment,
|
||||
|
@ -223,7 +223,7 @@ public class SysCommentController extends JeecgController<SysComment, ISysCommen
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
////@AutoLog(value = "系统评论回复表-通过id查询")
|
||||
//@AutoLog(value = "系统评论回复表-通过id查询")
|
||||
@ApiOperation(value = "系统评论回复表-通过id查询", notes = "系统评论回复表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysComment> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
|
|
|
@ -13,14 +13,18 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.dynamic.db.DataSourceCachePool;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.util.security.JdbcSecurityUtil;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.SysDataSource;
|
||||
import org.jeecg.modules.system.service.ISysDataSourceService;
|
||||
import org.jeecg.modules.system.util.SecurityUtil;
|
||||
|
@ -61,14 +65,19 @@ public class SysDataSourceController extends JeecgController<SysDataSource, ISys
|
|||
*/
|
||||
@AutoLog(value = "多数据源管理-分页列表查询")
|
||||
@ApiOperation(value = "多数据源管理-分页列表查询", notes = "多数据源管理-分页列表查询")
|
||||
//@RequiresRoles("admin")
|
||||
@RequiresPermissions("system:datasource:list")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(
|
||||
SysDataSource sysDataSource,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req
|
||||
) {
|
||||
HttpServletRequest req) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysDataSource.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
|
||||
Page<SysDataSource> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysDataSource> pageList = sysDataSourceService.page(page, queryWrapper);
|
||||
|
@ -77,6 +86,13 @@ public class SysDataSourceController extends JeecgController<SysDataSource, ISys
|
|||
|
||||
@GetMapping(value = "/options")
|
||||
public Result<?> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysDataSource.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
|
||||
List<SysDataSource> pageList = sysDataSourceService.list(queryWrapper);
|
||||
JSONArray array = new JSONArray(pageList.size());
|
||||
|
@ -192,6 +208,12 @@ public class SysDataSourceController extends JeecgController<SysDataSource, ISys
|
|||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysDataSource sysDataSource) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysDataSource.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
return super.exportXls(request, sysDataSource, SysDataSource.class, "多数据源管理");
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
@ -16,6 +17,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
|||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.YouBianCodeUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
|
@ -148,8 +150,7 @@ public class SysDepartController {
|
|||
@GetMapping("/queryAllParentId")
|
||||
public Result queryParentIds(
|
||||
@RequestParam(name = "departId", required = false) String departId,
|
||||
@RequestParam(name = "orgCode", required = false) String orgCode
|
||||
) {
|
||||
@RequestParam(name = "orgCode", required = false) String orgCode) {
|
||||
try {
|
||||
JSONObject data;
|
||||
if (oConvertUtils.isNotEmpty(departId)) {
|
||||
|
@ -172,7 +173,7 @@ public class SysDepartController {
|
|||
* @param sysDepart
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
|
@ -198,7 +199,7 @@ public class SysDepartController {
|
|||
* @param sysDepart
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
|
@ -226,7 +227,7 @@ public class SysDepartController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {
|
||||
|
@ -236,13 +237,11 @@ public class SysDepartController {
|
|||
if(sysDepart==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDepartService.delete(id);
|
||||
if(ok) {
|
||||
//清除部门树内存
|
||||
//FindsDepartsChildrenUtil.clearSysDepartTreeList();
|
||||
// FindsDepartsChildrenUtil.clearDepartIdModel();
|
||||
result.success("删除成功!");
|
||||
}
|
||||
sysDepartService.deleteDepart(id);
|
||||
//清除部门树内存
|
||||
//FindsDepartsChildrenUtil.clearSysDepartTreeList();
|
||||
// FindsDepartsChildrenUtil.clearDepartIdModel();
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -254,7 +253,7 @@ public class SysDepartController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
|
@ -341,6 +340,13 @@ public class SysDepartController {
|
|||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysDepart.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
|
@ -371,7 +377,7 @@ public class SysDepartController {
|
|||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
@ -526,4 +532,46 @@ public class SysDepartController {
|
|||
result.setResult(sysUsers);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:根据id 批量查询
|
||||
* @param deptIds
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryByIds", method = RequestMethod.GET)
|
||||
public Result<Collection<SysDepart>> queryByIds(@RequestParam String deptIds) {
|
||||
Result<Collection<SysDepart>> result = new Result<>();
|
||||
String[] ids = deptIds.split(",");
|
||||
Collection<String> idList = Arrays.asList(ids);
|
||||
Collection<SysDepart> deptList = sysDepartService.listByIds(idList);
|
||||
result.setSuccess(true);
|
||||
result.setResult(deptList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/getMyDepartList")
|
||||
public Result<List<SysDepart>> getMyDepartList(){
|
||||
List<SysDepart> list = sysDepartService.getMyDepartList();
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步查询部门list
|
||||
* @param parentId 父节点 异步加载时传递
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryBookDepTreeSync", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartTreeModel>> queryBookDepTreeSync(@RequestParam(name = "pid", required = false) String parentId,
|
||||
@RequestParam(name = "tenantId") Integer tenantId,
|
||||
@RequestParam(name = "departName",required = false) String departName) {
|
||||
Result<List<SysDepartTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SysDepartTreeModel> list = sysDepartService.queryBookDepTreeSync(parentId, tenantId, departName);
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
@ -103,7 +104,7 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
|||
* @param sysDepartRole
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:role:add")
|
||||
@ApiOperation(value="部门角色-添加", notes="部门角色-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysDepartRole sysDepartRole) {
|
||||
|
@ -117,8 +118,8 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
|||
* @param sysDepartRole
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@ApiOperation(value="部门角色-编辑", notes="部门角色-编辑")
|
||||
@RequiresPermissions("system:depart:role:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysDepartRole sysDepartRole) {
|
||||
sysDepartRoleService.updateById(sysDepartRole);
|
||||
|
@ -131,9 +132,9 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@AutoLog(value = "部门角色-通过id删除")
|
||||
@ApiOperation(value="部门角色-通过id删除", notes="部门角色-通过id删除")
|
||||
@RequiresPermissions("system:depart:role:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysDepartRoleService.removeById(id);
|
||||
|
@ -146,9 +147,9 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@AutoLog(value = "部门角色-批量删除")
|
||||
@ApiOperation(value="部门角色-批量删除", notes="部门角色-批量删除")
|
||||
@RequiresPermissions("system:depart:role:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sysDepartRoleService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
|
@ -188,7 +189,7 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
|||
* @param json
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:depart:role:userAdd")
|
||||
@RequestMapping(value = "/deptRoleUserAdd", method = RequestMethod.POST)
|
||||
public Result<?> deptRoleAdd(@RequestBody JSONObject json) {
|
||||
String newRoleId = json.getString("newRoleId");
|
||||
|
|
|
@ -8,8 +8,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
|
@ -19,7 +21,9 @@ import org.jeecg.common.system.vo.DictQuery;
|
|||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.SqlInjectionUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.entity.SysDictItem;
|
||||
import org.jeecg.modules.system.model.SysDictTree;
|
||||
|
@ -28,6 +32,7 @@ import org.jeecg.modules.system.security.DictQueryBlackListHandler;
|
|||
import org.jeecg.modules.system.service.ISysDictItemService;
|
||||
import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.jeecg.modules.system.vo.SysDictPage;
|
||||
import org.jeecg.modules.system.vo.lowapp.SysDictVo;
|
||||
import org.jeecgframework.poi.excel.ExcelImportCheckUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
|
@ -73,6 +78,12 @@ public class SysDictController {
|
|||
public Result<IPage<SysDict>> queryPageList(SysDict sysDict,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysDict>> result = new Result<IPage<SysDict>>();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysDict.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap());
|
||||
Page<SysDict> page = new Page<SysDict>(pageNo, pageSize);
|
||||
IPage<SysDict> pageList = sysDictService.page(page, queryWrapper);
|
||||
|
@ -364,7 +375,7 @@ public class SysDictController {
|
|||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysDict> add(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
|
@ -385,7 +396,7 @@ public class SysDictController {
|
|||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT,RequestMethod.POST })
|
||||
public Result<SysDict> edit(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
|
@ -407,7 +418,7 @@ public class SysDictController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) {
|
||||
|
@ -426,7 +437,7 @@ public class SysDictController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<SysDict> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
|
@ -474,6 +485,13 @@ public class SysDictController {
|
|||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysDict.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
|
@ -509,7 +527,7 @@ public class SysDictController {
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
|
@ -639,4 +657,36 @@ public class SysDictController {
|
|||
return Result.error("校验失败,sql解析异常!" + msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用id获取字典列表和详情
|
||||
* @param request
|
||||
*/
|
||||
@GetMapping("/getDictListByLowAppId")
|
||||
public Result<List<SysDictVo>> getDictListByLowAppId(HttpServletRequest request){
|
||||
String lowAppId = oConvertUtils.getString(TokenUtils.getLowAppIdByRequest(request),"0");
|
||||
List<SysDictVo> list = sysDictService.getDictListByLowAppId(lowAppId);
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加字典
|
||||
* @param sysDictVo
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addDictByLowAppId")
|
||||
public Result<String> addDictByLowAppId(@RequestBody SysDictVo sysDictVo,HttpServletRequest request){
|
||||
String lowAppId = oConvertUtils.getString(TokenUtils.getLowAppIdByRequest(request),"0");
|
||||
sysDictVo.setLowAppId(lowAppId);
|
||||
sysDictService.addDictByLowAppId(sysDictVo);
|
||||
return Result.ok("添加成功");
|
||||
}
|
||||
|
||||
@PutMapping("/editDictByLowAppId")
|
||||
public Result<String> editDictByLowAppId(@RequestBody SysDictVo sysDictVo,HttpServletRequest request){
|
||||
String lowAppId = oConvertUtils.getString(TokenUtils.getLowAppIdByRequest(request),"0");
|
||||
sysDictVo.setLowAppId(lowAppId);
|
||||
sysDictService.editDictByLowAppId(sysDictVo);
|
||||
return Result.ok("编辑成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
|
@ -73,7 +74,7 @@ public class SysDictItemController {
|
|||
* @功能:新增
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:item:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<SysDictItem> add(@RequestBody SysDictItem sysDictItem) {
|
||||
|
@ -94,7 +95,7 @@ public class SysDictItemController {
|
|||
* @param sysDictItem
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:item:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT,RequestMethod.POST })
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
|
||||
|
@ -118,7 +119,7 @@ public class SysDictItemController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:item:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
|
||||
|
@ -140,7 +141,7 @@ public class SysDictItemController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:dict:item:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<SysDictItem> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
|
@ -67,7 +68,7 @@ public class SysGatewayRouteController extends JeecgController<SysGatewayRoute,
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:getway:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysGatewayRouteService.deleteById(id);
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
@ -75,6 +78,7 @@ public class SysPermissionController {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("system:permission:list")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<List<SysPermissionTree>> list(SysPermission sysPermission, HttpServletRequest req) {
|
||||
long start = System.currentTimeMillis();
|
||||
|
@ -356,7 +360,7 @@ public class SysPermissionController {
|
|||
* @param permission
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysPermission> add(@RequestBody SysPermission permission) {
|
||||
Result<SysPermission> result = new Result<SysPermission>();
|
||||
|
@ -376,7 +380,7 @@ public class SysPermissionController {
|
|||
* @param permission
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<SysPermission> edit(@RequestBody SysPermission permission) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
|
@ -398,14 +402,14 @@ public class SysPermissionController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/checkPermDuplication", method = RequestMethod.GET)
|
||||
public Result<String> checkPermDuplication(@RequestParam(name = "id", required = false) String id, @RequestParam(name = "url") String url, @RequestParam(name = "alwaysShow") Boolean alwaysShow) {
|
||||
public Result<String> checkPermDuplication(@RequestParam(name = "id", required = false) String id,@RequestParam(name = "url") String url,@RequestParam(name = "alwaysShow") Boolean alwaysShow) {
|
||||
Result<String> result = new Result<>();
|
||||
try {
|
||||
boolean check=sysPermissionService.checkPermDuplication(id,url,alwaysShow);
|
||||
if(check){
|
||||
return Result.ok("该值可用!");
|
||||
}
|
||||
return Result.error("该值不可用,系统中已存在!");
|
||||
return Result.error("访问路径不允许重复,请重定义!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
|
@ -418,7 +422,7 @@ public class SysPermissionController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<SysPermission> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
|
@ -437,7 +441,7 @@ public class SysPermissionController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysPermission> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
|
@ -545,7 +549,7 @@ public class SysPermissionController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveRolePermission", method = RequestMethod.POST)
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:saveRole")
|
||||
public Result<String> saveRolePermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
Result<String> result = new Result<>();
|
||||
|
@ -873,7 +877,7 @@ public class SysPermissionController {
|
|||
* @param sysPermissionDataRule
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:addRule")
|
||||
@RequestMapping(value = "/addPermissionRule", method = RequestMethod.POST)
|
||||
public Result<SysPermissionDataRule> addPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
Result<SysPermissionDataRule> result = new Result<SysPermissionDataRule>();
|
||||
|
@ -888,7 +892,7 @@ public class SysPermissionController {
|
|||
return result;
|
||||
}
|
||||
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:editRule")
|
||||
@RequestMapping(value = "/editPermissionRule", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<SysPermissionDataRule> editPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
Result<SysPermissionDataRule> result = new Result<SysPermissionDataRule>();
|
||||
|
@ -908,7 +912,7 @@ public class SysPermissionController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:deleteRule")
|
||||
@RequestMapping(value = "/deletePermissionRule", method = RequestMethod.DELETE)
|
||||
public Result<SysPermissionDataRule> deletePermissionRule(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysPermissionDataRule> result = new Result<SysPermissionDataRule>();
|
||||
|
@ -965,7 +969,7 @@ public class SysPermissionController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveDepartPermission", method = RequestMethod.POST)
|
||||
//@RequiresRoles({ "admin" })
|
||||
@RequiresPermissions("system:permission:saveDepart")
|
||||
public Result<String> saveDepartPermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
Result<String> result = new Result<>();
|
||||
|
|
|
@ -7,16 +7,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.SysPosition;
|
||||
import org.jeecg.modules.system.service.ISysPositionService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
|
@ -72,6 +72,12 @@ public class SysPositionController {
|
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysPosition>> result = new Result<IPage<SysPosition>>();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysPosition.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
QueryWrapper<SysPosition> queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, req.getParameterMap());
|
||||
Page<SysPosition> page = new Page<SysPosition>(pageNo, pageSize);
|
||||
IPage<SysPosition> pageList = sysPositionService.page(page, queryWrapper);
|
||||
|
@ -201,6 +207,12 @@ public class SysPositionController {
|
|||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
||||
SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysPosition.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
|
|
@ -13,29 +13,24 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.PmsUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysPermission;
|
||||
import org.jeecg.modules.system.entity.SysPermissionDataRule;
|
||||
import org.jeecg.modules.system.entity.SysRole;
|
||||
import org.jeecg.modules.system.entity.SysRolePermission;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.model.TreeModel;
|
||||
import org.jeecg.modules.system.service.ISysPermissionDataRuleService;
|
||||
import org.jeecg.modules.system.service.ISysPermissionService;
|
||||
import org.jeecg.modules.system.service.ISysRolePermissionService;
|
||||
import org.jeecg.modules.system.service.ISysRoleService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecg.modules.system.service.*;
|
||||
import org.jeecg.modules.system.vo.SysUserRoleCountVo;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -81,14 +76,18 @@ public class SysRoleController {
|
|||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserRoleService sysUserRoleService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* 分页列表查询 【系统角色,不做租户隔离】
|
||||
* @param role
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("system:role:list")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysRole>> queryPageList(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
|
@ -103,13 +102,41 @@ public class SysRoleController {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询【租户角色,做租户隔离】
|
||||
* @param role
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/listByTenant", method = RequestMethod.GET)
|
||||
public Result<IPage<SysRole>> listByTenant(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
role.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
|
||||
Page<SysRole> page = new Page<SysRole>(pageNo, pageSize);
|
||||
IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:role:add")
|
||||
public Result<SysRole> add(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
try {
|
||||
|
@ -128,7 +155,7 @@ public class SysRoleController {
|
|||
* @param role
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@RequestMapping(value = "/edit",method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<SysRole> edit(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
|
@ -152,7 +179,7 @@ public class SysRoleController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:role:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysRoleService.deleteRole(id);
|
||||
|
@ -164,7 +191,7 @@ public class SysRoleController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:role:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
|
@ -194,11 +221,43 @@ public class SysRoleController {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询全部角色(参与租户隔离)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryall", method = RequestMethod.GET)
|
||||
public Result<List<SysRole>> queryall() {
|
||||
Result<List<SysRole>> result = new Result<>();
|
||||
List<SysRole> list = sysRoleService.list();
|
||||
LambdaQueryWrapper<SysRole> query = new LambdaQueryWrapper<SysRole>();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
query.eq(SysRole::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
List<SysRole> list = sysRoleService.list(query);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到角色信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部系统角色(不做租户隔离)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:role:queryallNoByTenant")
|
||||
@RequestMapping(value = "/queryallNoByTenant", method = RequestMethod.GET)
|
||||
public Result<List<SysRole>> queryallNoByTenant() {
|
||||
Result<List<SysRole>> result = new Result<>();
|
||||
LambdaQueryWrapper<SysRole> query = new LambdaQueryWrapper<SysRole>();
|
||||
List<SysRole> list = sysRoleService.list(query);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到角色信息");
|
||||
}else {
|
||||
|
@ -253,6 +312,13 @@ public class SysRoleController {
|
|||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysRole sysRole,HttpServletRequest request) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
sysRole.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
|
@ -408,6 +474,5 @@ public class SysRoleController {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
@ -65,6 +67,7 @@ public class SysRoleIndexController extends JeecgController<SysRoleIndex, ISysRo
|
|||
* @param sysRoleIndex
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:roleindex:add")
|
||||
@AutoLog(value = "角色首页配置-添加")
|
||||
@ApiOperation(value = "角色首页配置-添加", notes = "角色首页配置-添加")
|
||||
@PostMapping(value = "/add")
|
||||
|
@ -80,6 +83,7 @@ public class SysRoleIndexController extends JeecgController<SysRoleIndex, ISysRo
|
|||
* @param sysRoleIndex
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:roleindex:edit")
|
||||
@AutoLog(value = "角色首页配置-编辑")
|
||||
@ApiOperation(value = "角色首页配置-编辑", notes = "角色首页配置-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
|
|
|
@ -1,20 +1,34 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.service.ISysTenantPackService;
|
||||
import org.jeecg.modules.system.service.ISysTenantService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.jeecg.modules.system.service.ISysUserTenantService;
|
||||
import org.jeecg.modules.system.vo.SysUserTenantVo;
|
||||
import org.jeecg.modules.system.vo.tenant.TenantDepartAuthInfo;
|
||||
import org.jeecg.modules.system.vo.tenant.TenantPackModel;
|
||||
import org.jeecg.modules.system.vo.tenant.TenantPackUser;
|
||||
import org.jeecg.modules.system.vo.tenant.TenantPackUserCount;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -33,6 +47,15 @@ public class SysTenantController {
|
|||
@Autowired
|
||||
private ISysTenantService sysTenantService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserTenantService relationService;
|
||||
|
||||
@Autowired
|
||||
private ISysTenantPackService sysTenantPackService;
|
||||
|
||||
/**
|
||||
* 获取列表数据
|
||||
* @param sysTenant
|
||||
|
@ -41,6 +64,7 @@ public class SysTenantController {
|
|||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:tenant:list")
|
||||
@PermissionData(pageComponent = "system/TenantList")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysTenant>> queryPageList(SysTenant sysTenant,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
|
@ -70,11 +94,32 @@ public class SysTenantController {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户删除的列表
|
||||
* @param sysTenant
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/recycleBinPageList")
|
||||
@RequiresPermissions("system:tenant:recycleBinPageList")
|
||||
public Result<IPage<SysTenant>> recycleBinPageList(SysTenant sysTenant,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req){
|
||||
Result<IPage<SysTenant>> result = new Result<IPage<SysTenant>>();
|
||||
Page<SysTenant> page = new Page<SysTenant>(pageNo, pageSize);
|
||||
IPage<SysTenant> pageList = sysTenantService.getRecycleBinPageList(page, sysTenant);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:tenant:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysTenant> add(@RequestBody SysTenant sysTenant) {
|
||||
Result<SysTenant> result = new Result();
|
||||
|
@ -82,7 +127,7 @@ public class SysTenantController {
|
|||
return result.error500("该编号已存在!");
|
||||
}
|
||||
try {
|
||||
sysTenantService.save(sysTenant);
|
||||
sysTenantService.saveTenant(sysTenant);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
@ -96,6 +141,7 @@ public class SysTenantController {
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:tenant:edit")
|
||||
@RequestMapping(value = "/edit", method ={RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<SysTenant> edit(@RequestBody SysTenant tenant) {
|
||||
Result<SysTenant> result = new Result();
|
||||
|
@ -103,6 +149,9 @@ public class SysTenantController {
|
|||
if(sysTenant==null) {
|
||||
return result.error500("未找到对应实体");
|
||||
}
|
||||
if(oConvertUtils.isEmpty(sysTenant.getHouseNumber())){
|
||||
tenant.setHouseNumber(RandomUtil.randomStringUpper(6));
|
||||
}
|
||||
boolean ok = sysTenantService.updateById(tenant);
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
|
@ -115,6 +164,7 @@ public class SysTenantController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:tenant:delete")
|
||||
@RequestMapping(value = "/delete", method ={RequestMethod.DELETE, RequestMethod.POST})
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysTenantService.removeTenantById(id);
|
||||
|
@ -126,6 +176,7 @@ public class SysTenantController {
|
|||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:tenant:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<?> result = new Result<>();
|
||||
|
@ -163,6 +214,19 @@ public class SysTenantController {
|
|||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<SysTenant> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysTenant> result = new Result<SysTenant>();
|
||||
if(oConvertUtils.isEmpty(id)){
|
||||
result.error500("参数为空!");
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
Integer loginSessionTenant = oConvertUtils.getInt(TenantContext.getTenant());
|
||||
if(loginSessionTenant!=null && !loginSessionTenant.equals(Integer.valueOf(id))){
|
||||
result.error500("无权限访问他人租户!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
SysTenant sysTenant = sysTenantService.getById(id);
|
||||
if(sysTenant==null) {
|
||||
result.error500("未找到对应实体");
|
||||
|
@ -178,6 +242,7 @@ public class SysTenantController {
|
|||
* 查询有效的 租户数据
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:tenant:queryList")
|
||||
@RequestMapping(value = "/queryList", method = RequestMethod.GET)
|
||||
public Result<List<SysTenant>> queryList(@RequestParam(name="ids",required=false) String ids) {
|
||||
Result<List<SysTenant>> result = new Result<List<SysTenant>>();
|
||||
|
@ -192,8 +257,76 @@ public class SysTenantController {
|
|||
result.setResult(ls);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有有效租户 【当前用于vue3版本】
|
||||
* 产品包分页列表查询
|
||||
*
|
||||
* @param sysTenantPack
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/packList")
|
||||
@RequiresPermissions("system:tenant:packList")
|
||||
public Result<IPage<SysTenantPack>> queryPackPageList(SysTenantPack sysTenantPack,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysTenantPack> queryWrapper = QueryGenerator.initQueryWrapper(sysTenantPack, req.getParameterMap());
|
||||
Page<SysTenantPack> page = new Page<SysTenantPack>(pageNo, pageSize);
|
||||
IPage<SysTenantPack> pageList = sysTenantPackService.page(page, queryWrapper);
|
||||
List<SysTenantPack> records = pageList.getRecords();
|
||||
if (null != records && records.size() > 0) {
|
||||
pageList.setRecords(sysTenantPackService.setPermissions(records));
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建租户产品包
|
||||
*
|
||||
* @param sysTenantPack
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addPackPermission")
|
||||
@RequiresPermissions("system:tenant:add:pack")
|
||||
public Result<String> addPackPermission(@RequestBody SysTenantPack sysTenantPack) {
|
||||
sysTenantPackService.addPackPermission(sysTenantPack);
|
||||
return Result.ok("创建租户产品包成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建租户产品包
|
||||
*
|
||||
* @param sysTenantPack
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/editPackPermission")
|
||||
@RequiresPermissions("system:tenant:edit:pack")
|
||||
public Result<String> editPackPermission(@RequestBody SysTenantPack sysTenantPack) {
|
||||
sysTenantPackService.editPackPermission(sysTenantPack);
|
||||
return Result.ok("修改租户产品包成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户菜单
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/deletePackPermissions")
|
||||
@RequiresPermissions("system:tenant:delete:pack")
|
||||
public Result<String> deletePackPermissions(@RequestParam(value = "ids") String ids) {
|
||||
sysTenantPackService.deletePackPermissions(ids);
|
||||
return Result.ok("删除租户产品包成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========【低代码应用,前端专用接口 —— 加入限制只能维护和查看自己拥有的租户】==========================================================
|
||||
/**
|
||||
* 查询当前用户的所有有效租户【低代码应用专用接口】
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getCurrentUserTenant", method = RequestMethod.GET)
|
||||
|
@ -201,13 +334,11 @@ public class SysTenantController {
|
|||
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
|
||||
try {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String tenantIds = sysUser.getRelTenantIds();
|
||||
//update-begin---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
List<Integer> tenantIdList = relationService.getTenantIdsByUserId(sysUser.getId());
|
||||
Map<String,Object> map = new HashMap(5);
|
||||
if (oConvertUtils.isNotEmpty(tenantIds)) {
|
||||
List<Integer> tenantIdList = new ArrayList<>();
|
||||
for(String id: tenantIds.split(SymbolConstant.COMMA)){
|
||||
tenantIdList.add(Integer.valueOf(id));
|
||||
}
|
||||
if (null!=tenantIdList && tenantIdList.size()>0) {
|
||||
//update-end---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
// 该方法仅查询有效的租户,如果返回0个就说明所有的租户均无效。
|
||||
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
|
||||
map.put("list", tenantList);
|
||||
|
@ -220,4 +351,450 @@ public class SysTenantController {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请用户【低代码应用专用接口】
|
||||
* @param ids
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/invitationUserJoin")
|
||||
@RequiresPermissions("system:tenant:invitation:user")
|
||||
public Result<String> invitationUserJoin(@RequestParam("ids") String ids,@RequestParam("userIds") String userIds){
|
||||
sysTenantService.invitationUserJoin(ids,userIds);
|
||||
return Result.ok("邀请用户成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表数据【低代码应用专用接口】
|
||||
* @param user
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getTenantUserList", method = RequestMethod.GET)
|
||||
@RequiresPermissions("system:tenant:user:list")
|
||||
public Result<IPage<SysUser>> getTenantUserList(SysUser user,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="userTenantId") String userTenantId,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<>();
|
||||
Page<SysUser> page = new Page<>(pageNo, pageSize);
|
||||
Page<SysUser> pageList = relationService.getPageUserList(page,Integer.valueOf(userTenantId),user);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请离用户租户【低代码应用专用接口】
|
||||
* @param userIds
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/leaveTenant")
|
||||
@RequiresPermissions("system:tenant:leave")
|
||||
public Result<String> leaveTenant(@RequestParam("userIds") String userIds,
|
||||
@RequestParam("tenantId") String tenantId){
|
||||
Result<String> result = new Result<>();
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
Integer loginSessionTenant = oConvertUtils.getInt(TenantContext.getTenant());
|
||||
if(loginSessionTenant!=null && !loginSessionTenant.equals(Integer.valueOf(tenantId))){
|
||||
result.error500("无权限访问他人租户!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
sysTenantService.leaveTenant(userIds,tenantId);
|
||||
return Result.ok("请离成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑(只允许修改自己拥有的租户)【低代码应用专用接口】
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/editOwnTenant", method ={RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<SysTenant> editOwnTenant(@RequestBody SysTenant tenant,HttpServletRequest req) {
|
||||
Result<SysTenant> result = new Result();
|
||||
String tenantId = TokenUtils.getTenantIdByRequest(req);
|
||||
if(!tenantId.equals(tenant.getId().toString())){
|
||||
return result.error500("无权修改他人租户!");
|
||||
}
|
||||
|
||||
SysTenant sysTenant = sysTenantService.getById(tenant.getId());
|
||||
if(sysTenant==null) {
|
||||
return result.error500("未找到对应实体");
|
||||
}
|
||||
if(oConvertUtils.isEmpty(sysTenant.getHouseNumber())){
|
||||
tenant.setHouseNumber(RandomUtil.randomStringUpper(6));
|
||||
}
|
||||
boolean ok = sysTenantService.updateById(tenant);
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建租户并且将用户保存到中间表【低代码应用专用接口】
|
||||
* @param sysTenant
|
||||
*/
|
||||
@PostMapping("/saveTenantJoinUser")
|
||||
public Result<Integer> saveTenantJoinUser(@RequestBody SysTenant sysTenant){
|
||||
Result<Integer> result = new Result<>();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
//---author:scott---date:20220111-----for: 限制免费用户只能创建两个租户--
|
||||
Integer count = sysTenantService.countCreateTenantNum(sysUser.getUsername());
|
||||
if (count > 2) {
|
||||
Set<String> roles = sysUserService.getUserRolesSet(sysUser.getUsername());
|
||||
//创建一个付费角色 paymember
|
||||
if (roles==null || (!roles.contains("paymember") && !roles.contains("admin"))) {
|
||||
return result.error500("免费用户最多创建两个租户!");
|
||||
}
|
||||
}
|
||||
//---author:scott---date:20220111-----for: 限制免费用户只能创建两个租户--
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
Integer tenantId = sysTenantService.saveTenantJoinUser(sysTenant, sysUser.getId());
|
||||
result.setSuccess(true);
|
||||
result.setMessage("创建成功");
|
||||
result.setResult(tenantId);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入租户通过门牌号【低代码应用专用接口】
|
||||
* @param sysTenant
|
||||
*/
|
||||
@PostMapping("/joinTenantByHouseNumber")
|
||||
public Result<Integer> joinTenantByHouseNumber(@RequestBody SysTenant sysTenant){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
Integer tenantId = sysTenantService.joinTenantByHouseNumber(sysTenant, sysUser.getId());
|
||||
Result<Integer> result = new Result<>();
|
||||
if(tenantId != 0){
|
||||
result.setMessage("申请租户成功");
|
||||
result.setSuccess(true);
|
||||
result.setResult(tenantId);
|
||||
return result;
|
||||
}else{
|
||||
result.setMessage("该门牌号不存在");
|
||||
result.setSuccess(false);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//update-begin---author:wangshuai ---date:20230107 for:[QQYUN-3725]申请加入租户,审核中状态增加接口------------
|
||||
/**
|
||||
* 分页获取租户用户数据(vue3用户租户页面)【低代码应用专用接口】
|
||||
*
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param userTenantStatus
|
||||
* @param type
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUserTenantPageList")
|
||||
//@RequiresPermissions("system:tenant:tenantPageList")
|
||||
public Result<IPage<SysUserTenantVo>> getUserTenantPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "userTenantStatus") String userTenantStatus,
|
||||
@RequestParam(name = "type", required = false) String type,
|
||||
SysUser user,
|
||||
HttpServletRequest req) {
|
||||
Page<SysUserTenantVo> page = new Page<SysUserTenantVo>(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String tenantId = oConvertUtils.getString(TenantContext.getTenant(), "0");
|
||||
IPage<SysUserTenantVo> list = relationService.getUserTenantPageList(page, Arrays.asList(userTenantStatus.split(SymbolConstant.COMMA)), user, Integer.valueOf(tenantId));
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户id获取租户列表【低代码应用专用接口】
|
||||
*
|
||||
* @param userTenantStatus 关系表的状态
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTenantListByUserId")
|
||||
//@RequiresPermissions("system:tenant:getTenantListByUserId")
|
||||
public Result<List<SysUserTenantVo>> getTenantListByUserId(@RequestParam(name = "userTenantStatus", required = false) String userTenantStatus) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<String> list = null;
|
||||
if (oConvertUtils.isNotEmpty(userTenantStatus)) {
|
||||
list = Arrays.asList(userTenantStatus.split(SymbolConstant.COMMA));
|
||||
}
|
||||
//租户状态,用户id,租户用户关系状态
|
||||
List<SysUserTenantVo> sysTenant = relationService.getTenantListByUserId(sysUser.getId(), list);
|
||||
return Result.ok(sysTenant);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户租户关系状态【低代码应用专用接口】
|
||||
*/
|
||||
@PutMapping("/updateUserTenantStatus")
|
||||
//@RequiresPermissions("system:tenant:updateUserTenantStatus")
|
||||
public Result<String> updateUserTenantStatus(@RequestBody SysUserTenant userTenant) {
|
||||
String tenantId = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(tenantId)) {
|
||||
return Result.error("未找到当前租户信息");
|
||||
}
|
||||
relationService.updateUserTenantStatus(userTenant.getUserId(), tenantId, userTenant.getStatus());
|
||||
return Result.ok("更新用户租户状态成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销租户【低代码应用专用接口】
|
||||
*
|
||||
* @param sysTenant
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/cancelTenant")
|
||||
//@RequiresPermissions("system:tenant:cancelTenant")
|
||||
public Result<String> cancelTenant(@RequestBody SysTenant sysTenant,HttpServletRequest request) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
SysTenant tenant = sysTenantService.getById(sysTenant.getId());
|
||||
if (null == tenant) {
|
||||
return Result.error("未找到当前租户信息");
|
||||
}
|
||||
if (!sysUser.getUsername().equals(tenant.getCreateBy())) {
|
||||
return Result.error("没有权限");
|
||||
}
|
||||
SysUser userById = sysUserService.getById(sysUser.getId());
|
||||
String loginPassword = request.getParameter("loginPassword");
|
||||
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(),loginPassword, userById.getSalt());
|
||||
if (!passwordEncode.equals(userById.getPassword())) {
|
||||
return Result.error("密码不正确");
|
||||
}
|
||||
sysTenantService.removeById(sysTenant.getId());
|
||||
return Result.ok("注销成功");
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20230107 for:[QQYUN-3725]申请加入租户,审核中状态增加接口------------
|
||||
|
||||
/**
|
||||
* 获取租户用户不同状态下的数量【低代码应用专用接口】
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTenantStatusCount")
|
||||
public Result<Long> getTenantStatusCount(@RequestParam(value = "status",defaultValue = "1") String status, HttpServletRequest req){
|
||||
String tenantId = TokenUtils.getTenantIdByRequest(req);
|
||||
if (null == tenantId) {
|
||||
return Result.error("未找到当前租户信息");
|
||||
}
|
||||
LambdaQueryWrapper<SysUserTenant> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysUserTenant::getTenantId,tenantId);
|
||||
query.eq(SysUserTenant::getStatus,status);
|
||||
long count = relationService.count(query);
|
||||
return Result.ok(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户取消租户申请【低代码应用专用接口】
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/cancelApplyTenant")
|
||||
public Result<String> cancelApplyTenant(@RequestParam("tenantId") String tenantId){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
sysTenantService.leaveTenant(sysUser.getId(),tenantId);
|
||||
return Result.ok("取消申请成功");
|
||||
}
|
||||
|
||||
//===========【低代码应用,前端专用接口 —— 加入限制只能维护和查看自己拥有的租户】==========================================================
|
||||
|
||||
/**
|
||||
* 彻底删除租户
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/deleteLogicDeleted")
|
||||
@RequiresPermissions("system:tenant:deleteTenantLogic")
|
||||
public Result<String> deleteTenantLogic(@RequestParam("ids") String ids){
|
||||
sysTenantService.deleteTenantLogic(ids);
|
||||
return Result.ok("彻底删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 还原删除的租户
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/revertTenantLogic")
|
||||
@RequiresPermissions("system:tenant:revertTenantLogic")
|
||||
public Result<String> revertTenantLogic(@RequestParam("ids") String ids){
|
||||
sysTenantService.revertTenantLogic(ids);
|
||||
return Result.ok("还原成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出租户【低代码应用专用接口】
|
||||
* @param sysTenant
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/exitUserTenant")
|
||||
public Result<String> exitUserTenant(@RequestBody SysTenant sysTenant,HttpServletRequest request){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//验证用户是否已存在
|
||||
Integer count = relationService.userTenantIzExist(sysUser.getId(),sysTenant.getId());
|
||||
if (count == 0) {
|
||||
return Result.error("此租户下没有当前用户");
|
||||
}
|
||||
//验证密码
|
||||
String loginPassword = request.getParameter("loginPassword");
|
||||
SysUser userById = sysUserService.getById(sysUser.getId());
|
||||
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(),loginPassword, userById.getSalt());
|
||||
if (!passwordEncode.equals(userById.getPassword())) {
|
||||
return Result.error("密码不正确");
|
||||
}
|
||||
//退出登录
|
||||
sysTenantService.exitUserTenant(sysUser.getId(),sysUser.getUsername(),String.valueOf(sysTenant.getId()));
|
||||
return Result.ok("退出租户成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更租户拥有者【低代码应用专用接口】
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/changeOwenUserTenant")
|
||||
public Result<String> changeOwenUserTenant(@RequestParam("userId") String userId){
|
||||
sysTenantService.changeOwenUserTenant(userId);
|
||||
return Result.ok("退出租户成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请用户到租户,通过手机号匹配 【低代码应用专用接口】
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/invitationUser")
|
||||
public Result<String> invitationUser(@RequestParam(name="phone") String phone){
|
||||
return sysTenantService.invitationUser(phone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取 租户产品包-3个默认admin的人员数量
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/loadAdminPackCount")
|
||||
public Result<List<TenantPackUserCount>> loadAdminPackCount(@RequestParam("tenantId") Integer tenantId){
|
||||
List<TenantPackUserCount> list = sysTenantService.queryTenantPackUserCount(tenantId);
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户产品包信息
|
||||
* @param packModel
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTenantPackInfo")
|
||||
public Result<TenantPackModel> getTenantPackInfo(TenantPackModel packModel){
|
||||
TenantPackModel tenantPackModel = sysTenantService.queryTenantPack(packModel);
|
||||
return Result.ok(tenantPackModel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加用户和产品包的关系数据
|
||||
* @param sysTenantPackUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addTenantPackUser")
|
||||
public Result<?> addTenantPackUser(@RequestBody SysTenantPackUser sysTenantPackUser){
|
||||
sysTenantService.addBatchTenantPackUser(sysTenantPackUser);
|
||||
return Result.ok("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 从产品包移除用户
|
||||
* @param sysTenantPackUser
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/deleteTenantPackUser")
|
||||
public Result<?> deleteTenantPackUser(@RequestBody SysTenantPackUser sysTenantPackUser){
|
||||
sysTenantService.deleteTenantPackUser(sysTenantPackUser);
|
||||
return Result.ok("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改申请状态
|
||||
* @param sysTenant
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/updateApplyStatus")
|
||||
public Result<?> updateApplyStatus(@RequestBody SysTenant sysTenant){
|
||||
SysTenant entity = this.sysTenantService.getById(sysTenant.getId());
|
||||
if(entity==null){
|
||||
return Result.error("租户不存在!");
|
||||
}
|
||||
entity.setApplyStatus(sysTenant.getApplyStatus());
|
||||
sysTenantService.updateById(entity);
|
||||
return Result.ok("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品包人员申请列表
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTenantPackApplyUsers")
|
||||
public Result<?> getTenantPackApplyUsers(@RequestParam("tenantId") Integer tenantId){
|
||||
List<TenantPackUser> list = sysTenantService.getTenantPackApplyUsers(tenantId);
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人 申请成为管理员
|
||||
* @param sysTenantPackUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doApplyTenantPackUser")
|
||||
public Result<?> doApplyTenantPackUser(@RequestBody SysTenantPackUser sysTenantPackUser){
|
||||
sysTenantService.doApplyTenantPackUser(sysTenantPackUser);
|
||||
return Result.ok("申请成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请通过 成为管理员
|
||||
* @param sysTenantPackUser
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/passApply")
|
||||
public Result<?> passApply(@RequestBody SysTenantPackUser sysTenantPackUser){
|
||||
sysTenantService.passApply(sysTenantPackUser);
|
||||
return Result.ok("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝申请 成为管理员
|
||||
* @param sysTenantPackUser
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/deleteApply")
|
||||
public Result<?> deleteApply(@RequestBody SysTenantPackUser sysTenantPackUser){
|
||||
sysTenantService.deleteApply(sysTenantPackUser);
|
||||
return Result.ok("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入应用组织页面 查询租户信息及当前用户是否有 管理员的权限--
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryTenantAuthInfo", method = RequestMethod.GET)
|
||||
public Result<TenantDepartAuthInfo> queryTenantAuthInfo(@RequestParam(name="id",required=true) String id) {
|
||||
TenantDepartAuthInfo info = sysTenantService.getTenantDepartAuthInfo(Integer.parseInt(id));
|
||||
return Result.ok(info);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
|
@ -31,6 +32,8 @@ import org.jeecg.modules.system.model.SysUserSysDepartModel;
|
|||
import org.jeecg.modules.system.service.*;
|
||||
import org.jeecg.modules.system.vo.SysDepartUsersVO;
|
||||
import org.jeecg.modules.system.vo.SysUserRoleVO;
|
||||
import org.jeecg.modules.system.vo.lowapp.DepartAndUserInfo;
|
||||
import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
|
@ -74,9 +77,6 @@ public class SysUserController {
|
|||
@Autowired
|
||||
private ISysUserDepartService sysUserDepartService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserRoleService userRoleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartRoleUserService departRoleUserService;
|
||||
|
||||
|
@ -92,8 +92,17 @@ public class SysUserController {
|
|||
@Autowired
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserAgentService sysUserAgentService;
|
||||
|
||||
@Autowired
|
||||
private ISysPositionService sysPositionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserTenantService userTenantService;
|
||||
|
||||
/**
|
||||
* 获取用户列表数据
|
||||
* 获取租户下用户数据(支持租户隔离)
|
||||
* @param user
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
|
@ -104,63 +113,42 @@ public class SysUserController {
|
|||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
|
||||
//update-begin-Author:wangshuai--Date:20211119--for:【vue3】通过部门id查询用户,通过code查询id
|
||||
//部门ID
|
||||
String departId = req.getParameter("departId");
|
||||
if(oConvertUtils.isNotEmpty(departId)){
|
||||
LambdaQueryWrapper<SysUserDepart> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysUserDepart::getDepId,departId);
|
||||
List<SysUserDepart> list = sysUserDepartService.list(query);
|
||||
List<String> userIds = list.stream().map(SysUserDepart::getUserId).collect(Collectors.toList());
|
||||
//update-begin---author:wangshuai ---date:20220322 for:[issues/I4XTYB]查询用户时,当部门id 下没有分配用户时接口报错------------
|
||||
if(oConvertUtils.listIsNotEmpty(userIds)){
|
||||
queryWrapper.in("id",userIds);
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
String tenantId = oConvertUtils.getString(TenantContext.getTenant(), "0");
|
||||
//update-begin---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
List<String> userIds = userTenantService.getUserIdsByTenantId(Integer.valueOf(tenantId));
|
||||
if (oConvertUtils.listIsNotEmpty(userIds)) {
|
||||
queryWrapper.in("id", userIds);
|
||||
}else{
|
||||
return Result.OK();
|
||||
queryWrapper.eq("id", "通过租户查询不到任何用户");
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20220322 for:[issues/I4XTYB]查询用户时,当部门id 下没有分配用户时接口报错------------
|
||||
//update-end---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
}
|
||||
//用户ID
|
||||
String code = req.getParameter("code");
|
||||
if(oConvertUtils.isNotEmpty(code)){
|
||||
queryWrapper.in("id",Arrays.asList(code.split(",")));
|
||||
pageSize = code.split(",").length;
|
||||
}
|
||||
//update-end-Author:wangshuai--Date:20211119--for:【vue3】通过部门id查询用户,通过code查询id
|
||||
|
||||
//update-begin-author:taoyan--date:20220104--for: JTC-372 【用户冻结问题】 online授权、用户组件,选择用户都能看到被冻结的用户
|
||||
String status = req.getParameter("status");
|
||||
if(oConvertUtils.isNotEmpty(status)){
|
||||
queryWrapper.eq("status", Integer.parseInt(status));
|
||||
}
|
||||
//update-end-author:taoyan--date:20220104--for: JTC-372 【用户冻结问题】 online授权、用户组件,选择用户都能看到被冻结的用户
|
||||
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
queryWrapper.ne("username","_reserve_user_external");
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
||||
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
||||
|
||||
//批量查询用户的所属部门
|
||||
//step.1 先拿到全部的 useids
|
||||
//step.2 通过 useids,一次性查询用户的所属部门名字
|
||||
List<String> userIds = pageList.getRecords().stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
if(userIds!=null && userIds.size()>0){
|
||||
Map<String,String> useDepNames = sysUserService.getDepNamesByUserIds(userIds);
|
||||
pageList.getRecords().forEach(item->{
|
||||
item.setOrgCodeTxt(useDepNames.get(item.getId()));
|
||||
});
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
log.info(pageList.toString());
|
||||
return result;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
return sysUserService.queryPageList(req, queryWrapper, pageSize, pageNo);
|
||||
}
|
||||
|
||||
//@RequiresRoles({"admin"})
|
||||
//@RequiresPermissions("system:user:add")
|
||||
/**
|
||||
* 获取系统用户数据(查询全部用户,不做租户隔离)
|
||||
*
|
||||
* @param user
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:user:listAll")
|
||||
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUser>> queryAllPageList(SysUser user, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
return sysUserService.queryPageList(req, queryWrapper, pageSize, pageNo);
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysUser> add(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
|
@ -178,7 +166,9 @@ public class SysUserController {
|
|||
//用户表字段org_code不能在这里设置他的值
|
||||
user.setOrgCode(null);
|
||||
// 保存用户走一个service 保证事务
|
||||
sysUserService.saveUser(user, selectedRoles, selectedDeparts);
|
||||
//获取租户ids
|
||||
String relTenantIds = jsonObject.getString("realTenantIds");
|
||||
sysUserService.saveUser(user, selectedRoles, selectedDeparts, relTenantIds);
|
||||
baseCommonService.addLog("添加用户,username: " +user.getUsername() ,CommonConstant.LOG_TYPE_2, 2);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
|
@ -188,8 +178,7 @@ public class SysUserController {
|
|||
return result;
|
||||
}
|
||||
|
||||
//@RequiresRoles({"admin"})
|
||||
//@RequiresPermissions("system:user:edit")
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
|
@ -212,7 +201,9 @@ public class SysUserController {
|
|||
//用户表字段org_code不能在这里设置他的值
|
||||
user.setOrgCode(null);
|
||||
// 修改用户走一个service 保证事务
|
||||
sysUserService.editUser(user, roles, departs);
|
||||
//获取租户ids
|
||||
String relTenantIds = jsonObject.getString("relTenantIds");
|
||||
sysUserService.editUser(user, roles, departs, relTenantIds);
|
||||
result.success("修改成功!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -225,7 +216,7 @@ public class SysUserController {
|
|||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3);
|
||||
|
@ -236,7 +227,7 @@ public class SysUserController {
|
|||
/**
|
||||
* 批量删除用户
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
baseCommonService.addLog("批量删除用户, ids: " +ids ,CommonConstant.LOG_TYPE_2, 3);
|
||||
|
@ -249,7 +240,7 @@ public class SysUserController {
|
|||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:frozenBatch")
|
||||
@RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
|
||||
public Result<SysUser> frozenBatch(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
|
@ -272,6 +263,7 @@ public class SysUserController {
|
|||
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:queryById")
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<SysUser> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
|
@ -285,6 +277,7 @@ public class SysUserController {
|
|||
return result;
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:queryUserRole")
|
||||
@RequestMapping(value = "/queryUserRole", method = RequestMethod.GET)
|
||||
public Result<List<String>> queryUserRole(@RequestParam(name = "userid", required = true) String userid) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
|
@ -337,7 +330,7 @@ public class SysUserController {
|
|||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:changepwd")
|
||||
@RequestMapping(value = "/changePassword", method = RequestMethod.PUT)
|
||||
public Result<?> changePassword(@RequestBody SysUser sysUser) {
|
||||
SysUser u = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, sysUser.getUsername()));
|
||||
|
@ -460,8 +453,7 @@ public class SysUserController {
|
|||
* @param request
|
||||
* @param sysUser
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
//@RequiresPermissions("system:user:export")
|
||||
@RequiresPermissions("system:user:export")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
|
||||
// Step.1 组装查询条件
|
||||
|
@ -494,8 +486,7 @@ public class SysUserController {
|
|||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
//@RequiresPermissions("system:user:import")
|
||||
@RequiresPermissions("system:user:import")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response)throws IOException {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
|
@ -588,10 +579,28 @@ public class SysUserController {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @功能:根据id 批量查询
|
||||
* @param userNames
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryByNames", method = RequestMethod.GET)
|
||||
public Result<Collection<SysUser>> queryByNames(@RequestParam String userNames) {
|
||||
Result<Collection<SysUser>> result = new Result<>();
|
||||
String[] names = userNames.split(",");
|
||||
QueryWrapper<SysUser> queryWrapper=new QueryWrapper();
|
||||
queryWrapper.lambda().in(true,SysUser::getUsername,names);
|
||||
Collection<SysUser> userRole = sysUserService.list(queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(userRole);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页用户重置密码
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:updatepwd")
|
||||
@RequestMapping(value = "/updatePassword", method = RequestMethod.PUT)
|
||||
public Result<?> updatePassword(@RequestBody JSONObject json) {
|
||||
String username = json.getString("username");
|
||||
|
@ -632,7 +641,7 @@ public class SysUserController {
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:addUserRole")
|
||||
@RequestMapping(value = "/addSysUserRole", method = RequestMethod.POST)
|
||||
public Result<String> addSysUserRole(@RequestBody SysUserRoleVO sysUserRoleVO) {
|
||||
Result<String> result = new Result<String>();
|
||||
|
@ -663,7 +672,7 @@ public class SysUserController {
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:deleteRole")
|
||||
@RequestMapping(value = "/deleteUserRole", method = RequestMethod.DELETE)
|
||||
public Result<SysUserRole> deleteUserRole(@RequestParam(name="roleId") String roleId,
|
||||
@RequestParam(name="userId",required=true) String userId
|
||||
|
@ -687,7 +696,7 @@ public class SysUserController {
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:deleteRoleBatch")
|
||||
@RequestMapping(value = "/deleteUserRoleBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysUserRole> deleteUserRoleBatch(
|
||||
@RequestParam(name="roleId") String roleId,
|
||||
|
@ -740,6 +749,10 @@ public class SysUserController {
|
|||
item.setOrgCode(useDepNames.get(item.getId()));
|
||||
});
|
||||
}
|
||||
//update-begin---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
//设置租户id
|
||||
page.setRecords(userTenantService.setUserTenantIds(page.getRecords()));
|
||||
//update-end---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
}else{
|
||||
|
@ -814,7 +827,7 @@ public class SysUserController {
|
|||
/**
|
||||
* 给指定部门添加对应的用户
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:editDepartWithUser")
|
||||
@RequestMapping(value = "/editSysDepartWithUser", method = RequestMethod.POST)
|
||||
public Result<String> editSysDepartWithUser(@RequestBody SysDepartUsersVO sysDepartUsersVO) {
|
||||
Result<String> result = new Result<String>();
|
||||
|
@ -843,7 +856,7 @@ public class SysUserController {
|
|||
/**
|
||||
* 删除指定机构的用户关系
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:deleteUserInDepart")
|
||||
@RequestMapping(value = "/deleteUserInDepart", method = RequestMethod.DELETE)
|
||||
public Result<SysUserDepart> deleteUserInDepart(@RequestParam(name="depId") String depId,
|
||||
@RequestParam(name="userId",required=true) String userId
|
||||
|
@ -875,7 +888,7 @@ public class SysUserController {
|
|||
/**
|
||||
* 批量删除指定机构的用户关系
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:deleteUserInDepartBatch")
|
||||
@RequestMapping(value = "/deleteUserInDepartBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysUserDepart> deleteUserInDepartBatch(
|
||||
@RequestParam(name="depId") String depId,
|
||||
|
@ -982,13 +995,18 @@ public class SysUserController {
|
|||
return result;
|
||||
}
|
||||
|
||||
String realname = jsonObject.getString("realname");
|
||||
if(oConvertUtils.isEmpty(realname)){
|
||||
realname = username;
|
||||
}
|
||||
|
||||
try {
|
||||
user.setCreateTime(new Date());// 设置创建时间
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
String passwordEncode = PasswordUtil.encrypt(username, password, salt);
|
||||
user.setSalt(salt);
|
||||
user.setUsername(username);
|
||||
user.setRealname(username);
|
||||
user.setRealname(realname);
|
||||
user.setPassword(passwordEncode);
|
||||
user.setEmail(email);
|
||||
user.setPhone(phone);
|
||||
|
@ -1065,6 +1083,12 @@ public class SysUserController {
|
|||
SysUser user = sysUserService.getOne(query);
|
||||
Map<String,String> map = new HashMap(5);
|
||||
map.put("smscode",smscode);
|
||||
if(null == user){
|
||||
//前端根据文字做判断用户是否存在判断,不能修改
|
||||
result.setMessage("用户信息不存在");
|
||||
result.setSuccess(false);
|
||||
return result;
|
||||
}
|
||||
map.put("username",user.getUsername());
|
||||
result.setResult(map);
|
||||
result.setSuccess(true);
|
||||
|
@ -1239,7 +1263,7 @@ public class SysUserController {
|
|||
* @param userIds 被删除的用户ID,多个id用半角逗号分割
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("system:user:deleteRecycleBin")
|
||||
@RequestMapping(value = "/deleteRecycleBin", method = RequestMethod.DELETE)
|
||||
public Result deleteRecycleBin(@RequestParam("userIds") String userIds) {
|
||||
if (StringUtils.isNotBlank(userIds)) {
|
||||
|
@ -1254,6 +1278,7 @@ public class SysUserController {
|
|||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/appEdit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<SysUser> appEdit(HttpServletRequest request,@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
|
@ -1466,5 +1491,255 @@ public class SysUserController {
|
|||
}
|
||||
return ls;
|
||||
}
|
||||
|
||||
/**
|
||||
* 聊天 创建聊天组件专用 根据用户账号、用户姓名、部门id分页查询
|
||||
* @param departId 部门id
|
||||
* @param keyword 搜索值
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getUserInformation")
|
||||
public Result<IPage<SysUser>> getUserInformation(
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "departId", required = false) String departId,
|
||||
@RequestParam(name="keyword",required=false) String keyword) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
Integer tenantId = null;
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
tenantId = oConvertUtils.getInt(TenantContext.getTenant(),0);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
IPage<SysUser> pageList = sysUserDepartService.getUserInformation(tenantId,departId, keyword, pageSize, pageNo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 简版流程用户选择组件
|
||||
* @param departId 部门id
|
||||
* @param roleId 角色id
|
||||
* @param keyword 搜索值
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/selectUserList")
|
||||
public Result<IPage<SysUser>> selectUserList(
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "departId", required = false) String departId,
|
||||
@RequestParam(name = "roleId", required = false) String roleId,
|
||||
@RequestParam(name="keyword",required=false) String keyword) {
|
||||
//------------------------------------------------------------------------------------------------
|
||||
Integer tenantId = null;
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
String tenantStr = TenantContext.getTenant();
|
||||
if(oConvertUtils.isNotEmpty(tenantStr)){
|
||||
tenantId = Integer.parseInt(tenantStr);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
IPage<SysUser> pageList = sysUserDepartService.getUserInformation(tenantId, departId,roleId, keyword, pageSize, pageNo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户离职(新增代理人和用户状态变更操作)【低代码应用专用接口】
|
||||
* @param sysUserAgent
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/userQuitAgent")
|
||||
public Result<String> userQuitAgent(@RequestBody SysUserAgent sysUserAgent){
|
||||
//判断id是否为空
|
||||
if(oConvertUtils.isNotEmpty(sysUserAgent.getId())){
|
||||
sysUserAgentService.updateById(sysUserAgent);
|
||||
}else{
|
||||
sysUserAgentService.save(sysUserAgent);
|
||||
}
|
||||
sysUserService.userQuit(sysUserAgent.getUserName());
|
||||
return Result.ok("离职成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取被逻辑删除的用户列表,无分页【低代码应用专用接口】
|
||||
*
|
||||
* @return List<SysUser>
|
||||
*/
|
||||
@GetMapping("/getQuitList")
|
||||
public Result<List<SysUser>> getQuitList(HttpServletRequest req) {
|
||||
Integer tenantId = oConvertUtils.getInt(TokenUtils.getTenantIdByRequest(req),0);
|
||||
List<SysUser> quitList = sysUserService.getQuitList(tenantId);
|
||||
if (null != quitList && quitList.size() > 0) {
|
||||
// 批量查询用户的所属部门
|
||||
// step.1 先拿到全部的 userIds
|
||||
List<String> userIds = quitList.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
// step.2 通过 userIds,一次性查询用户的所属部门名字
|
||||
Map<String, String> useDepNames = sysUserService.getDepNamesByUserIds(userIds);
|
||||
quitList.forEach(item -> item.setOrgCode(useDepNames.get(item.getId())));
|
||||
}
|
||||
return Result.ok(quitList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新刪除状态和离职状态【低代码应用专用接口】
|
||||
* @param jsonObject
|
||||
* @return Result<String>
|
||||
*/
|
||||
@PutMapping("/putCancelQuit")
|
||||
public Result<String> putCancelQuit(@RequestBody JSONObject jsonObject, HttpServletRequest request){
|
||||
String userIds = jsonObject.getString("userIds");
|
||||
String usernames = jsonObject.getString("usernames");
|
||||
Integer tenantId = oConvertUtils.getInt(TokenUtils.getTenantIdByRequest(request),0);
|
||||
//将状态改成未删除
|
||||
if (StringUtils.isNotBlank(userIds)) {
|
||||
userTenantService.putCancelQuit(Arrays.asList(userIds.split(SymbolConstant.COMMA)),tenantId);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(usernames)){
|
||||
//根据用户名删除代理人
|
||||
LambdaQueryWrapper<SysUserAgent> query = new LambdaQueryWrapper<>();
|
||||
query.in(SysUserAgent::getUserName,Arrays.asList(usernames.split(SymbolConstant.COMMA)));
|
||||
sysUserAgentService.remove(query);
|
||||
}
|
||||
return Result.ok("取消离职成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息(vue3用户设置专用)【低代码应用专用接口】
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/login/setting/getUserData")
|
||||
public Result<SysUser> getUserData(HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
SysUser user = sysUserService.getUserByName(username);
|
||||
if(user==null) {
|
||||
return Result.error("未找到该用户数据");
|
||||
}
|
||||
if(oConvertUtils.isNotEmpty(user.getPost())){
|
||||
String post = user.getPost();
|
||||
LambdaQueryWrapper<SysPosition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysPosition::getCode,Arrays.asList(post.split(SymbolConstant.COMMA)));
|
||||
queryWrapper.select(SysPosition::getName);
|
||||
List<SysPosition> sysPositionList = sysPositionService.list(queryWrapper);
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
String verticalBar = " | ";
|
||||
for (SysPosition sysPosition:sysPositionList){
|
||||
nameBuilder.append(sysPosition.getName()).append(verticalBar);
|
||||
}
|
||||
String names = nameBuilder.toString();
|
||||
if(oConvertUtils.isNotEmpty(names)){
|
||||
names = names.substring(0,names.lastIndexOf(verticalBar));
|
||||
user.setPostText(names);
|
||||
}
|
||||
}
|
||||
return Result.ok(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户编辑(vue3用户设置专用)【低代码应用专用接口】
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login/setting/userEdit")
|
||||
@RequiresPermissions("system:user:setting:edit")
|
||||
public Result<String> userEdit(@RequestBody SysUser sysUser, HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
SysUser user = sysUserService.getById(sysUser.getId());
|
||||
if(user==null) {
|
||||
return Result.error("未找到该用户数据");
|
||||
}
|
||||
if(!username.equals(user.getUsername())){
|
||||
return Result.error("只能修改自己的数据");
|
||||
}
|
||||
sysUserService.updateById(sysUser);
|
||||
return Result.ok("更新个人信息成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改 【low-app】
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/batchEditUsers")
|
||||
public Result<SysUser> batchEditUsers(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
try {
|
||||
sysUserService.batchEditUsers(jsonObject);
|
||||
result.setSuccess(true);
|
||||
result.setMessage("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键词搜索部门和用户【low-app】
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/searchByKeyword")
|
||||
public Result<DepartAndUserInfo> searchByKeyword(@RequestParam(name="keyword",required=false) String keyword) {
|
||||
DepartAndUserInfo info = sysUserService.searchByKeyword(keyword);
|
||||
return Result.ok(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑部门前获取部门相关信息 【low-app】
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUpdateDepartInfo")
|
||||
public Result<UpdateDepartInfo> getUpdateDepartInfo(@RequestParam(name="id",required=false) String id) {
|
||||
UpdateDepartInfo info = sysUserService.getUpdateDepartInfo(id);
|
||||
return Result.ok(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑部门 【low-app】
|
||||
* @param updateDepartInfo
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/doUpdateDepartInfo")
|
||||
public Result<?> doUpdateDepartInfo(@RequestBody UpdateDepartInfo updateDepartInfo) {
|
||||
sysUserService.doUpdateDepartInfo(updateDepartInfo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置负责人 取消负责人
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/changeDepartChargePerson")
|
||||
public Result<?> changeDepartChargePerson(@RequestBody JSONObject json) {
|
||||
sysUserService.changeDepartChargePerson(json);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户下的用户【低代码应用专用接口】
|
||||
* @param sysUser
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/editTenantUser", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> editTenantUser(@RequestBody SysUser sysUser,HttpServletRequest req){
|
||||
Result<String> result = new Result<>();
|
||||
String tenantId = TokenUtils.getTenantIdByRequest(req);
|
||||
if(oConvertUtils.isEmpty(tenantId)){
|
||||
return result.error500("无权修改他人信息!");
|
||||
}
|
||||
LambdaQueryWrapper<SysUserTenant> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysUserTenant::getTenantId,Integer.valueOf(tenantId));
|
||||
query.eq(SysUserTenant::getUserId,sysUser.getId());
|
||||
SysUserTenant one = userTenantService.getOne(query);
|
||||
if(null == one){
|
||||
return result.error500("非当前租户下的用户,不允许修改!");
|
||||
}
|
||||
String departs = req.getParameter("selecteddeparts");
|
||||
String roles = req.getParameter("selectedroles");
|
||||
sysUserService.editTenantUser(sysUser,tenantId,departs,roles);
|
||||
return Result.ok("修改成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.xkcoding.justauth.AuthRequestFactory;
|
||||
|
@ -12,16 +13,14 @@ import me.zhyd.oauth.utils.AuthStateUtils;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.RestUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.config.thirdapp.ThirdAppConfig;
|
||||
import org.jeecg.config.thirdapp.ThirdAppTypeItemVo;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.system.entity.SysThirdAccount;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.ThirdLoginModel;
|
||||
import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.jeecg.modules.system.service.ISysThirdAccountService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.jeecg.modules.system.service.impl.ThirdAppDingtalkServiceImpl;
|
||||
|
@ -31,10 +30,12 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -49,7 +50,8 @@ public class ThirdLoginController {
|
|||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private ISysThirdAccountService sysThirdAccountService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
@Autowired
|
||||
private BaseCommonService baseCommonService;
|
||||
@Autowired
|
||||
|
@ -91,8 +93,8 @@ public class ThirdLoginController {
|
|||
//判断有没有这个人
|
||||
//update-begin-author:wangshuai date:20201118 for:修改成查询第三方账户表
|
||||
LambdaQueryWrapper<SysThirdAccount> query = new LambdaQueryWrapper<SysThirdAccount>();
|
||||
query.eq(SysThirdAccount::getThirdUserUuid, uuid);
|
||||
query.eq(SysThirdAccount::getThirdType, source);
|
||||
query.and(q -> q.eq(SysThirdAccount::getThirdUserUuid, uuid).or().eq(SysThirdAccount::getThirdUserId, uuid));
|
||||
List<SysThirdAccount> thridList = sysThirdAccountService.list(query);
|
||||
SysThirdAccount user = null;
|
||||
if(thridList==null || thridList.size()==0) {
|
||||
|
@ -235,8 +237,12 @@ public class ThirdLoginController {
|
|||
}
|
||||
//update-end-author:wangshuai date:20201118 for:如果真实姓名和头像不存在就取第三方登录的
|
||||
JSONObject obj = new JSONObject();
|
||||
//TODO 第三方登确定登录租户和部门逻辑
|
||||
|
||||
//用户登录信息
|
||||
obj.put("userInfo", sysUser);
|
||||
//获取字典缓存【解决 #jeecg-boot/issues/3998】
|
||||
obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
|
||||
//token 信息
|
||||
obj.put("token", token);
|
||||
result.setResult(obj);
|
||||
|
@ -293,7 +299,7 @@ public class ThirdLoginController {
|
|||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/oauth2/{source}/login")
|
||||
public String oauth2LoginCallback(@PathVariable("source") String source, @RequestParam("state") String state, HttpServletResponse response) throws Exception {
|
||||
public String oauth2LoginCallback(@PathVariable("source") String source, @RequestParam("state") String state, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String url;
|
||||
if (ThirdAppConfig.WECHAT_ENTERPRISE.equalsIgnoreCase(source)) {
|
||||
ThirdAppTypeItemVo config = thirdAppConfig.getWechatEnterprise();
|
||||
|
@ -303,7 +309,7 @@ public class ThirdLoginController {
|
|||
// 企业的CorpID
|
||||
builder.append("?appid=").append(config.getClientId());
|
||||
// 授权后重定向的回调链接地址,请使用urlencode对链接进行处理
|
||||
String redirectUri = RestUtil.getBaseUrl() + "/sys/thirdLogin/oauth2/wechat_enterprise/callback";
|
||||
String redirectUri = CommonUtils.getBaseUrl(request) + "/sys/thirdLogin/oauth2/wechat_enterprise/callback";
|
||||
builder.append("&redirect_uri=").append(URLEncoder.encode(redirectUri, "UTF-8"));
|
||||
// 返回类型,此时固定为:code
|
||||
builder.append("&response_type=code");
|
||||
|
@ -322,7 +328,7 @@ public class ThirdLoginController {
|
|||
builder.append("https://login.dingtalk.com/oauth2/auth");
|
||||
// 授权通过/拒绝后回调地址。
|
||||
// 注意 需要与注册应用时登记的域名保持一致。
|
||||
String redirectUri = RestUtil.getBaseUrl() + "/sys/thirdLogin/oauth2/dingtalk/callback";
|
||||
String redirectUri = CommonUtils.getBaseUrl(request) + "/sys/thirdLogin/oauth2/dingtalk/callback";
|
||||
builder.append("?redirect_uri=").append(URLEncoder.encode(redirectUri, "UTF-8"));
|
||||
// 固定值为code。
|
||||
// 授权通过后返回authCode。
|
||||
|
|
|
@ -162,4 +162,7 @@ public class SysAnnouncement implements Serializable {
|
|||
* 发送记录ID
|
||||
*/
|
||||
private transient String sendId;
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,9 @@ public class SysCategory implements Serializable,Comparable<SysCategory>{
|
|||
@Excel(name = "是否有子节点(1:有)", width = 15)
|
||||
private java.lang.String hasChild;
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
|
||||
@Override
|
||||
public int compareTo(SysCategory o) {
|
||||
//比较条件我们定的是按照code的长度升序
|
||||
|
|
|
@ -117,4 +117,8 @@ public class SysDataSource {
|
|||
@Excel(name = "所属部门", width = 15)
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
|
||||
/**租户ID*/
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,11 @@ public class SysDepart implements Serializable {
|
|||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
|
||||
/**是否有叶子节点: 1是0否*/
|
||||
private Integer izLeaf;
|
||||
|
||||
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段负责人ids和旧的负责人ids
|
||||
/**部门负责人的ids*/
|
||||
|
@ -130,6 +135,7 @@ public class SysDepart implements Serializable {
|
|||
Objects.equals(createBy, depart.createBy) &&
|
||||
Objects.equals(createTime, depart.createTime) &&
|
||||
Objects.equals(updateBy, depart.updateBy) &&
|
||||
Objects.equals(tenantId, depart.tenantId) &&
|
||||
Objects.equals(updateTime, depart.updateTime);
|
||||
}
|
||||
|
||||
|
@ -138,10 +144,9 @@ public class SysDepart implements Serializable {
|
|||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return Objects.hash(super.hashCode(), id, parentId, departName,
|
||||
departNameEn, departNameAbbr, departOrder, description,orgCategory,
|
||||
orgType, orgCode, mobile, fax, address, memo, status,
|
||||
delFlag, createBy, createTime, updateBy, updateTime);
|
||||
delFlag, createBy, createTime, updateBy, updateTime, tenantId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,5 +81,10 @@ public class SysDict implements Serializable {
|
|||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
|
||||
/** 关联的低代码应用ID */
|
||||
private java.lang.String lowAppId;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
@ -9,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
@ -40,6 +42,7 @@ public class SysFiles {
|
|||
private String url;
|
||||
/**创建人登录名称*/
|
||||
@Excel(name = "创建人登录名称", width = 15)
|
||||
@Dict(dicCode = "username",dicText = "realname",dictTable = "sys_user")
|
||||
@ApiModelProperty(value = "创建人登录名称")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
|
@ -118,4 +121,22 @@ public class SysFiles {
|
|||
@Excel(name = "删除状态(0-正常,1-删除至回收站)", width = 15)
|
||||
@ApiModelProperty(value = "删除状态(0-正常,1-删除至回收站)")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 文件表不存在的字段:用户数据集合
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private String userData;
|
||||
|
||||
/**
|
||||
* 文件表不存在的字段:用户真实姓名
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private String realname;
|
||||
|
||||
/**
|
||||
* 文件表不存在的字段:压缩名称
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private String zipName;
|
||||
}
|
||||
|
|
|
@ -109,4 +109,9 @@ public class SysLog implements Serializable {
|
|||
@Dict(dicCode = "operate_type")
|
||||
private Integer operateType;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private Integer tenantId;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 产品包菜单关系表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_tenant_pack_perms")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sys_tenant_pack_perms对象", description="产品包菜单关系表")
|
||||
public class SysPackPermission implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键编号*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键编号")
|
||||
private String id;
|
||||
/**租户产品包名称*/
|
||||
@Excel(name = "租户产品包名称", width = 15)
|
||||
@ApiModelProperty(value = "租户产品包名称")
|
||||
private String packId;
|
||||
/**菜单id*/
|
||||
@Excel(name = "菜单id", width = 15)
|
||||
@ApiModelProperty(value = "菜单id")
|
||||
private String permissionId;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
}
|
|
@ -85,4 +85,8 @@ public class SysPosition {
|
|||
*/
|
||||
@ApiModelProperty(value = "组织机构编码")
|
||||
private java.lang.String sysOrgCode;
|
||||
|
||||
/**租户ID*/
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
}
|
||||
|
|
|
@ -78,5 +78,6 @@ public class SysRole implements Serializable {
|
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
@ -62,4 +63,74 @@ public class SysTenant implements Serializable {
|
|||
@Dict(dicCode = "tenant_status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 所属行业
|
||||
*/
|
||||
@Dict(dicCode = "trade")
|
||||
private String trade;
|
||||
|
||||
/**
|
||||
* 公司规模
|
||||
*/
|
||||
@Dict(dicCode = "company_size")
|
||||
private String companySize;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
private String companyAddress;
|
||||
|
||||
/**
|
||||
* 公司logo
|
||||
*/
|
||||
private String companyLogo;
|
||||
|
||||
/**
|
||||
* 门牌号
|
||||
*/
|
||||
private String houseNumber;
|
||||
|
||||
/**
|
||||
* 工作地点
|
||||
*/
|
||||
private String workPlace;
|
||||
|
||||
/**
|
||||
* 二级域名(暂时无用,预留字段)
|
||||
*/
|
||||
private String secondaryDomain;
|
||||
|
||||
/**
|
||||
* 登录背景图片(暂时无用,预留字段)
|
||||
*/
|
||||
private String loginBkgdImg;
|
||||
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
@Dict(dicCode = "company_rank")
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
@Dict(dicCode = "company_department")
|
||||
private String department;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
/**更新人登录名称*/
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 允许申请管理员 1允许 0不允许
|
||||
*/
|
||||
private Integer applyStatus;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 租户产品包
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_tenant_pack")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sys_tenant_pack对象", description="租户产品包")
|
||||
public class SysTenantPack implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private String id;
|
||||
/**租户id*/
|
||||
@Excel(name = "租户id", width = 15)
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
/**产品包名*/
|
||||
@Excel(name = "产品包名", width = 15)
|
||||
@ApiModelProperty(value = "产品包名")
|
||||
private String packName;
|
||||
/**开启状态(0 未开启 1开启)*/
|
||||
@Excel(name = "开启状态(0 未开启 1开启)", width = 15)
|
||||
@ApiModelProperty(value = "开启状态(0 未开启 1开启)")
|
||||
private String status;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**菜单id 临时字段用于新增编辑菜单id传递*/
|
||||
@TableField(exist = false)
|
||||
private String permissionIds;
|
||||
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String packCode;
|
||||
|
||||
public SysTenantPack(){
|
||||
|
||||
}
|
||||
|
||||
public SysTenantPack(Integer tenantId, String packName, String packCode){
|
||||
this.tenantId = tenantId;
|
||||
this.packCode = packCode;
|
||||
this.packName = packName;
|
||||
this.status = "1";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 租户产品包用户关系表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-02-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_tenant_pack_user")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sys_tenant_pack_user对象", description="租户产品包用户关系表")
|
||||
public class SysTenantPackUser implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**租户产品包ID*/
|
||||
@Excel(name = "租户产品包ID", width = 15)
|
||||
@ApiModelProperty(value = "租户产品包ID")
|
||||
private java.lang.String packId;
|
||||
/**用户ID*/
|
||||
@Excel(name = "用户ID", width = 15)
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private java.lang.String userId;
|
||||
/**租户ID*/
|
||||
@Excel(name = "租户ID", width = 15)
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
private transient String realname;
|
||||
|
||||
private transient String packName;
|
||||
|
||||
private transient String packCode;
|
||||
|
||||
/**
|
||||
* 状态 正常状态1 申请状态0
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
public SysTenantPackUser(){
|
||||
|
||||
}
|
||||
public SysTenantPackUser(Integer tenantId, String packId, String userId) {
|
||||
this.packId = packId;
|
||||
this.userId = userId;
|
||||
this.tenantId = tenantId;
|
||||
this.status = 1;
|
||||
}
|
||||
|
||||
public SysTenantPackUser(SysTenantPackUser param, String userId, String realname) {
|
||||
this.userId = userId;
|
||||
this.realname = realname;
|
||||
this.packId = param.getPackId();
|
||||
this.tenantId = param.getTenantId();
|
||||
this.packName = param.getPackName();
|
||||
this.status = 1;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ import java.util.Date;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
@ -99,9 +98,13 @@ public class SysUser implements Serializable {
|
|||
private String phone;
|
||||
|
||||
/**
|
||||
* 部门code(当前选择登录部门)
|
||||
* 登录选择部门编码
|
||||
*/
|
||||
private String orgCode;
|
||||
/**
|
||||
* 登录选择租户ID
|
||||
*/
|
||||
private Integer loginTenantId;
|
||||
|
||||
/**部门名称*/
|
||||
private transient String orgCodeTxt;
|
||||
|
@ -177,8 +180,9 @@ public class SysUser implements Serializable {
|
|||
private String departIds;
|
||||
|
||||
/**
|
||||
* 多租户id配置,编辑用户的时候设置
|
||||
* 多租户ids临时用,不持久化数据库(数据库字段不存在)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String relTenantIds;
|
||||
|
||||
/**设备id uniapp推送用*/
|
||||
|
@ -189,4 +193,15 @@ public class SysUser implements Serializable {
|
|||
*/
|
||||
@TableField(exist = false)
|
||||
private String homePath;
|
||||
|
||||
/**
|
||||
* 职位名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String postText;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
private String bpmStatus;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,10 @@ public class SysUserRole implements Serializable {
|
|||
* 角色id
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
|
||||
public SysUserRole() {
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: sys_user_tenant_relation
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_user_tenant")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sys_user_tenant对象", description="sys_user_tenant")
|
||||
public class SysUserTenant implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private String id;
|
||||
/**用户id*/
|
||||
@Excel(name = "用户id", width = 15)
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
/**租户id*/
|
||||
@Excel(name = "租户id", width = 15)
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
/**状态(1 正常 2 冻结 3 待审核 4 拒绝)*/
|
||||
@Excel(name = "状态(1 正常 2 冻结 3 待审核 4 拒绝)", width = 15)
|
||||
@ApiModelProperty(value = "状态(1 正常 2 冻结 3 待审核 4 拒绝)")
|
||||
private String status;
|
||||
/**创建人登录名称*/
|
||||
@ApiModelProperty(value = "创建人登录名称")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人登录名称*/
|
||||
@ApiModelProperty(value = "更新人登录名称")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
||||
import org.jeecg.modules.system.model.TreeModel;
|
||||
|
@ -90,4 +93,29 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
|
|||
*/
|
||||
@Select("SELECT * FROM sys_depart where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
|
||||
List<SysDepart> queryDeptByPid(@Param("parentId")String parentId);
|
||||
|
||||
/**
|
||||
* 通过父级id和租户id查询部门
|
||||
* @param parentId
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<SysDepart> queryBookDepTreeSync(@Param("parentId") String parentId, @Param("tenantId") Integer tenantId, @Param("departName") String departName);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
@Select("SELECT * FROM sys_depart where id = #{id,jdbcType=VARCHAR}")
|
||||
SysDepart getDepartById(@Param("id") String id);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<SysDepart> getMaxCodeDepart(@Param("page") Page<SysDepart> page, @Param("parentId") String parentId);
|
||||
|
||||
/**
|
||||
* 修改部门状态字段: 是否子节点
|
||||
* @param id 部门id
|
||||
* @param leaf 叶子节点
|
||||
* @return int
|
||||
*/
|
||||
@Update("UPDATE sys_depart SET iz_leaf=#{leaf} WHERE id = #{id}")
|
||||
int setMainLeaf(@Param("id") String id, @Param("leaf") Integer leaf);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -261,6 +262,14 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||
* @param codeValues 存储字段值 作为查询条件in
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
List<DictModel> queryTableDictByKeysAndFilterSql(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql, @Param("codeValues") List<String> codeValues);
|
||||
|
||||
/**
|
||||
* 根据应用id获取字典列表和详情
|
||||
* @param lowAppId
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysPackPermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 产品包菜单关系表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysPackPermissionMapper extends BaseMapper<SysPackPermission> {
|
||||
|
||||
/**
|
||||
* 通过产品包id获取菜单id
|
||||
* @param packId
|
||||
* @return
|
||||
*/
|
||||
List<String> getPermissionsByPackId(@Param("packId") String packId);
|
||||
}
|
|
@ -1,7 +1,16 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
import org.jeecg.modules.system.vo.tenant.TenantPackUser;
|
||||
import org.jeecg.modules.system.vo.tenant.TenantPackUserCount;
|
||||
import org.jeecg.modules.system.vo.tenant.UserDepart;
|
||||
import org.jeecg.modules.system.vo.tenant.UserPosition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 租户mapper接口
|
||||
|
@ -9,4 +18,77 @@ import org.jeecg.modules.system.entity.SysTenant;
|
|||
*/
|
||||
public interface SysTenantMapper extends BaseMapper<SysTenant> {
|
||||
|
||||
/**
|
||||
* 获取最大值id
|
||||
*/
|
||||
@Select("select MAX(id) id FROM sys_tenant")
|
||||
int getMaxTenantId();
|
||||
|
||||
/**
|
||||
* 获取租户回收站的数据假删除
|
||||
* @param page
|
||||
* @param sysTenant
|
||||
* @return
|
||||
*/
|
||||
List<SysTenant> getRecycleBinPageList(@Param("page") Page<SysTenant> page, @Param("sysTenant") SysTenant sysTenant);
|
||||
|
||||
/**
|
||||
* 彻底删除租户
|
||||
* @param tenantId
|
||||
*/
|
||||
Integer deleteByTenantId(@Param("tenantIds") List<Integer> tenantId);
|
||||
|
||||
/**
|
||||
* 租户还原
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
Integer revertTenantLogic(@Param("tenantIds")List<Integer> list);
|
||||
|
||||
/**
|
||||
* 用于统计 租户产品包的人员数量
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
List<TenantPackUserCount> queryTenantPackUserCount(@Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 查询人员是不是租户产品包的 超级管理员
|
||||
* @param tenantId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Integer querySuperAdminCount(@Param("tenantId") Integer tenantId, @Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 查询人员的产品包编码
|
||||
* @param tenantId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> queryUserPackCode(@Param("tenantId") Integer tenantId, @Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 查询产品包关联的用户列表
|
||||
* @param tenantId
|
||||
* @param packId
|
||||
* @param packUserStatus
|
||||
* @return
|
||||
*/
|
||||
List<TenantPackUser> queryPackUserList(@Param("tenantId") Integer tenantId, @Param("packId") String packId, @Param("packUserStatus") Integer packUserStatus);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID 查询部门
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
List<UserDepart> queryUserDepartList(@Param("userIdList") List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 根据用户ID 查询职位
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
List<UserPosition> queryUserPositionList(@Param("userIdList") List<String> userIdList);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysTenantPack;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 租户产品包
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysTenantPackMapper extends BaseMapper<SysTenantPack> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
||||
|
||||
/**
|
||||
* @Description: 租户产品包用户关系
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-02-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysTenantPackUserMapper extends BaseMapper<SysTenantPackUser> {
|
||||
|
||||
}
|
|
@ -47,4 +47,37 @@ public interface SysUserDepartMapper extends BaseMapper<SysUserDepart>{
|
|||
* @return
|
||||
*/
|
||||
IPage<SysUser> getUserInformation(Page<SysUser> page, @Param("orgCode") String orgCode, @Param("keyword") String keyword,@Param("userId") String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param page
|
||||
* @param orgCode
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> getProcessUserList(Page<SysUser> page, @Param("orgCode") String orgCode, @Param("keyword") String keyword, @Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 获取租户下的部门通过前台传过来的部门id
|
||||
* @param departIds
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
List<String> getTenantDepart(@Param("departIds") List<String> departIds, @Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 根据当前租户和用户id查询用户部门数据
|
||||
* @param userId
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
List<SysUserDepart> getTenantUserDepart(@Param("userId") String userId, @Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 根据用户id和租户id,删除用户部门数据
|
||||
* @param userId
|
||||
* @param tenantId
|
||||
*/
|
||||
void deleteUserDepart(@Param("userId") String userId, @Param("tenantId") String tenantId);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.model.SysUserSysDepartModel;
|
||||
import org.jeecg.modules.system.vo.SysUserDepVo;
|
||||
|
||||
|
@ -67,7 +67,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
* @param username
|
||||
* @param orgCode
|
||||
*/
|
||||
void updateUserDepart(@Param("username") String username,@Param("orgCode") String orgCode);
|
||||
void updateUserDepart(@Param("username") String username,@Param("orgCode") String orgCode, @Param("loginTenantId") Integer loginTenantId);
|
||||
|
||||
/**
|
||||
* 根据手机号查询用户信息
|
||||
|
@ -157,4 +157,28 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
* @return
|
||||
*/
|
||||
List<SysUser> queryByDepIds(@Param("departIds")List<String> departIds,@Param("username") String username);
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param page
|
||||
* @param roleId
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> selectUserListByRoleId(Page<SysUser> page, @Param("roleId") String roleId, @Param("keyword") String keyword, @Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 更新刪除状态和离职状态
|
||||
* @param userIds 存放用户id集合
|
||||
* @param sysUser
|
||||
* @return boolean
|
||||
*/
|
||||
void updateStatusAndFlag(@Param("userIds") List<String> userIds, @Param("sysUser") SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 获取租户下的离职列表信息
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
List<SysUser> getTenantQuitList(@Param("tenantId") Integer tenantId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.entity.SysUserTenant;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.vo.SysUserTenantVo;
|
||||
|
||||
/**
|
||||
* @Description: sys_user_tenant_relation
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysUserTenantMapper extends BaseMapper<SysUserTenant> {
|
||||
|
||||
/**
|
||||
* 通过租户id获取数据
|
||||
* @param page
|
||||
* @param userTenantId
|
||||
* @return
|
||||
*/
|
||||
List<SysUser> getPageUserList(@Param("page") Page<SysUser> page,@Param("userTenantId") Integer userTenantId,@Param("user") SysUser user);
|
||||
|
||||
/**
|
||||
* 根据租户id获取用户ids
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
List<String> getUserIdsByTenantId(@Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 通过用户id获取租户ids
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Integer> getTenantIdsByUserId(@Param("userId") String userId);
|
||||
|
||||
|
||||
|
||||
//==============================================================================================================================
|
||||
/**
|
||||
* 通过用户id获取租户列表
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SysUserTenantVo> getTenantListByUserId(@Param("userId") String userId, @Param("userTenantStatus") List<String> userTenantStatus);
|
||||
|
||||
/**
|
||||
* 通过状态、当前登录人的用户名,租户id,查询用户id
|
||||
* @param tenantId
|
||||
* @param statusList
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
List<String> getUserIdsByCreateBy(@Param("tenantId") Integer tenantId, @Param("userTenantStatus") List<String> statusList, @Param("username") String username);
|
||||
|
||||
/**
|
||||
* 联查用户和租户审核状态
|
||||
* @param page
|
||||
* @param status
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
List<SysUserTenantVo> getUserTenantPageList(@Param("page") Page<SysUserTenantVo> page, @Param("status") List<String> status, @Param("user") SysUser user, @Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 根据用户id获取租户id,没有状态值(如获取租户已经存在,只不过是被拒绝或者审批中)
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Integer> getTenantIdsNoStatus(@Param("userId") String userId);
|
||||
//==============================================================================================================================
|
||||
|
||||
/**
|
||||
* 统计一个人创建了多少个租户
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Integer countCreateTenantNum(String userId);
|
||||
|
||||
/**
|
||||
* 取消离职
|
||||
* @param userIds
|
||||
* @param tenantId
|
||||
*/
|
||||
void putCancelQuit(@Param("userIds") List<String> userIds, @Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 判断当前用户是否已在该租户下面
|
||||
* @param userId
|
||||
* @param tenantId
|
||||
*/
|
||||
Integer userTenantIzExist(@Param("userId") String userId, @Param("tenantId") int tenantId);
|
||||
}
|
|
@ -72,7 +72,7 @@
|
|||
<select id="queryUserAvatarList" resultType="org.jeecg.modules.system.vo.UserAvatar">
|
||||
select id, avatar, realname from sys_user
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="idSet" open="(" separator="or" close=")">
|
||||
<foreach item="id" collection="idSet" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
|
|
@ -51,4 +51,44 @@
|
|||
<select id="queryCompByOrgCode" resultType="org.jeecg.modules.system.entity.SysDepart">
|
||||
select * from sys_depart where del_flag = '0' and org_category='1' and org_code= #{orgCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<!--通过父级id和租户id查询部门-->
|
||||
<select id="queryBookDepTreeSync" resultType="org.jeecg.modules.system.entity.SysDepart">
|
||||
SELECT * FROM sys_depart
|
||||
WHERE
|
||||
del_flag = '0'
|
||||
<if test="tenantId != null">
|
||||
AND tenant_id = #{tenantId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
AND parent_id = #{parentId}
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="departName == null or departName == ''">
|
||||
AND (parent_id is null or parent_id='')
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="departName != null and departName != ''">
|
||||
<bind name="bindName" value="'%'+departName+'%'"/>
|
||||
AND depart_name LIKE #{bindName}
|
||||
</if>
|
||||
ORDER BY depart_order DESC
|
||||
</select>
|
||||
|
||||
<!--获取部门orgCode最大值的部门信息-->
|
||||
<select id="getMaxCodeDepart" resultType="org.jeecg.modules.system.entity.SysDepart">
|
||||
SELECT * FROM sys_depart
|
||||
WHERE
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
parent_id = #{parentId}
|
||||
</when>
|
||||
<otherwise>
|
||||
parent_id IS NULL OR parent_id=''
|
||||
</otherwise>
|
||||
</choose>
|
||||
ORDER BY org_code DESC
|
||||
</select>
|
||||
</mapper>
|
|
@ -6,7 +6,7 @@
|
|||
<select id="queryDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
|
||||
select s.item_value as "value",s.item_text as "text" from sys_dict_item s
|
||||
where dict_id = (select id from sys_dict where dict_code = #{code})
|
||||
order by s.sort_order asc
|
||||
order by s.sort_order asc, s.create_time DESC;
|
||||
</select>
|
||||
|
||||
<!-- 通过字典code获取有效的字典数据项 -->
|
||||
|
@ -14,7 +14,7 @@
|
|||
select s.item_value as "value",s.item_text as "text" from sys_dict_item s
|
||||
where dict_id = (select id from sys_dict where dict_code = #{code})
|
||||
and s.status = 1
|
||||
order by s.sort_order asc
|
||||
order by s.sort_order asc, s.create_time DESC;
|
||||
</select>
|
||||
|
||||
<!-- 通过多个字典code获取字典数据 -->
|
||||
|
@ -155,7 +155,14 @@
|
|||
<if test="query!= null">
|
||||
1 = 1
|
||||
<foreach collection="query.entrySet()" item="value" index="key" >
|
||||
and ${key} LIKE #{value}
|
||||
<choose>
|
||||
<when test="key == 'tenant_id'">
|
||||
and tenant_id = #{value}
|
||||
</when>
|
||||
<otherwise>
|
||||
and ${key} LIKE #{value}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<!-- udapte-end-author:sunjianlei date:20220615 for: 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
|
||||
<choose>
|
||||
|
@ -214,6 +221,14 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!--根据应用id获取字典列表和详情-->
|
||||
<select id="getDictListByLowAppId" resultType="org.jeecg.modules.system.entity.SysDict">
|
||||
select id,dict_name,dict_code from sys_dict
|
||||
where
|
||||
del_flag = 0
|
||||
and low_app_id = #{lowAppId}
|
||||
and tenant_id = #{tenantId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue