数据权限基础
This commit is contained in:
commit
e1f8b12ba8
50
README.md
50
README.md
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
性别男,若依是女儿的名字。
|
||||
|
||||
若依基于hplus和inspinia两套后台系统摸版开发。有需要可自行到群内下载。
|
||||
若依基于hplus和inspinia两套后台系统模板开发。有需要可自行到群内下载。
|
||||
|
||||
http://www.zi-han.net/theme/hplus
|
||||
|
||||
|
|
@ -37,52 +37,28 @@ http://webapplayers.com/inspinia_admin-v2.7.1
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E7%99%BB%E5%BD%95%E7%95%8C%E9%9D%A2.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E9%A6%96%E9%A1%B5.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/25b5e333768d013d45a990c152dbe4d9d6e.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/114553_jBTY_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E7%94%A8%E6%88%B7%E7%AE%A1%E7%90%86.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E7%94%A8%E6%88%B7%E4%BF%AE%E6%94%B9.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/114830_eIHp_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/114854_Y5a2_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E8%A7%92%E8%89%B2%E7%AE%A1%E7%90%86.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E8%A7%92%E8%89%B2%E4%BF%AE%E6%94%B9.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/114920_P8qv_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/114946_O3jx_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E8%8F%9C%E5%8D%95%E7%AE%A1%E7%90%86.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E4%BF%AE%E6%94%B9%E8%8F%9C%E5%8D%95.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/115022_1Tnm_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/115051_XvMW_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E9%83%A8%E9%97%A8%E7%AE%A1%E7%90%86.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E4%BF%AE%E6%94%B9%E9%83%A8%E9%97%A8.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/115117_9TZ3_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/115130_a5xO_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%B2%97%E4%BD%8D%E7%AE%A1%E7%90%86.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%B2%97%E4%BD%8D%E4%BF%AE%E6%94%B9.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%AD%97%E5%85%B8%E7%B1%BB%E5%9E%8B.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%AD%97%E5%85%B8%E6%95%B0%E6%8D%AE.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%8F%82%E6%95%B0%E8%AE%BE%E7%BD%AE.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E9%80%9A%E7%9F%A5%E7%AE%A1%E7%90%86.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E6%93%8D%E4%BD%9C%E6%97%A5%E5%BF%97.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E7%99%BB%E5%BD%95%E6%97%A5%E5%BF%97.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E6%97%A5%E5%BF%97.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E5%9C%A8%E7%BA%BF%E7%94%A8%E6%88%B7.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E6%95%B0%E6%8D%AE%E7%9B%91%E6%8E%A7.png"/></td>
|
||||
<td><img src="https://ruoyi-1256174062.cos.ap-guangzhou.myqcloud.com/%E8%8B%A5%E4%BE%9D2.0/%E7%B3%BB%E7%BB%9F%E6%8E%A5%E5%8F%A3.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/115151_EuYC_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0728/115212_QybT_1438828.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>RuoYi</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<version>2.2.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>RuoYi</name>
|
||||
|
|
|
|||
|
|
@ -173,71 +173,62 @@ insert into sys_menu values('1000', '用户查询', '100', '1', '#', 'F', '0',
|
|||
insert into sys_menu values('1001', '用户新增', '100', '2', '#', 'F', '0', 'system:user:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1002', '用户修改', '100', '3', '#', 'F', '0', 'system:user:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1003', '用户删除', '100', '4', '#', 'F', '0', 'system:user:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1004', '用户保存', '100', '5', '#', 'F', '0', 'system:user:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1005', '重置密码', '100', '6', '#', 'F', '0', 'system:user:resetPwd', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1004', '重置密码', '100', '5', '#', 'F', '0', 'system:user:resetPwd', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 角色管理按钮
|
||||
insert into sys_menu values('1006', '角色查询', '101', '1', '#', 'F', '0', 'system:role:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1007', '角色新增', '101', '2', '#', 'F', '0', 'system:role:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1008', '角色修改', '101', '3', '#', 'F', '0', 'system:role:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1009', '角色删除', '101', '4', '#', 'F', '0', 'system:role:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1010', '角色保存', '101', '5', '#', 'F', '0', 'system:role:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1005', '角色查询', '101', '1', '#', 'F', '0', 'system:role:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1006', '角色新增', '101', '2', '#', 'F', '0', 'system:role:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1007', '角色修改', '101', '3', '#', 'F', '0', 'system:role:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1008', '角色删除', '101', '4', '#', 'F', '0', 'system:role:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 菜单管理按钮
|
||||
insert into sys_menu values('1011', '菜单查询', '102', '1', '#', 'F', '0', 'system:menu:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1012', '菜单新增', '102', '2', '#', 'F', '0', 'system:menu:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1013', '菜单修改', '102', '3', '#', 'F', '0', 'system:menu:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1014', '菜单删除', '102', '4', '#', 'F', '0', 'system:menu:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1015', '菜单保存', '102', '5', '#', 'F', '0', 'system:menu:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1009', '菜单查询', '102', '1', '#', 'F', '0', 'system:menu:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1010', '菜单新增', '102', '2', '#', 'F', '0', 'system:menu:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1011', '菜单修改', '102', '3', '#', 'F', '0', 'system:menu:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1012', '菜单删除', '102', '4', '#', 'F', '0', 'system:menu:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 部门管理按钮
|
||||
insert into sys_menu values('1016', '部门查询', '103', '1', '#', 'F', '0', 'system:dept:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1017', '部门新增', '103', '2', '#', 'F', '0', 'system:dept:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1018', '部门修改', '103', '3', '#', 'F', '0', 'system:dept:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1019', '部门删除', '103', '4', '#', 'F', '0', 'system:dept:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1020', '部门保存', '103', '5', '#', 'F', '0', 'system:dept:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1013', '部门查询', '103', '1', '#', 'F', '0', 'system:dept:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1014', '部门新增', '103', '2', '#', 'F', '0', 'system:dept:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1015', '部门修改', '103', '3', '#', 'F', '0', 'system:dept:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1016', '部门删除', '103', '4', '#', 'F', '0', 'system:dept:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 岗位管理按钮
|
||||
insert into sys_menu values('1021', '岗位查询', '104', '1', '#', 'F', '0', 'system:post:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1022', '岗位新增', '104', '2', '#', 'F', '0', 'system:post:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1023', '岗位修改', '104', '3', '#', 'F', '0', 'system:post:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1024', '岗位删除', '104', '4', '#', 'F', '0', 'system:post:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1025', '岗位保存', '104', '5', '#', 'F', '0', 'system:post:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1017', '岗位查询', '104', '1', '#', 'F', '0', 'system:post:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1018', '岗位新增', '104', '2', '#', 'F', '0', 'system:post:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1019', '岗位修改', '104', '3', '#', 'F', '0', 'system:post:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1020', '岗位删除', '104', '4', '#', 'F', '0', 'system:post:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 字典管理按钮
|
||||
insert into sys_menu values('1026', '字典查询', '105', '1', '#', 'F', '0', 'system:dict:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1027', '字典新增', '105', '2', '#', 'F', '0', 'system:dict:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1028', '字典修改', '105', '3', '#', 'F', '0', 'system:dict:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1029', '字典删除', '105', '4', '#', 'F', '0', 'system:dict:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1030', '字典保存', '105', '5', '#', 'F', '0', 'system:dict:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1021', '字典查询', '105', '1', '#', 'F', '0', 'system:dict:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1022', '字典新增', '105', '2', '#', 'F', '0', 'system:dict:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1023', '字典修改', '105', '3', '#', 'F', '0', 'system:dict:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1024', '字典删除', '105', '4', '#', 'F', '0', 'system:dict:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 参数设置按钮
|
||||
insert into sys_menu values('1031', '参数查询', '106', '1', '#', 'F', '0', 'system:config:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1032', '参数新增', '106', '2', '#', 'F', '0', 'system:config:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1033', '参数修改', '106', '3', '#', 'F', '0', 'system:config:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1034', '参数删除', '106', '4', '#', 'F', '0', 'system:config:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1035', '参数保存', '106', '5', '#', 'F', '0', 'system:config:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1025', '参数查询', '106', '1', '#', 'F', '0', 'system:config:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1026', '参数新增', '106', '2', '#', 'F', '0', 'system:config:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1027', '参数修改', '106', '3', '#', 'F', '0', 'system:config:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1028', '参数删除', '106', '4', '#', 'F', '0', 'system:config:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 通知公告按钮
|
||||
insert into sys_menu values('1036', '公告查询', '107', '1', '#', 'F', '0', 'system:notice:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1037', '公告新增', '107', '2', '#', 'F', '0', 'system:notice:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1038', '公告修改', '107', '3', '#', 'F', '0', 'system:notice:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1039', '公告删除', '107', '4', '#', 'F', '0', 'system:notice:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1040', '公告保存', '107', '5', '#', 'F', '0', 'system:notice:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1029', '公告查询', '107', '1', '#', 'F', '0', 'system:notice:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1030', '公告新增', '107', '2', '#', 'F', '0', 'system:notice:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1031', '公告修改', '107', '3', '#', 'F', '0', 'system:notice:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1032', '公告删除', '107', '4', '#', 'F', '0', 'system:notice:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 操作日志按钮
|
||||
insert into sys_menu values('1041', '操作查询', '500', '1', '#', 'F', '0', 'monitor:operlog:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1042', '操作删除', '500', '2', '#', 'F', '0', 'monitor:operlog:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1043', '详细信息', '500', '3', '#', 'F', '0', 'monitor:operlog:detail', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1033', '操作查询', '500', '1', '#', 'F', '0', 'monitor:operlog:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1034', '操作删除', '500', '2', '#', 'F', '0', 'monitor:operlog:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1035', '详细信息', '500', '3', '#', 'F', '0', 'monitor:operlog:detail', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 登录日志按钮
|
||||
insert into sys_menu values('1044', '登录查询', '501', '1', '#', 'F', '0', 'monitor:logininfor:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1045', '登录删除', '501', '2', '#', 'F', '0', 'monitor:logininfor:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1036', '登录查询', '501', '1', '#', 'F', '0', 'monitor:logininfor:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1037', '登录删除', '501', '2', '#', 'F', '0', 'monitor:logininfor:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 在线用户按钮
|
||||
insert into sys_menu values('1046', '在线查询', '109', '1', '#', 'F', '0', 'monitor:online:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1047', '批量强退', '109', '2', '#', 'F', '0', 'monitor:online:batchForceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1048', '单条强退', '109', '3', '#', 'F', '0', 'monitor:online:forceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1038', '在线查询', '109', '1', '#', 'F', '0', 'monitor:online:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1039', '批量强退', '109', '2', '#', 'F', '0', 'monitor:online:batchForceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1040', '单条强退', '109', '3', '#', 'F', '0', 'monitor:online:forceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 定时任务按钮
|
||||
insert into sys_menu values('1049', '任务查询', '110', '1', '#', 'F', '0', 'monitor:job:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1050', '任务新增', '110', '2', '#', 'F', '0', 'monitor:job:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1051', '任务修改', '110', '3', '#', 'F', '0', 'monitor:job:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1052', '任务删除', '110', '4', '#', 'F', '0', 'monitor:job:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1053', '任务保存', '110', '5', '#', 'F', '0', 'monitor:job:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1054', '状态修改', '110', '6', '#', 'F', '0', 'monitor:job:changeStatus', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1041', '任务查询', '110', '1', '#', 'F', '0', 'monitor:job:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1042', '任务新增', '110', '2', '#', 'F', '0', 'monitor:job:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1043', '任务修改', '110', '3', '#', 'F', '0', 'monitor:job:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1044', '任务删除', '110', '4', '#', 'F', '0', 'monitor:job:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1045', '状态修改', '110', '5', '#', 'F', '0', 'monitor:job:changeStatus', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
-- 代码生成按钮
|
||||
insert into sys_menu values('1055', '生成查询', '113', '1', '#', 'F', '0', 'tool:gen:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1056', '生成代码', '113', '2', '#', 'F', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1046', '生成查询', '113', '1', '#', 'F', '0', 'tool:gen:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1047', '生成代码', '113', '2', '#', 'F', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
@ -338,15 +329,6 @@ insert into sys_role_menu values ('1', '1044');
|
|||
insert into sys_role_menu values ('1', '1045');
|
||||
insert into sys_role_menu values ('1', '1046');
|
||||
insert into sys_role_menu values ('1', '1047');
|
||||
insert into sys_role_menu values ('1', '1048');
|
||||
insert into sys_role_menu values ('1', '1049');
|
||||
insert into sys_role_menu values ('1', '1050');
|
||||
insert into sys_role_menu values ('1', '1051');
|
||||
insert into sys_role_menu values ('1', '1052');
|
||||
insert into sys_role_menu values ('1', '1053');
|
||||
insert into sys_role_menu values ('1', '1054');
|
||||
insert into sys_role_menu values ('1', '1055');
|
||||
insert into sys_role_menu values ('1', '1056');
|
||||
|
||||
-- ----------------------------
|
||||
-- 8、用户与岗位关联表 用户1-N岗位
|
||||
|
|
@ -430,6 +412,7 @@ create table sys_dict_data
|
|||
dict_value varchar(100) default '' comment '字典键值',
|
||||
dict_type varchar(100) default '' comment '字典类型',
|
||||
css_class varchar(500) default '' comment '样式属性',
|
||||
list_class varchar(500) default '' comment '回显样式',
|
||||
is_default char(1) default 'N' comment '是否默认(Y是 N否)',
|
||||
status char(1) default '0' comment '状态(0正常 1停用)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
|
|
@ -441,33 +424,31 @@ create table sys_dict_data
|
|||
) engine=innodb auto_increment=100 default charset=utf8 comment = '字典数据表';
|
||||
|
||||
|
||||
insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男');
|
||||
insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女');
|
||||
insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知');
|
||||
insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单');
|
||||
insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单');
|
||||
insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||
insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||
insert into sys_dict_data values(10, 1, '是', 'Y', 'sys_yes_no', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是');
|
||||
insert into sys_dict_data values(11, 2, '否', 'N', 'sys_yes_no', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否');
|
||||
insert into sys_dict_data values(12, 1, '通知', '1', 'sys_notice_type', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知');
|
||||
insert into sys_dict_data values(13, 2, '公告', '2', 'sys_notice_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告');
|
||||
insert into sys_dict_data values(14, 1, '正常', '0', 'sys_notice_status', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(15, 2, '关闭', '1', 'sys_notice_status', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态');
|
||||
insert into sys_dict_data values(16, 1, '新增', '1', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(17, 2, '修改', '2', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(18, 3, '保存', '3', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(19, 4, '删除', '4', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(20, 5, '授权', '5', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(21, 6, '导出', '6', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(22, 7, '导入', '7', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(23, 8, '强退', '8', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(24, 9, '禁止访问', '9', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(25, 10, '生成代码', '10', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(26, 1, '成功', '0', 'sys_common_status', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(27, 2, '失败', '1', 'sys_common_status', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||
insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男');
|
||||
insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女');
|
||||
insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知');
|
||||
insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单');
|
||||
insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单');
|
||||
insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||
insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||
insert into sys_dict_data values(10, 1, '是', 'Y', 'sys_yes_no', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是');
|
||||
insert into sys_dict_data values(11, 2, '否', 'N', 'sys_yes_no', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否');
|
||||
insert into sys_dict_data values(12, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知');
|
||||
insert into sys_dict_data values(13, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告');
|
||||
insert into sys_dict_data values(14, 1, '正常', '0', 'sys_notice_status', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(15, 2, '关闭', '1', 'sys_notice_status', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态');
|
||||
insert into sys_dict_data values(16, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(17, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(18, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(19, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(20, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(21, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(22, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(23, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||
insert into sys_dict_data values(24, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||
insert into sys_dict_data values(25, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||
|
||||
-- ----------------------------
|
||||
-- 12、参数配置表
|
||||
|
|
@ -538,8 +519,9 @@ create table sys_job (
|
|||
job_name varchar(64) default '' comment '任务名称',
|
||||
job_group varchar(64) default '' comment '任务组名',
|
||||
method_name varchar(500) default '' comment '任务方法',
|
||||
params varchar(200) default '' comment '方法参数',
|
||||
method_params varchar(200) default '' comment '方法参数',
|
||||
cron_expression varchar(255) default '' comment 'cron执行表达式',
|
||||
misfire_policy varchar(20) default '0' comment '计划执行错误策略(0默认 1继续 2等待 3放弃)',
|
||||
status char(1) default '0' comment '状态(0正常 1暂停)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
|
|
@ -549,8 +531,8 @@ create table sys_job (
|
|||
primary key (job_id, job_name, job_group)
|
||||
) engine=innodb auto_increment=100 default charset=utf8 comment = '定时任务调度表';
|
||||
|
||||
insert into sys_job values(1, 'ryTask', '系统默认(无参)', 'ryNoParams', '', '0/10 * * * * ?', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_job values(2, 'ryTask', '系统默认(有参)', 'ryParams', 'ry', '0/20 * * * * ?', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_job values(1, 'ryTask', '系统默认(无参)', 'ryNoParams', '', '0/10 * * * * ?', '0', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_job values(2, 'ryTask', '系统默认(有参)', 'ryParams', 'ry', '0/20 * * * * ?', '0', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
@ -562,7 +544,7 @@ create table sys_job_log (
|
|||
job_name varchar(64) not null comment '任务名称',
|
||||
job_group varchar(64) not null comment '任务组名',
|
||||
method_name varchar(500) comment '任务方法',
|
||||
params varchar(200) default '' comment '方法参数',
|
||||
method_params varchar(200) default '' comment '方法参数',
|
||||
job_message varchar(500) comment '日志信息',
|
||||
status char(1) default '0' comment '执行状态(0正常 1失败)',
|
||||
exception_info text comment '异常信息',
|
||||
|
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用Map数据
|
||||
* 通用数据库映射Map数据
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
|
@ -39,6 +39,7 @@ public class CommonMap
|
|||
javaTypeMap.put("text", "String");
|
||||
javaTypeMap.put("mediumtext", "String");
|
||||
javaTypeMap.put("longtext", "String");
|
||||
javaTypeMap.put("time", "Date");
|
||||
javaTypeMap.put("date", "Date");
|
||||
javaTypeMap.put("datetime", "Date");
|
||||
javaTypeMap.put("timestamp", "Date");
|
||||
|
|
|
|||
|
|
@ -45,21 +45,21 @@ public class Constants
|
|||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
public static String PAGENUM = "pageNum";
|
||||
public static String PAGE_NUM = "pageNum";
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
public static String PAGESIZE = "pageSize";
|
||||
public static String PAGE_SIZE = "pageSize";
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
public static String ORDERBYCOLUMN = "orderByColumn";
|
||||
public static String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
/**
|
||||
* 排序的方向 "desc" 或者 "asc".
|
||||
*/
|
||||
public static String ISASC = "isAsc";
|
||||
public static String IS_ASC = "isAsc";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.common.constant;
|
||||
|
||||
/**
|
||||
* 权限通用常量
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class PermissionConstants
|
||||
{
|
||||
/** 新增权限 */
|
||||
public static final String ADD_PERMISSION = "add";
|
||||
|
||||
/** 修改权限 */
|
||||
public static final String EDIT_PERMISSION = "edit";
|
||||
|
||||
/** 删除权限 */
|
||||
public static final String REMOVE_PERMISSION = "remove";
|
||||
|
||||
/** 显示权限 */
|
||||
public static final String VIEW_PERMISSION = "view";
|
||||
|
||||
/** 查询权限 */
|
||||
public static final String LIST_PERMISSION = "list";
|
||||
}
|
||||
|
|
@ -7,10 +7,22 @@ package com.ruoyi.common.constant;
|
|||
*/
|
||||
public interface ScheduleConstants
|
||||
{
|
||||
/**
|
||||
* 任务调度参数key
|
||||
*/
|
||||
public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
|
||||
|
||||
public static final String TASK_CLASS_NAME = "__TASK_CLASS_NAME__";
|
||||
|
||||
public static final String TASK_PROPERTIES = "__TASK_PROPERTIES__";
|
||||
|
||||
/** 默认 */
|
||||
public static final String MISFIRE_DEFAULT = "0";
|
||||
|
||||
/** 立即触发执行 */
|
||||
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
||||
|
||||
/** 触发一次执行 */
|
||||
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
||||
|
||||
/** 不触发立即执行 */
|
||||
public static final String MISFIRE_DO_NOTHING = "3";
|
||||
|
||||
public enum Status
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ public class InvalidExtensionException extends FileUploadException
|
|||
|
||||
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
|
||||
{
|
||||
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : ["
|
||||
+ Arrays.toString(allowedExtension) + "]");
|
||||
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
|
||||
this.allowedExtension = allowedExtension;
|
||||
this.extension = extension;
|
||||
this.filename = filename;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.common.exception.job;
|
||||
|
||||
/**
|
||||
* 计划策略异常
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TaskException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Code code;
|
||||
|
||||
public TaskException(String msg, Code code)
|
||||
{
|
||||
this(msg, code, null);
|
||||
}
|
||||
|
||||
public TaskException(String msg, Code code, Exception nestedEx)
|
||||
{
|
||||
super(msg, nestedEx);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Code getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public enum Code
|
||||
{
|
||||
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class AddressUtils
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("根据IP获取所在位置----------错误消息:" + e.getMessage());
|
||||
log.error("获取地理位置异常:", e);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import com.ruoyi.common.support.StrFormatter;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class StringUtils
|
||||
public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
{
|
||||
/** 空字符串 */
|
||||
private static final String NULLSTR = "";
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.ruoyi.project.system.dept.domain.Dept;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
|
||||
/**
|
||||
* Bean 工具类
|
||||
*
|
||||
|
|
@ -122,20 +119,4 @@ public class BeanUtils
|
|||
{
|
||||
return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX));
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
User user = new User();
|
||||
|
||||
User zhen = new User();
|
||||
zhen.setUserName("测试名称");
|
||||
Dept dept = new Dept();
|
||||
dept.setDeptId(11L);
|
||||
dept.setDeptName("测试部门");
|
||||
zhen.setDept(dept);
|
||||
|
||||
BeanUtils.copyBeanProp(user, zhen);
|
||||
|
||||
System.out.println(user.getDept().getDeptName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.common.utils;
|
||||
package com.ruoyi.common.utils.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -16,16 +16,24 @@ import com.ruoyi.framework.config.RuoYiConfig;
|
|||
public class FileUploadUtils
|
||||
{
|
||||
|
||||
// 默认大小 50M
|
||||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 52428800;
|
||||
|
||||
// 默认上传的地址
|
||||
/**
|
||||
* 默认上传的地址
|
||||
*/
|
||||
private static String defaultBaseDir = RuoYiConfig.getProfile();
|
||||
|
||||
// 默认的文件名最大长度
|
||||
/**
|
||||
* 默认的文件名最大长度
|
||||
*/
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 200;
|
||||
|
||||
// 默认文件类型jpg
|
||||
/**
|
||||
* 默认文件类型jpg
|
||||
*/
|
||||
public static final String IMAGE_JPG_EXTENSION = ".jpg";
|
||||
|
||||
private static int counter = 0;
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.ruoyi.common.utils.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 文件处理工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class FileUtils
|
||||
{
|
||||
|
||||
/**
|
||||
* 输出指定文件的byte数组
|
||||
*
|
||||
* @param filename 文件
|
||||
* @return
|
||||
*/
|
||||
public static void writeBytes(String filePath, OutputStream os) throws IOException
|
||||
{
|
||||
FileInputStream fis = null;
|
||||
try
|
||||
{
|
||||
File file = new File(filePath);
|
||||
if (!file.exists())
|
||||
{
|
||||
throw new FileNotFoundException(filePath);
|
||||
}
|
||||
fis = new FileInputStream(file);
|
||||
byte[] b = new byte[1024];
|
||||
int length;
|
||||
while ((length = fis.read(b)) > 0)
|
||||
{
|
||||
os.write(b, 0, length);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (os != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
os.close();
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (fis != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param filePath 文件
|
||||
* @return
|
||||
*/
|
||||
public static boolean deleteFile(String filePath)
|
||||
{
|
||||
boolean flag = false;
|
||||
File file = new File(filePath);
|
||||
// 路径为文件且不为空则进行删除
|
||||
if (file.isFile() && file.exists())
|
||||
{
|
||||
file.delete();
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.ruoyi.common.utils.http;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -165,7 +164,6 @@ public class HttpUtils
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String sendSSLPost(String url, String param)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
|
@ -189,11 +187,10 @@ public class HttpUtils
|
|||
conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
|
||||
conn.connect();
|
||||
InputStream is = conn.getInputStream();
|
||||
DataInputStream indata = new DataInputStream(is);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
String ret = "";
|
||||
while (ret != null)
|
||||
while ((ret = br.readLine()) != null)
|
||||
{
|
||||
ret = indata.readLine();
|
||||
if (ret != null && !ret.trim().equals(""))
|
||||
{
|
||||
result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
|
||||
|
|
@ -201,7 +198,7 @@ public class HttpUtils
|
|||
}
|
||||
log.info("recv - {}", result);
|
||||
conn.disconnect();
|
||||
indata.close();
|
||||
br.close();
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
|
|
@ -224,14 +221,17 @@ public class HttpUtils
|
|||
|
||||
private static class TrustAnyTrustManager implements X509TrustManager
|
||||
{
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return new X509Certificate[] {};
|
||||
|
|
@ -240,6 +240,7 @@ public class HttpUtils
|
|||
|
||||
private static class TrustAnyHostnameVerifier implements HostnameVerifier
|
||||
{
|
||||
@Override
|
||||
public boolean verify(String hostname, SSLSession session)
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import org.apache.poi.ss.util.CellRangeAddressList;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
|
|
@ -58,29 +60,32 @@ public class ExcelUtil<T>
|
|||
|
||||
Workbook workbook = WorkbookFactory.create(input);
|
||||
Sheet sheet = workbook.getSheet(sheetName);
|
||||
if (!sheetName.trim().equals(""))
|
||||
if (StringUtils.isNotEmpty(sheetName))
|
||||
{
|
||||
sheet = workbook.getSheet(sheetName); // 如果指定sheet名,则取指定sheet中的内容.
|
||||
// 如果指定sheet名,则取指定sheet中的内容.
|
||||
sheet = workbook.getSheet(sheetName);
|
||||
}
|
||||
if (sheet == null)
|
||||
{
|
||||
sheet = workbook.getSheetAt(0); // 如果传入的sheet名不存在则默认指向第1个sheet.
|
||||
// 如果传入的sheet名不存在则默认指向第1个sheet.
|
||||
sheet = workbook.getSheetAt(0);
|
||||
}
|
||||
int rows = sheet.getPhysicalNumberOfRows();
|
||||
|
||||
if (rows > 0)
|
||||
{
|
||||
// 有数据时才处理
|
||||
Field[] allFields = clazz.getDeclaredFields(); // 得到类的所有field.
|
||||
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>(); // 定义一个map用于存放列的序号和field.
|
||||
for (Field field : allFields)
|
||||
// 有数据时才处理 得到类的所有field.
|
||||
Field[] allFields = clazz.getDeclaredFields();
|
||||
// 定义一个map用于存放列的序号和field.
|
||||
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
|
||||
for (int col = 0; col < allFields.length; col++)
|
||||
{
|
||||
Field field = allFields[col];
|
||||
// 将有注解的field存放到map中.
|
||||
if (field.isAnnotationPresent(Excel.class))
|
||||
{
|
||||
Excel attr = field.getAnnotation(Excel.class);
|
||||
int col = getExcelCol(attr.column());// 获得列号
|
||||
field.setAccessible(true);// 设置类的私有字段属性可访问.
|
||||
// 设置类的私有字段属性可访问.
|
||||
field.setAccessible(true);
|
||||
fieldsMap.put(col, field);
|
||||
}
|
||||
}
|
||||
|
|
@ -105,13 +110,15 @@ public class ExcelUtil<T>
|
|||
}
|
||||
|
||||
String c = cell.getStringCellValue();
|
||||
if (c.equals(""))
|
||||
if (StringUtils.isEmpty(c))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entity = (entity == null ? clazz.newInstance() : entity);// 如果不存在实例则新建.
|
||||
Field field = fieldsMap.get(j);// 从map中得到对应列的field.
|
||||
// 如果不存在实例则新建.
|
||||
entity = (entity == null ? clazz.newInstance() : entity);
|
||||
// 从map中得到对应列的field.
|
||||
Field field = fieldsMap.get(j);
|
||||
// 取得类型,并根据对象类型设置值.
|
||||
Class<?> fieldType = field.getType();
|
||||
if (String.class == fieldType)
|
||||
|
|
@ -180,7 +187,8 @@ public class ExcelUtil<T>
|
|||
*/
|
||||
public AjaxResult exportExcel(List<T> list, String sheetName)
|
||||
{
|
||||
Field[] allFields = clazz.getDeclaredFields();// 得到所有定义字段
|
||||
// 得到所有定义字段
|
||||
Field[] allFields = clazz.getDeclaredFields();
|
||||
List<Field> fields = new ArrayList<Field>();
|
||||
// 得到所有field并存放到一个list中.
|
||||
for (Field field : allFields)
|
||||
|
|
@ -191,33 +199,39 @@ public class ExcelUtil<T>
|
|||
}
|
||||
}
|
||||
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();// 产生工作薄对象
|
||||
// 产生工作薄对象
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
// excel2003中每个sheet中最多有65536行
|
||||
int sheetSize = 65536;
|
||||
double sheetNo = Math.ceil(list.size() / sheetSize);// 取出一共有多少个sheet.
|
||||
// 取出一共有多少个sheet.
|
||||
double sheetNo = Math.ceil(list.size() / sheetSize);
|
||||
for (int index = 0; index <= sheetNo; index++)
|
||||
{
|
||||
HSSFSheet sheet = workbook.createSheet();// 产生工作表对象
|
||||
// 产生工作表对象
|
||||
HSSFSheet sheet = workbook.createSheet();
|
||||
if (sheetNo == 0)
|
||||
{
|
||||
workbook.setSheetName(index, sheetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
workbook.setSheetName(index, sheetName + index);// 设置工作表的名称.
|
||||
// 设置工作表的名称.
|
||||
workbook.setSheetName(index, sheetName + index);
|
||||
}
|
||||
HSSFRow row;
|
||||
HSSFCell cell; // 产生单元格
|
||||
|
||||
row = sheet.createRow(0); // 产生一行
|
||||
// 产生一行
|
||||
row = sheet.createRow(0);
|
||||
// 写入各个字段的列头名称
|
||||
for (int i = 0; i < fields.size(); i++)
|
||||
{
|
||||
Field field = fields.get(i);
|
||||
Excel attr = field.getAnnotation(Excel.class);
|
||||
int col = getExcelCol(attr.column()); // 获得列号
|
||||
cell = row.createCell(col); // 创建列
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING); // 设置列中写入内容为String类型
|
||||
// 创建列
|
||||
cell = row.createCell(i);
|
||||
// 设置列中写入内容为String类型
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
||||
cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
|
|
@ -232,8 +246,10 @@ public class ExcelUtil<T>
|
|||
else
|
||||
{
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // 粗体显示
|
||||
cellStyle.setFont(font); // 选择需要用到的字体格式
|
||||
// 粗体显示
|
||||
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
// 选择需要用到的字体格式
|
||||
cellStyle.setFont(font);
|
||||
cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
|
||||
// 设置列宽
|
||||
sheet.setColumnWidth(i, 3766);
|
||||
|
|
@ -242,17 +258,20 @@ public class ExcelUtil<T>
|
|||
cellStyle.setWrapText(true);
|
||||
cell.setCellStyle(cellStyle);
|
||||
|
||||
cell.setCellValue(attr.name());// 写入列名
|
||||
// 写入列名
|
||||
cell.setCellValue(attr.name());
|
||||
|
||||
// 如果设置了提示信息则鼠标放上去提示.
|
||||
if (!attr.prompt().trim().equals(""))
|
||||
if (StringUtils.isNotEmpty(attr.prompt()))
|
||||
{
|
||||
setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, col, col); // 这里默认设了2-101列提示.
|
||||
// 这里默认设了2-101列提示.
|
||||
setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, i, i);
|
||||
}
|
||||
// 如果设置了combo属性则本列只能选择不能输入
|
||||
if (attr.combo().length > 0)
|
||||
{
|
||||
setHSSFValidation(sheet, attr.combo(), 1, 100, col, col); // 这里默认设了2-101列只能选择不能输入.
|
||||
// 这里默认设了2-101列只能选择不能输入.
|
||||
setHSSFValidation(sheet, attr.combo(), 1, 100, i, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -265,23 +284,29 @@ public class ExcelUtil<T>
|
|||
for (int i = startNo; i < endNo; i++)
|
||||
{
|
||||
row = sheet.createRow(i + 1 - startNo);
|
||||
T vo = (T) list.get(i); // 得到导出对象.
|
||||
// 得到导出对象.
|
||||
T vo = (T) list.get(i);
|
||||
for (int j = 0; j < fields.size(); j++)
|
||||
{
|
||||
Field field = fields.get(j); // 获得field.
|
||||
field.setAccessible(true); // 设置实体类私有属性可访问
|
||||
// 获得field.
|
||||
Field field = fields.get(j);
|
||||
// 设置实体类私有属性可访问
|
||||
field.setAccessible(true);
|
||||
Excel attr = field.getAnnotation(Excel.class);
|
||||
try
|
||||
{
|
||||
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
|
||||
if (attr.isExport())
|
||||
{
|
||||
cell = row.createCell(getExcelCol(attr.column()));// 创建cell
|
||||
// 创建cell
|
||||
cell = row.createCell(j);
|
||||
cell.setCellStyle(cs);
|
||||
try
|
||||
{
|
||||
if (String.valueOf(field.get(vo)).length() > 10)
|
||||
{
|
||||
throw new Exception("长度超过10位就不用转数字了");
|
||||
}
|
||||
// 如果可以转成数字则导出为数字类型
|
||||
BigDecimal bc = new BigDecimal(String.valueOf(field.get(vo)));
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
|
||||
|
|
@ -292,11 +317,13 @@ public class ExcelUtil<T>
|
|||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
if (vo == null)
|
||||
{
|
||||
cell.setCellValue(""); // 如果数据存在就填入,不存在填入空格.
|
||||
// 如果数据存在就填入,不存在填入空格.
|
||||
cell.setCellValue("");
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.setCellValue(field.get(vo) == null ? "" : String.valueOf(field.get(vo)));// 如果数据存在就填入,不存在填入空格.
|
||||
// 如果数据存在就填入,不存在填入空格.
|
||||
cell.setCellValue(field.get(vo) == null ? "" : String.valueOf(field.get(vo)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -304,7 +331,7 @@ public class ExcelUtil<T>
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("导出Excel失败{}", e);
|
||||
log.error("导出Excel失败{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -319,7 +346,7 @@ public class ExcelUtil<T>
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("关闭flush失败{}", e);
|
||||
log.error("关闭flush失败{}", e.getMessage());
|
||||
return AjaxResult.error("导出Excel失败,请联系网站管理员!");
|
||||
}
|
||||
}
|
||||
|
|
@ -329,18 +356,18 @@ public class ExcelUtil<T>
|
|||
*
|
||||
* @param col
|
||||
*/
|
||||
public static int getExcelCol(String col)
|
||||
{
|
||||
col = col.toUpperCase();
|
||||
// 从-1开始计算,字母重1开始运算。这种总数下来算数正好相同。
|
||||
int count = -1;
|
||||
char[] cs = col.toCharArray();
|
||||
for (int i = 0; i < cs.length; i++)
|
||||
{
|
||||
count += (cs[i] - 64) * Math.pow(26, cs.length - 1 - i);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
// public static int getExcelCol(String col)
|
||||
// {
|
||||
// col = col.toUpperCase();
|
||||
// // 从-1开始计算,字母重1开始运算。这种总数下来算数正好相同。
|
||||
// int count = -1;
|
||||
// char[] cs = col.toCharArray();
|
||||
// for (int i = 0; i < cs.length; i++)
|
||||
// {
|
||||
// count += (cs[i] - 64) * Math.pow(26, cs.length - 1 - i);
|
||||
// }
|
||||
// return count;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置单元格上提示
|
||||
|
|
@ -362,9 +389,9 @@ public class ExcelUtil<T>
|
|||
// 四个参数分别是:起始行、终止行、起始列、终止列
|
||||
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
|
||||
// 数据有效性对象
|
||||
HSSFDataValidation data_validation_view = new HSSFDataValidation(regions, constraint);
|
||||
data_validation_view.createPromptBox(promptTitle, promptContent);
|
||||
sheet.addValidationData(data_validation_view);
|
||||
HSSFDataValidation dataValidationView = new HSSFDataValidation(regions, constraint);
|
||||
dataValidationView.createPromptBox(promptTitle, promptContent);
|
||||
sheet.addValidationData(dataValidationView);
|
||||
return sheet;
|
||||
}
|
||||
|
||||
|
|
@ -387,8 +414,8 @@ public class ExcelUtil<T>
|
|||
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
|
||||
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
|
||||
// 数据有效性对象
|
||||
HSSFDataValidation data_validation_list = new HSSFDataValidation(regions, constraint);
|
||||
sheet.addValidationData(data_validation_list);
|
||||
HSSFDataValidation dataValidationList = new HSSFDataValidation(regions, constraint);
|
||||
sheet.addValidationData(dataValidationList);
|
||||
return sheet;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.common.utils.security;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.ruoyi.common.constant.PermissionConstants;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
|
||||
/**
|
||||
* permission 工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class PermissionUtils
|
||||
{
|
||||
/**
|
||||
* 权限错误消息提醒
|
||||
*
|
||||
* @param errorMsg 错误信息
|
||||
* @return
|
||||
*/
|
||||
public static String getMsg(String permissionsStr)
|
||||
{
|
||||
String permission = StringUtils.substringBetween(permissionsStr, "[", "]");
|
||||
String msg = MessageUtils.message("no.view.permission", permission);
|
||||
if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.ADD_PERMISSION))
|
||||
{
|
||||
msg = MessageUtils.message("no.create.permission", permission);
|
||||
}
|
||||
else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.EDIT_PERMISSION))
|
||||
{
|
||||
msg = MessageUtils.message("no.update.permission", permission);
|
||||
}
|
||||
else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.REMOVE_PERMISSION))
|
||||
{
|
||||
msg = MessageUtils.message("no.delete.permission", permission);
|
||||
}
|
||||
else if (StringUtils.endsWithAny(permission, new String[] { PermissionConstants.VIEW_PERMISSION, PermissionConstants.LIST_PERMISSION }))
|
||||
{
|
||||
msg = MessageUtils.message("no.view.permission", permission);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +98,11 @@ public class LogAspect
|
|||
if (currentUser != null)
|
||||
{
|
||||
operLog.setOperName(currentUser.getLoginName());
|
||||
operLog.setDeptName(currentUser.getDept().getDeptName());
|
||||
if (StringUtils.isNotNull(currentUser.getDept())
|
||||
&& StringUtils.isNotEmpty(currentUser.getDept().getDeptName()))
|
||||
{
|
||||
operLog.setDeptName(currentUser.getDept().getDeptName());
|
||||
}
|
||||
}
|
||||
|
||||
if (e != null)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 自定义注解
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
|
@ -19,11 +19,6 @@ public @interface Excel
|
|||
*/
|
||||
public abstract String name();
|
||||
|
||||
/**
|
||||
* 配置列的名称
|
||||
*/
|
||||
public abstract String column();
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,20 +14,16 @@ public class BusinessType
|
|||
public static final String INSERT = "1";
|
||||
/** 修改 */
|
||||
public static final String UPDATE = "2";
|
||||
/** 保存 */
|
||||
public static final String SAVE = "3";
|
||||
/** 删除 */
|
||||
public static final String DELETE = "4";
|
||||
public static final String DELETE = "3";
|
||||
/** 授权 */
|
||||
public static final String GRANT = "5";
|
||||
public static final String GRANT = "4";
|
||||
/** 导出 */
|
||||
public static final String EXPORT = "6";
|
||||
public static final String EXPORT = "5";
|
||||
/** 导入 */
|
||||
public static final String IMPORT = "7";
|
||||
public static final String IMPORT = "6";
|
||||
/** 强退 */
|
||||
public static final String FORCE = "8";
|
||||
/** 禁止访问 */
|
||||
public static final String FORBID = "9";
|
||||
public static final String FORCE = "7";
|
||||
/** 生成代码 */
|
||||
public static final String GENCODE = "10";
|
||||
public static final String GENCODE = "8";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ package com.ruoyi.framework.config;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
||||
import org.apache.shiro.cache.ehcache.EhCacheManager;
|
||||
import org.apache.shiro.codec.Base64;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
|
|
@ -13,12 +11,10 @@ import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
|||
import org.apache.shiro.web.mgt.CookieRememberMeManager;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.apache.shiro.web.servlet.SimpleCookie;
|
||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.shiro.realm.UserRealm;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
|
|
@ -29,7 +25,6 @@ import com.ruoyi.framework.shiro.web.filter.online.OnlineSessionFilter;
|
|||
import com.ruoyi.framework.shiro.web.filter.sync.SyncOnlineSessionFilter;
|
||||
import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager;
|
||||
import com.ruoyi.framework.shiro.web.session.SpringSessionValidationScheduler;
|
||||
|
||||
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
|
||||
|
||||
/**
|
||||
|
|
@ -336,17 +331,6 @@ public class ShiroConfig
|
|||
return cookieRememberMeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启Shiro代理
|
||||
*/
|
||||
@Bean
|
||||
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator()
|
||||
{
|
||||
DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
|
||||
proxyCreator.setProxyTargetClass(true);
|
||||
return proxyCreator;
|
||||
}
|
||||
|
||||
/**
|
||||
* thymeleaf模板引擎和shiro框架的整合
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public class LoginService
|
|||
{
|
||||
user.setLoginIp(ShiroUtils.getIp());
|
||||
user.setLoginDate(DateUtils.getNowDate());
|
||||
userService.updateUser(user);
|
||||
userService.updateUserInfo(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.debug("Encountered session exception during logout. This can generally safely be ignored.", e);
|
||||
log.error("Encountered session exception during logout. This can generally safely be ignored.", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,9 +121,7 @@ public class SpringSessionValidationScheduler implements SessionValidationSchedu
|
|||
{
|
||||
if (log.isErrorEnabled())
|
||||
{
|
||||
log.error(
|
||||
"Error starting the Spring Scheduler session validation job. Session validation may not occur.",
|
||||
e);
|
||||
log.error("Error starting the Spring Scheduler session validation job. Session validation may not occur.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,17 @@ public class BaseController
|
|||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param rows 影响行数
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected AjaxResult toAjax(int rows)
|
||||
{
|
||||
return rows > 0 ? success() : error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.ruoyi.framework.web.domain;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* Entity基类
|
||||
|
|
@ -12,19 +13,30 @@ import com.ruoyi.common.utils.DateUtils;
|
|||
public class BaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 搜索值 */
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
private Map<String, Object> params;
|
||||
|
||||
public String getSearchValue()
|
||||
{
|
||||
return searchValue;
|
||||
|
|
@ -45,14 +57,9 @@ public class BaseEntity implements Serializable
|
|||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public String getCreateTimeStr()
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime != null ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, createTime) : "";
|
||||
}
|
||||
|
||||
public String getCreateDateTimeStr()
|
||||
{
|
||||
return createTime != null ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, createTime) : "";
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime)
|
||||
|
|
@ -70,14 +77,9 @@ public class BaseEntity implements Serializable
|
|||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public String getUpdateTimeStr()
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime != null ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, updateTime) : "";
|
||||
}
|
||||
|
||||
public String getUpdateDateTimeStr()
|
||||
{
|
||||
return updateTime != null ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, updateTime) : "";
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime)
|
||||
|
|
@ -95,4 +97,14 @@ public class BaseEntity implements Serializable
|
|||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params)
|
||||
{
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import com.ruoyi.common.exception.DemoModeException;
|
||||
import com.ruoyi.common.utils.security.PermissionUtils;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
|
|
@ -27,7 +27,7 @@ public class DefaultExceptionHandler
|
|||
public AjaxResult handleAuthorizationException(AuthorizationException e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
return AjaxResult.error("您没有数据的权限,请联系管理员添加");
|
||||
return AjaxResult.error(PermissionUtils.getMsg(e.getMessage()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ public class TableSupport
|
|||
public static PageDomain getPageDomain()
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGENUM));
|
||||
pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGESIZE));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDERBYCOLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(Constants.ISASC));
|
||||
pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
|
||||
pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(Constants.IS_ASC));
|
||||
return pageDomain;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.system.config.service.IConfigService;
|
||||
|
||||
/**
|
||||
|
|
@ -9,7 +9,7 @@ import com.ruoyi.project.system.config.service.IConfigService;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
@Service("config")
|
||||
public class ConfigService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -21,7 +21,7 @@ public class ConfigService
|
|||
* @param configName 参数名称
|
||||
* @return 参数键值
|
||||
*/
|
||||
public String selectConfigByKey(String configKey)
|
||||
public String getKey(String configKey)
|
||||
{
|
||||
return configService.selectConfigByKey(configKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.ruoyi.framework.web.service;
|
|||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.system.dict.domain.DictData;
|
||||
import com.ruoyi.project.system.dict.service.IDictDataService;
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ import com.ruoyi.project.system.dict.service.IDictDataService;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
@Service("dict")
|
||||
public class DictService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -23,8 +23,20 @@ public class DictService
|
|||
* @param dictType 字典类型
|
||||
* @return 参数键值
|
||||
*/
|
||||
public List<DictData> selectDictData(String dictType)
|
||||
public List<DictData> getType(String dictType)
|
||||
{
|
||||
return dictDataService.selectDictDataByType(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String getLabel(String dictType, String dictValue)
|
||||
{
|
||||
return dictDataService.selectDictLabel(dictType, dictValue);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
package com.ruoyi.framework.shiro.service;
|
||||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* RuoYi首创 js调用 thymeleaf 实现按钮权限可见性
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
@Service("permission")
|
||||
public class PermissionService
|
||||
{
|
||||
public String hasPermi(String permission)
|
||||
|
|
@ -18,14 +18,7 @@ public class PermissionService
|
|||
|
||||
private boolean isPermittedOperator(String permission)
|
||||
{
|
||||
if (SecurityUtils.getSubject().isPermitted(permission))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return SecurityUtils.getSubject().isPermitted(permission);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +1,15 @@
|
|||
package com.ruoyi.project.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
|
|
@ -20,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
@Controller
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@RequestMapping("common/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
|
|
@ -31,25 +32,15 @@ public class CommonController
|
|||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition", "attachment;fileName=" + setFileDownloadHeader(request, realFileName));
|
||||
File file = new File(filePath);
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
OutputStream os = response.getOutputStream();
|
||||
byte[] b = new byte[1024];
|
||||
int length;
|
||||
while ((length = inputStream.read(b)) > 0)
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
os.write(b, 0, length);
|
||||
}
|
||||
os.close();
|
||||
inputStream.close();
|
||||
if (delete && file.exists())
|
||||
{
|
||||
file.delete();
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -94,13 +94,9 @@ public class JobController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult changeStatus(Job job)
|
||||
{
|
||||
if (jobService.changeStatus(job) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(jobService.changeStatus(job));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 任务调度立即执行一次
|
||||
*/
|
||||
|
|
@ -110,50 +106,49 @@ public class JobController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult run(Job job)
|
||||
{
|
||||
if (jobService.run(job) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(jobService.run(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增调度
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("monitor:job:add")
|
||||
@GetMapping("/add")
|
||||
public String add(Model model)
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存调度
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("monitor:job:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Job job)
|
||||
{
|
||||
return toAjax(jobService.insertJobCron(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改调度
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:edit")
|
||||
@GetMapping("/edit/{jobId}")
|
||||
public String edit(@PathVariable("jobId") Long jobId, Model model)
|
||||
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||
{
|
||||
Job job = jobService.selectJobById(jobId);
|
||||
model.addAttribute("job", job);
|
||||
mmap.put("job", jobService.selectJobById(jobId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存调度
|
||||
* 修改保存调度
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.SAVE)
|
||||
@RequiresPermissions("monitor:job:save")
|
||||
@PostMapping("/save")
|
||||
@Log(title = "定时任务", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult save(Job job)
|
||||
public AjaxResult editSave(Job job)
|
||||
{
|
||||
if (jobService.saveJobCron(job) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(jobService.updateJobCron(job));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,15 +71,6 @@ public class JobLogController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
jobLogService.deleteJobLogByIds(ids);
|
||||
return success();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return error(e.getMessage());
|
||||
}
|
||||
return toAjax(jobLogService.deleteJobLogByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.project.monitor.job.domain;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.ruoyi.common.constant.ScheduleConstants;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
|
|
@ -15,31 +16,35 @@ public class Job extends BaseEntity implements Serializable
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务序号", column = "A")
|
||||
@Excel(name = "任务序号")
|
||||
private Long jobId;
|
||||
|
||||
/** 任务名称 */
|
||||
@Excel(name = "任务名称", column = "B")
|
||||
@Excel(name = "任务名称")
|
||||
private String jobName;
|
||||
|
||||
/** 任务组名 */
|
||||
@Excel(name = "任务组名", column = "C")
|
||||
@Excel(name = "任务组名")
|
||||
private String jobGroup;
|
||||
|
||||
/** 任务方法 */
|
||||
@Excel(name = "任务方法", column = "D")
|
||||
@Excel(name = "任务方法")
|
||||
private String methodName;
|
||||
|
||||
/** 方法参数 */
|
||||
@Excel(name = "方法参数", column = "E")
|
||||
private String params;
|
||||
@Excel(name = "方法参数")
|
||||
private String methodParams;
|
||||
|
||||
/** cron执行表达式 */
|
||||
@Excel(name = "执行表达式 ", column = "F")
|
||||
@Excel(name = "执行表达式 ")
|
||||
private String cronExpression;
|
||||
|
||||
/** cron计划策略 */
|
||||
@Excel(name = "计划策略 ")
|
||||
private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT;
|
||||
|
||||
/** 任务状态(0正常 1暂停) */
|
||||
@Excel(name = "任务状态", column = "G")
|
||||
@Excel(name = "任务状态")
|
||||
private String status;
|
||||
|
||||
public Long getJobId()
|
||||
|
|
@ -82,14 +87,14 @@ public class Job extends BaseEntity implements Serializable
|
|||
this.methodName = methodName;
|
||||
}
|
||||
|
||||
public String getParams()
|
||||
public String getMethodParams()
|
||||
{
|
||||
return params;
|
||||
return methodParams;
|
||||
}
|
||||
|
||||
public void setParams(String params)
|
||||
public void setMethodParams(String methodParams)
|
||||
{
|
||||
this.params = params;
|
||||
this.methodParams = methodParams;
|
||||
}
|
||||
|
||||
public String getCronExpression()
|
||||
|
|
@ -102,6 +107,16 @@ public class Job extends BaseEntity implements Serializable
|
|||
this.cronExpression = cronExpression;
|
||||
}
|
||||
|
||||
public String getMisfirePolicy()
|
||||
{
|
||||
return misfirePolicy;
|
||||
}
|
||||
|
||||
public void setMisfirePolicy(String misfirePolicy)
|
||||
{
|
||||
this.misfirePolicy = misfirePolicy;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
|
|
@ -116,7 +131,7 @@ public class Job extends BaseEntity implements Serializable
|
|||
public String toString()
|
||||
{
|
||||
return "Job [jobId=" + jobId + ", jobName=" + jobName + ", jobGroup=" + jobGroup + ", methodName=" + methodName
|
||||
+ ", params=" + params + ", cronExpression=" + cronExpression + ", status=" + status + "]";
|
||||
+ ", methodParams=" + methodParams + ", cronExpression=" + cronExpression + ", status=" + status + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,35 +13,35 @@ public class JobLog extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@Excel(name = "日志序号", column = "A")
|
||||
@Excel(name = "日志序号")
|
||||
private Long jobLogId;
|
||||
|
||||
/** 任务名称 */
|
||||
@Excel(name = "任务名称", column = "B")
|
||||
@Excel(name = "任务名称")
|
||||
private String jobName;
|
||||
|
||||
/** 任务组名 */
|
||||
@Excel(name = "任务组名", column = "C")
|
||||
@Excel(name = "任务组名")
|
||||
private String jobGroup;
|
||||
|
||||
/** 任务方法 */
|
||||
@Excel(name = "任务方法", column = "D")
|
||||
@Excel(name = "任务方法")
|
||||
private String methodName;
|
||||
|
||||
/** 方法参数 */
|
||||
@Excel(name = "方法参数", column = "E")
|
||||
private String params;
|
||||
@Excel(name = "方法参数")
|
||||
private String methodParams;
|
||||
|
||||
/** 日志信息 */
|
||||
@Excel(name = "日志信息", column = "F")
|
||||
@Excel(name = "日志信息")
|
||||
private String jobMessage;
|
||||
|
||||
/** 执行状态(0正常 1失败) */
|
||||
@Excel(name = "执行状态", column = "G")
|
||||
@Excel(name = "执行状态")
|
||||
private String status;
|
||||
|
||||
/** 异常信息 */
|
||||
@Excel(name = "异常信息", column = "H")
|
||||
@Excel(name = "异常信息")
|
||||
private String exceptionInfo;
|
||||
|
||||
public Long getJobLogId()
|
||||
|
|
@ -84,14 +84,14 @@ public class JobLog extends BaseEntity
|
|||
this.methodName = methodName;
|
||||
}
|
||||
|
||||
public String getParams()
|
||||
public String getMethodParams()
|
||||
{
|
||||
return params;
|
||||
return methodParams;
|
||||
}
|
||||
|
||||
public void setParams(String params)
|
||||
public void setMethodParams(String methodParams)
|
||||
{
|
||||
this.params = params;
|
||||
this.methodParams = methodParams;
|
||||
}
|
||||
|
||||
public String getJobMessage()
|
||||
|
|
@ -128,7 +128,7 @@ public class JobLog extends BaseEntity
|
|||
public String toString()
|
||||
{
|
||||
return "JobLog [jobLogId=" + jobLogId + ", jobName=" + jobName + ", jobGroup=" + jobGroup + ", methodName="
|
||||
+ methodName + ", params=" + params + ", jobMessage=" + jobMessage + ", status=" + status
|
||||
+ methodName + ", methodParams=" + methodParams + ", jobMessage=" + jobMessage + ", status=" + status
|
||||
+ ", exceptionInfo=" + exceptionInfo + "]";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public interface IJobService
|
|||
* @return 结果
|
||||
*/
|
||||
public int changeStatus(Job job);
|
||||
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
|
|
@ -81,7 +81,7 @@ public interface IJobService
|
|||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int addJobCron(Job job);
|
||||
public int insertJobCron(Job job);
|
||||
|
||||
/**
|
||||
* 更新任务的时间表达式
|
||||
|
|
@ -91,11 +91,4 @@ public interface IJobService
|
|||
*/
|
||||
public int updateJobCron(Job job);
|
||||
|
||||
/**
|
||||
* 保存任务的时间表达式
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveJobCron(Job job);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.job.mapper.JobLogMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("jobLogService")
|
||||
@Service
|
||||
public class JobLogServiceImpl implements IJobLogService
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
package com.ruoyi.project.monitor.job.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.constant.ScheduleConstants;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.monitor.job.domain.Job;
|
||||
import com.ruoyi.project.monitor.job.mapper.JobMapper;
|
||||
|
|
@ -22,7 +18,7 @@ import com.ruoyi.project.monitor.job.util.ScheduleUtils;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("jobService")
|
||||
@Service
|
||||
public class JobServiceImpl implements IJobService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -166,7 +162,7 @@ public class JobServiceImpl implements IJobService
|
|||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
|
|
@ -184,7 +180,7 @@ public class JobServiceImpl implements IJobService
|
|||
* @param job 调度信息 调度信息
|
||||
*/
|
||||
@Override
|
||||
public int addJobCron(Job job)
|
||||
public int insertJobCron(Job job)
|
||||
{
|
||||
job.setCreateBy(ShiroUtils.getLoginName());
|
||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||
|
|
@ -204,6 +200,7 @@ public class JobServiceImpl implements IJobService
|
|||
@Override
|
||||
public int updateJobCron(Job job)
|
||||
{
|
||||
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0)
|
||||
{
|
||||
|
|
@ -212,25 +209,4 @@ public class JobServiceImpl implements IJobService
|
|||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存任务的时间表达式
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
public int saveJobCron(Job job)
|
||||
{
|
||||
Long jobId = job.getJobId();
|
||||
int rows = 0;
|
||||
if (StringUtils.isNotNull(jobId))
|
||||
{
|
||||
rows = updateJobCron(job);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = addJobCron(job);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ScheduleJob extends QuartzJobBean
|
|||
protected void executeInternal(JobExecutionContext context) throws JobExecutionException
|
||||
{
|
||||
Job job = new Job();
|
||||
BeanUtils.copyBeanProp(job, context.getMergedJobDataMap().get(ScheduleConstants.JOB_PARAM_KEY));
|
||||
BeanUtils.copyBeanProp(job, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES));
|
||||
|
||||
IJobLogService jobLogService = (IJobLogService) SpringUtils.getBean(IJobLogService.class);
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ public class ScheduleJob extends QuartzJobBean
|
|||
jobLog.setJobName(job.getJobName());
|
||||
jobLog.setJobGroup(job.getJobGroup());
|
||||
jobLog.setMethodName(job.getMethodName());
|
||||
jobLog.setParams(job.getParams());
|
||||
jobLog.setMethodParams(job.getMethodParams());
|
||||
jobLog.setCreateTime(new Date());
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
|
@ -50,7 +50,7 @@ public class ScheduleJob extends QuartzJobBean
|
|||
{
|
||||
// 执行任务
|
||||
log.info("任务开始执行 - 名称:{} 方法:{}", job.getJobName(), job.getMethodName());
|
||||
ScheduleRunnable task = new ScheduleRunnable(job.getJobName(), job.getMethodName(), job.getParams());
|
||||
ScheduleRunnable task = new ScheduleRunnable(job.getJobName(), job.getMethodName(), job.getMethodParams());
|
||||
Future<?> future = service.submit(task);
|
||||
future.get();
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import org.quartz.TriggerKey;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.ScheduleConstants;
|
||||
import com.ruoyi.common.exception.job.TaskException;
|
||||
import com.ruoyi.common.exception.job.TaskException.Code;
|
||||
import com.ruoyi.project.monitor.job.domain.Job;
|
||||
|
||||
/**
|
||||
|
|
@ -25,14 +27,12 @@ public class ScheduleUtils
|
|||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ScheduleUtils.class);
|
||||
|
||||
private final static String JOB_NAME = "TASK_";
|
||||
|
||||
/**
|
||||
* 获取触发器key
|
||||
*/
|
||||
public static TriggerKey getTriggerKey(Long jobId)
|
||||
{
|
||||
return TriggerKey.triggerKey(JOB_NAME + jobId);
|
||||
return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -40,7 +40,7 @@ public class ScheduleUtils
|
|||
*/
|
||||
public static JobKey getJobKey(Long jobId)
|
||||
{
|
||||
return JobKey.jobKey(JOB_NAME + jobId);
|
||||
return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -54,7 +54,7 @@ public class ScheduleUtils
|
|||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("getCronTrigger 异常:", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -70,14 +70,14 @@ public class ScheduleUtils
|
|||
JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(job.getJobId())).build();
|
||||
|
||||
// 表达式调度构建器
|
||||
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
|
||||
cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder);
|
||||
|
||||
// 按新的cronExpression表达式构建一个新的trigger
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(job.getJobId()))
|
||||
.withSchedule(scheduleBuilder).build();
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(job.getJobId())).withSchedule(cronScheduleBuilder).build();
|
||||
|
||||
// 放入参数,运行时的方法可以获取
|
||||
jobDetail.getJobDataMap().put(ScheduleConstants.JOB_PARAM_KEY, job);
|
||||
jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job);
|
||||
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
|
||||
|
|
@ -89,7 +89,11 @@ public class ScheduleUtils
|
|||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("createScheduleJob 异常:", e);
|
||||
}
|
||||
catch (TaskException e)
|
||||
{
|
||||
log.error("createScheduleJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -103,15 +107,16 @@ public class ScheduleUtils
|
|||
TriggerKey triggerKey = getTriggerKey(job.getJobId());
|
||||
|
||||
// 表达式调度构建器
|
||||
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
|
||||
cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder);
|
||||
|
||||
CronTrigger trigger = getCronTrigger(scheduler, job.getJobId());
|
||||
|
||||
// 按新的cronExpression表达式重新构建trigger
|
||||
trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
|
||||
trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
|
||||
|
||||
// 参数
|
||||
trigger.getJobDataMap().put(ScheduleConstants.JOB_PARAM_KEY, job);
|
||||
trigger.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job);
|
||||
|
||||
scheduler.rescheduleJob(triggerKey, trigger);
|
||||
|
||||
|
|
@ -124,7 +129,11 @@ public class ScheduleUtils
|
|||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("SchedulerException 异常:", e);
|
||||
}
|
||||
catch (TaskException e)
|
||||
{
|
||||
log.error("SchedulerException 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,14 +147,14 @@ public class ScheduleUtils
|
|||
{
|
||||
// 参数
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put(ScheduleConstants.JOB_PARAM_KEY, job);
|
||||
dataMap.put(ScheduleConstants.TASK_PROPERTIES, job);
|
||||
|
||||
scheduler.triggerJob(getJobKey(job.getJobId()), dataMap);
|
||||
rows = 1;
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("run 异常:", e);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
|
@ -161,7 +170,7 @@ public class ScheduleUtils
|
|||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("pauseJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +185,7 @@ public class ScheduleUtils
|
|||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("resumeJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +200,26 @@ public class ScheduleUtils
|
|||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("deleteScheduleJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(Job job, CronScheduleBuilder cb)
|
||||
throws TaskException
|
||||
{
|
||||
switch (job.getMisfirePolicy())
|
||||
{
|
||||
case ScheduleConstants.MISFIRE_DEFAULT:
|
||||
return cb;
|
||||
case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
|
||||
return cb.withMisfireHandlingInstructionIgnoreMisfires();
|
||||
case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
|
||||
return cb.withMisfireHandlingInstructionFireAndProceed();
|
||||
case ScheduleConstants.MISFIRE_DO_NOTHING:
|
||||
return cb.withMisfireHandlingInstructionDoNothing();
|
||||
default:
|
||||
throw new TaskException("The task misfire policy '" + job.getMisfirePolicy()
|
||||
+ "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,11 +71,6 @@ public class LogininforController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
int rows = logininforService.deleteLogininforByIds(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,39 +13,39 @@ public class Logininfor extends BaseEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** ID */
|
||||
@Excel(name = "序号", column = "A")
|
||||
private Integer infoId;
|
||||
@Excel(name = "序号")
|
||||
private Long infoId;
|
||||
/** 用户账号 */
|
||||
@Excel(name = "用户账号", column = "B")
|
||||
@Excel(name = "用户账号")
|
||||
private String loginName;
|
||||
/** 登录状态 0成功 1失败 */
|
||||
@Excel(name = "登录状态", column = "C")
|
||||
@Excel(name = "登录状态")
|
||||
private String status;
|
||||
/** 登录IP地址 */
|
||||
@Excel(name = "登录地址", column = "D")
|
||||
@Excel(name = "登录地址")
|
||||
private String ipaddr;
|
||||
/** 登录地点 */
|
||||
@Excel(name = "登录地点", column = "E")
|
||||
@Excel(name = "登录地点")
|
||||
private String loginLocation;
|
||||
/** 浏览器类型 */
|
||||
@Excel(name = "浏览器", column = "F")
|
||||
@Excel(name = "浏览器")
|
||||
private String browser;
|
||||
/** 操作系统 */
|
||||
@Excel(name = "操作系统 ", column = "G")
|
||||
@Excel(name = "操作系统 ")
|
||||
private String os;
|
||||
/** 提示消息 */
|
||||
@Excel(name = "提示消息", column = "H")
|
||||
@Excel(name = "提示消息")
|
||||
private String msg;
|
||||
/** 访问时间 */
|
||||
@Excel(name = "访问时间", column = "I")
|
||||
@Excel(name = "访问时间")
|
||||
private Date loginTime;
|
||||
|
||||
public Integer getInfoId()
|
||||
public Long getInfoId()
|
||||
{
|
||||
return infoId;
|
||||
}
|
||||
|
||||
public void setInfoId(Integer infoId)
|
||||
public void setInfoId(Long infoId)
|
||||
{
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.logininfor.mapper.LogininforMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("logininforService")
|
||||
@Service
|
||||
public class LogininforServiceImpl implements ILogininforService
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import com.ruoyi.project.monitor.online.mapper.UserOnlineMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("userOnlineService")
|
||||
@Service
|
||||
public class UserOnlineServiceImpl implements IUserOnlineService
|
||||
{
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -72,20 +72,14 @@ public class OperlogController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
int rows = operLogService.deleteOperLogByIds(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:detail")
|
||||
@GetMapping("/detail/{operId}")
|
||||
public String detail(@PathVariable("operId") Long deptId, Model model)
|
||||
public String detail(@PathVariable("operId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
OperLog operLog = operLogService.selectOperLogById(deptId);
|
||||
model.addAttribute("operLog", operLog);
|
||||
mmap.put("operLog", operLogService.selectOperLogById(deptId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,69 +13,69 @@ import com.ruoyi.framework.web.domain.BaseEntity;
|
|||
public class OperLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 日志主键 */
|
||||
@Excel(name = "操作序号", column = "A")
|
||||
private Integer operId;
|
||||
|
||||
@Excel(name = "操作序号")
|
||||
private Long operId;
|
||||
|
||||
/** 操作模块 */
|
||||
@Excel(name = "操作模块", column = "B")
|
||||
@Excel(name = "操作模块")
|
||||
private String title;
|
||||
|
||||
|
||||
/** 操作类型 */
|
||||
@Excel(name = "操作类型", column = "C")
|
||||
@Excel(name = "操作类型")
|
||||
private String action;
|
||||
|
||||
|
||||
/** 请求方法 */
|
||||
@Excel(name = "请求方法", column = "D")
|
||||
@Excel(name = "请求方法")
|
||||
private String method;
|
||||
|
||||
|
||||
/** 来源渠道 */
|
||||
@Excel(name = "来源渠道", column = "E")
|
||||
@Excel(name = "来源渠道")
|
||||
private String channel;
|
||||
|
||||
|
||||
/** 操作人员 */
|
||||
@Excel(name = "操作人员", column = "F")
|
||||
@Excel(name = "操作人员")
|
||||
private String operName;
|
||||
|
||||
|
||||
/** 部门名称 */
|
||||
@Excel(name = "部门名称", column = "G")
|
||||
@Excel(name = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
|
||||
/** 请求url */
|
||||
@Excel(name = "请求地址", column = "H")
|
||||
@Excel(name = "请求地址")
|
||||
private String operUrl;
|
||||
|
||||
|
||||
/** 操作地址 */
|
||||
@Excel(name = "操作地址", column = "I")
|
||||
@Excel(name = "操作地址")
|
||||
private String operIp;
|
||||
|
||||
|
||||
/** 操作地点 */
|
||||
@Excel(name = "操作地点", column = "J")
|
||||
@Excel(name = "操作地点")
|
||||
private String operLocation;
|
||||
|
||||
|
||||
/** 请求参数 */
|
||||
@Excel(name = "请求参数", column = "K")
|
||||
@Excel(name = "请求参数")
|
||||
private String operParam;
|
||||
|
||||
|
||||
/** 状态0正常 1异常 */
|
||||
@Excel(name = "状态", column = "L")
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
|
||||
/** 错误消息 */
|
||||
@Excel(name = "错误消息", column = "N")
|
||||
@Excel(name = "错误消息")
|
||||
private String errorMsg;
|
||||
|
||||
|
||||
/** 操作时间 */
|
||||
@Excel(name = "操作时间", column = "M")
|
||||
@Excel(name = "操作时间")
|
||||
private Date operTime;
|
||||
|
||||
public Integer getOperId()
|
||||
public Long getOperId()
|
||||
{
|
||||
return operId;
|
||||
}
|
||||
|
||||
public void setOperId(Integer operId)
|
||||
public void setOperId(Long operId)
|
||||
{
|
||||
this.operId = operId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.operlog.mapper.OperLogMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("operLogService")
|
||||
@Service
|
||||
public class OperLogServiceImpl implements IOperLogService
|
||||
{
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -35,7 +35,7 @@ public class ConfigController extends BaseController
|
|||
|
||||
@RequiresPermissions("system:config:view")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
public String config()
|
||||
{
|
||||
return prefix + "/config";
|
||||
}
|
||||
|
|
@ -52,7 +52,6 @@ public class ConfigController extends BaseController
|
|||
List<Config> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "参数管理", action = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
|
|
@ -74,41 +73,44 @@ public class ConfigController extends BaseController
|
|||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "参数管理", action = BusinessType.INSERT)
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "参数管理", action = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Config config)
|
||||
{
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "参数管理", action = BusinessType.UPDATE)
|
||||
@GetMapping("/edit/{configId}")
|
||||
public String edit(@PathVariable("configId") Integer configId, Model model)
|
||||
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||
{
|
||||
Config config = configService.selectConfigById(configId);
|
||||
model.addAttribute("config", config);
|
||||
mmap.put("config", configService.selectConfigById(configId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存参数配置
|
||||
* 修改保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:save")
|
||||
@Log(title = "参数管理", action = BusinessType.SAVE)
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "参数管理", action = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult save(Config config)
|
||||
public AjaxResult editSave(Config config)
|
||||
{
|
||||
if (configService.saveConfig(config) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -120,11 +122,7 @@ public class ConfigController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
if (configService.deleteConfigByIds(ids) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(configService.deleteConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,32 +13,31 @@ public class Config extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 参数主键 */
|
||||
@Excel(name = "参数主键", column = "A")
|
||||
private Integer configId;
|
||||
|
||||
/** 参数名称 */
|
||||
@Excel(name = "参数名称", column = "B")
|
||||
private String configName;
|
||||
|
||||
/** 参数键名 */
|
||||
@Excel(name = "参数键名", column = "C")
|
||||
private String configKey;
|
||||
|
||||
/** 参数键值 */
|
||||
@Excel(name = "参数键值", column = "D")
|
||||
private String configValue;
|
||||
|
||||
/** 系统内置(Y是 N否) */
|
||||
@Excel(name = "系统内置", column = "E")
|
||||
private String configType;
|
||||
|
||||
@Excel(name = "参数主键")
|
||||
private Long configId;
|
||||
|
||||
public Integer getConfigId()
|
||||
/** 参数名称 */
|
||||
@Excel(name = "参数名称")
|
||||
private String configName;
|
||||
|
||||
/** 参数键名 */
|
||||
@Excel(name = "参数键名")
|
||||
private String configKey;
|
||||
|
||||
/** 参数键值 */
|
||||
@Excel(name = "参数键值")
|
||||
private String configValue;
|
||||
|
||||
/** 系统内置(Y是 N否) */
|
||||
@Excel(name = "系统内置")
|
||||
private String configType;
|
||||
|
||||
public Long getConfigId()
|
||||
{
|
||||
return configId;
|
||||
}
|
||||
|
||||
public void setConfigId(Integer configId)
|
||||
public void setConfigId(Long configId)
|
||||
{
|
||||
this.configId = configId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,22 +10,13 @@ import java.util.List;
|
|||
*/
|
||||
public interface ConfigMapper
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @param configId 参数配置信息
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public Config selectConfigById(Integer configId);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数键名
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public Config selectConfigByKey(String configKey);
|
||||
public Config selectConfig(Config config);
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
|
|
@ -35,6 +26,14 @@ public interface ConfigMapper
|
|||
*/
|
||||
public List<Config> selectConfigList(Config config);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数键名
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public Config checkConfigKeyUnique(String configKey);
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
|
|
@ -51,14 +50,6 @@ public interface ConfigMapper
|
|||
*/
|
||||
public int updateConfig(Config config);
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigById(Integer configId);
|
||||
|
||||
/**
|
||||
* 批量删除参数配置
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.system.config.domain.Config;
|
||||
import com.ruoyi.project.system.config.mapper.ConfigMapper;
|
||||
|
||||
|
|
@ -27,9 +28,11 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 参数配置信息
|
||||
*/
|
||||
@Override
|
||||
public Config selectConfigById(Integer configId)
|
||||
public Config selectConfigById(Long configId)
|
||||
{
|
||||
return configMapper.selectConfigById(configId);
|
||||
Config config = new Config();
|
||||
config.setConfigId(configId);
|
||||
return configMapper.selectConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,8 +44,10 @@ public class ConfigServiceImpl implements IConfigService
|
|||
@Override
|
||||
public String selectConfigByKey(String configKey)
|
||||
{
|
||||
Config config = configMapper.selectConfigByKey(configKey);
|
||||
return StringUtils.isNotNull(config) ? config.getConfigValue() : "";
|
||||
Config config = new Config();
|
||||
config.setConfigKey(configKey);
|
||||
Config retConfig = configMapper.selectConfig(config);
|
||||
return StringUtils.isNotNull(retConfig) ? retConfig.getConfigValue() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -66,6 +71,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
@Override
|
||||
public int insertConfig(Config config)
|
||||
{
|
||||
config.setCreateBy(ShiroUtils.getLoginName());
|
||||
return configMapper.insertConfig(config);
|
||||
}
|
||||
|
||||
|
|
@ -78,43 +84,10 @@ public class ConfigServiceImpl implements IConfigService
|
|||
@Override
|
||||
public int updateConfig(Config config)
|
||||
{
|
||||
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return configMapper.updateConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveConfig(Config config)
|
||||
{
|
||||
Integer configId = config.getConfigId();
|
||||
int rows = 0;
|
||||
if (StringUtils.isNotNull(configId))
|
||||
{
|
||||
rows = configMapper.updateConfig(config);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = configMapper.insertConfig(config);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConfigById(Integer configId)
|
||||
{
|
||||
return configMapper.deleteConfigById(configId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除参数配置对象
|
||||
*
|
||||
|
|
@ -136,14 +109,9 @@ public class ConfigServiceImpl implements IConfigService
|
|||
@Override
|
||||
public String checkConfigKeyUnique(Config config)
|
||||
{
|
||||
if (config.getConfigId() == null)
|
||||
{
|
||||
config.setConfigId(-1);
|
||||
}
|
||||
Integer configId = config.getConfigId();
|
||||
Config info = configMapper.selectConfigByKey(config.getConfigKey());
|
||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getConfigId())
|
||||
&& info.getConfigId().intValue() != configId.intValue())
|
||||
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||
Config info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
||||
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
|
||||
{
|
||||
return UserConstants.CONFIG_KEY_NOT_UNIQUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public interface IConfigService
|
|||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public Config selectConfigById(Integer configId);
|
||||
public Config selectConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
|
|
@ -51,22 +51,6 @@ public interface IConfigService
|
|||
*/
|
||||
public int updateConfig(Config config);
|
||||
|
||||
/**
|
||||
* 保存参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveConfig(Config config);
|
||||
|
||||
/**
|
||||
* 删除参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigById(Integer configId);
|
||||
|
||||
/**
|
||||
* 批量删除参数配置信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.ruoyi.project.system.role.domain.Role;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -44,52 +44,54 @@ public class DeptController extends BaseController
|
|||
@RequiresPermissions("system:dept:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<Dept> list()
|
||||
public List<Dept> list(Dept dept)
|
||||
{
|
||||
List<Dept> deptList = deptService.selectDeptAll();
|
||||
List<Dept> deptList = deptService.selectDeptList(dept);
|
||||
return deptList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", deptService.selectDeptById(parentId));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存部门
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dept:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Dept dept)
|
||||
{
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dept:edit")
|
||||
@GetMapping("/edit/{deptId}")
|
||||
public String edit(@PathVariable("deptId") Long deptId, Model model)
|
||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
Dept dept = deptService.selectDeptById(deptId);
|
||||
model.addAttribute("dept", dept);
|
||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dept:add")
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, Model model)
|
||||
{
|
||||
Dept dept = deptService.selectDeptById(parentId);
|
||||
model.addAttribute("dept", dept);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.SAVE)
|
||||
@RequiresPermissions("system:dept:save")
|
||||
@PostMapping("/save")
|
||||
@Log(title = "部门管理", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dept:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult save(Dept dept)
|
||||
public AjaxResult editSave(Dept dept)
|
||||
{
|
||||
if (deptService.saveDept(dept) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -109,11 +111,7 @@ public class DeptController extends BaseController
|
|||
{
|
||||
return error(1, "部门存在用户,不允许删除");
|
||||
}
|
||||
if (deptService.deleteDeptById(deptId) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -135,9 +133,9 @@ public class DeptController extends BaseController
|
|||
* 选择部门树
|
||||
*/
|
||||
@GetMapping("/selectDeptTree/{deptId}")
|
||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, Model model)
|
||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
model.addAttribute("treeName", deptService.selectDeptById(deptId).getDeptName());
|
||||
mmap.put("treeName", deptService.selectDeptById(deptId).getDeptName());
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,9 +27,17 @@ public interface DeptMapper
|
|||
public int checkDeptExistUser(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询部门管理集合
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @return 所有部门信息
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptList(Dept dept);
|
||||
|
||||
/**
|
||||
* 查询部门所有数据
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import java.util.Map;
|
|||
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
|
|
@ -19,16 +19,27 @@ import com.ruoyi.project.system.dept.mapper.DeptMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Repository("deptService")
|
||||
@Service
|
||||
public class DeptServiceImpl implements IDeptService
|
||||
{
|
||||
@Autowired
|
||||
private DeptMapper deptMapper;
|
||||
|
||||
/**
|
||||
* 查询部门管理集合
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @return 所有部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Dept> selectDeptList(Dept dept)
|
||||
{
|
||||
return deptMapper.selectDeptList(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门所有数据
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Dept> selectDeptAll()
|
||||
|
|
@ -143,24 +154,29 @@ public class DeptServiceImpl implements IDeptService
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存部门信息
|
||||
* 新增保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveDept(Dept dept)
|
||||
public int insertDept(Dept dept)
|
||||
{
|
||||
if (StringUtils.isNotNull(dept.getDeptId()))
|
||||
{
|
||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return deptMapper.updateDept(dept);
|
||||
}
|
||||
else
|
||||
{
|
||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||
return deptMapper.insertDept(dept);
|
||||
}
|
||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||
return deptMapper.insertDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDept(Dept dept)
|
||||
{
|
||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return deptMapper.updateDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -184,14 +200,9 @@ public class DeptServiceImpl implements IDeptService
|
|||
@Override
|
||||
public String checkDeptNameUnique(Dept dept)
|
||||
{
|
||||
if (dept.getDeptId() == null)
|
||||
{
|
||||
dept.setDeptId(-1L);
|
||||
}
|
||||
Long deptId = dept.getDeptId();
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName());
|
||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getDeptId())
|
||||
&& info.getDeptId().longValue() != deptId.longValue())
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,20 @@ import com.ruoyi.project.system.role.domain.Role;
|
|||
public interface IDeptService
|
||||
{
|
||||
/**
|
||||
* 查询部门管理集合
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @return 所有部门信息
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptList(Dept dept);
|
||||
|
||||
/**
|
||||
* 查询部门所有数据
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptAll();
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门管理树
|
||||
*
|
||||
|
|
@ -60,12 +68,20 @@ public interface IDeptService
|
|||
public int deleteDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 保存部门信息
|
||||
* 新增保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveDept(Dept dept);
|
||||
public int insertDept(Dept dept);
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(Dept dept);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
|
|
@ -74,7 +90,7 @@ public interface IDeptService
|
|||
* @return 部门信息
|
||||
*/
|
||||
public Dept selectDeptById(Long deptId);
|
||||
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -67,45 +67,48 @@ public class DictDataController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@GetMapping("/edit/{dictCode}")
|
||||
public String edit(@PathVariable("dictCode") Long dictCode, Model model)
|
||||
{
|
||||
DictData dict = dictDataService.selectDictDataById(dictCode);
|
||||
model.addAttribute("dict", dict);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@GetMapping("/add/{dictType}")
|
||||
public String add(@PathVariable("dictType") String dictType, Model model)
|
||||
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
||||
{
|
||||
model.addAttribute("dictType", dictType);
|
||||
mmap.put("dictType", dictType);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存字典类型
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", action = BusinessType.SAVE)
|
||||
@RequiresPermissions("system:dict:save")
|
||||
@PostMapping("/save")
|
||||
@Log(title = "字典数据", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult save(DictData dict)
|
||||
public AjaxResult addSave(DictData dict)
|
||||
{
|
||||
if (dictDataService.saveDictData(dict) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@GetMapping("/edit/{dictCode}")
|
||||
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(DictData dict)
|
||||
{
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", action = BusinessType.DELETE)
|
||||
|
|
@ -114,11 +117,6 @@ public class DictDataController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
int rows = dictDataService.deleteDictDataByIds(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -67,24 +67,9 @@ public class DictTypeController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@GetMapping("/edit/{dictId}")
|
||||
public String edit(@PathVariable("dictId") Long dictId, Model model)
|
||||
{
|
||||
DictType dict = dictTypeService.selectDictTypeById(dictId);
|
||||
model.addAttribute("dict", dict);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
|
|
@ -92,19 +77,37 @@ public class DictTypeController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存字典类型
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", action = BusinessType.SAVE)
|
||||
@RequiresPermissions("system:dict:save")
|
||||
@PostMapping("/save")
|
||||
@Log(title = "字典类型", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult save(DictType dict)
|
||||
public AjaxResult addSave(DictType dict)
|
||||
{
|
||||
if (dictTypeService.saveDictType(dict) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@GetMapping("/edit/{dictId}")
|
||||
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(DictType dict)
|
||||
{
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", action = BusinessType.DELETE)
|
||||
|
|
@ -115,8 +118,7 @@ public class DictTypeController extends BaseController
|
|||
{
|
||||
try
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(ids);
|
||||
return success();
|
||||
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -129,12 +131,10 @@ public class DictTypeController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@GetMapping("/detail/{dictId}")
|
||||
public String detail(@PathVariable("dictId") Long dictId, Model model)
|
||||
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||
{
|
||||
DictType dict = dictTypeService.selectDictTypeById(dictId);
|
||||
List<DictType> dictTypeList = dictTypeService.selectDictTypeAll();
|
||||
model.addAttribute("dict", dict);
|
||||
model.addAttribute("dictList", dictTypeList);
|
||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||
return "system/dict/data/data";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,35 +13,38 @@ public class DictData extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
@Excel(name = "字典编码", column = "A")
|
||||
@Excel(name = "字典编码")
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典排序 */
|
||||
@Excel(name = "字典排序", column = "B")
|
||||
@Excel(name = "字典排序")
|
||||
private Long dictSort;
|
||||
|
||||
/** 字典标签 */
|
||||
@Excel(name = "字典标签", column = "C")
|
||||
@Excel(name = "字典标签")
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@Excel(name = "字典键值", column = "D")
|
||||
@Excel(name = "字典键值")
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型", column = "E")
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 字典样式 */
|
||||
@Excel(name = "字典样式", column = "F")
|
||||
@Excel(name = "字典样式")
|
||||
private String cssClass;
|
||||
|
||||
/** 表格字典样式 */
|
||||
private String listClass;
|
||||
|
||||
/** 是否默认(Y是 N否) */
|
||||
@Excel(name = "是否默认", column = "G")
|
||||
@Excel(name = "是否默认")
|
||||
private String isDefault;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", column = "H")
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
public Long getDictCode()
|
||||
|
|
@ -104,6 +107,16 @@ public class DictData extends BaseEntity
|
|||
this.cssClass = cssClass;
|
||||
}
|
||||
|
||||
public String getListClass()
|
||||
{
|
||||
return listClass;
|
||||
}
|
||||
|
||||
public void setListClass(String listClass)
|
||||
{
|
||||
this.listClass = listClass;
|
||||
}
|
||||
|
||||
public String getIsDefault()
|
||||
{
|
||||
return isDefault;
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@ public class DictType extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
@Excel(name = "字典主键", column = "A")
|
||||
@Excel(name = "字典主键")
|
||||
private Long dictId;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称", column = "B")
|
||||
@Excel(name = "字典名称")
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型 ", column = "C")
|
||||
@Excel(name = "字典类型 ")
|
||||
private String dictType;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", column = "D")
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
public Long getDictId()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.project.system.dict.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.ruoyi.project.system.dict.domain.DictData;
|
||||
|
||||
/**
|
||||
|
|
@ -18,7 +21,7 @@ public interface DictDataMapper
|
|||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<DictData> selectDictDataList(DictData dictData);
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
|
|
@ -27,6 +30,15 @@ public interface DictDataMapper
|
|||
*/
|
||||
public List<DictData> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
|
|
@ -34,7 +46,7 @@ public interface DictDataMapper
|
|||
* @return 字典数据
|
||||
*/
|
||||
public DictData selectDictDataById(Long dictCode);
|
||||
|
||||
|
||||
/**
|
||||
* 查询字典数据
|
||||
*
|
||||
|
|
@ -42,7 +54,7 @@ public interface DictDataMapper
|
|||
* @return 字典数据
|
||||
*/
|
||||
public int countDictDataByType(String dictType);
|
||||
|
||||
|
||||
/**
|
||||
* 通过字典ID删除字典数据信息
|
||||
*
|
||||
|
|
@ -50,7 +62,7 @@ public interface DictDataMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDictDataById(Long dictCode);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除字典数据
|
||||
*
|
||||
|
|
@ -75,4 +87,13 @@ public interface DictDataMapper
|
|||
*/
|
||||
public int updateDictData(DictData dictData);
|
||||
|
||||
/**
|
||||
* 同步修改字典类型
|
||||
*
|
||||
* @param oldDictType 旧字典类型
|
||||
* @param newDictType 新旧字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.system.dict.domain.DictData;
|
||||
import com.ruoyi.project.system.dict.mapper.DictDataMapper;
|
||||
|
|
@ -14,7 +13,7 @@ import com.ruoyi.project.system.dict.mapper.DictDataMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("dictDataService")
|
||||
@Service
|
||||
public class DictDataServiceImpl implements IDictDataService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -44,6 +43,19 @@ public class DictDataServiceImpl implements IDictDataService
|
|||
return dictDataMapper.selectDictDataByType(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
@Override
|
||||
public String selectDictLabel(String dictType, String dictValue)
|
||||
{
|
||||
return dictDataMapper.selectDictLabel(dictType, dictValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
|
|
@ -81,25 +93,29 @@ public class DictDataServiceImpl implements IDictDataService
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存字典数据信息
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveDictData(DictData dictData)
|
||||
public int insertDictData(DictData dictData)
|
||||
{
|
||||
Long dictCode = dictData.getDictCode();
|
||||
if (StringUtils.isNotNull(dictCode))
|
||||
{
|
||||
dictData.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return dictDataMapper.updateDictData(dictData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dictData.setCreateBy(ShiroUtils.getLoginName());
|
||||
return dictDataMapper.insertDictData(dictData);
|
||||
}
|
||||
dictData.setCreateBy(ShiroUtils.getLoginName());
|
||||
return dictDataMapper.insertDictData(dictData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictData(DictData dictData)
|
||||
{
|
||||
dictData.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return dictDataMapper.updateDictData(dictData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import com.ruoyi.project.system.dict.mapper.DictTypeMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("dictTypeService")
|
||||
@Service
|
||||
public class DictTypeServiceImpl implements IDictTypeService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -95,25 +95,31 @@ public class DictTypeServiceImpl implements IDictTypeService
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存字典类型信息
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveDictType(DictType dictType)
|
||||
public int insertDictType(DictType dictType)
|
||||
{
|
||||
Long dictId = dictType.getDictId();
|
||||
if (StringUtils.isNotNull(dictId))
|
||||
{
|
||||
dictType.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return dictTypeMapper.updateDictType(dictType);
|
||||
}
|
||||
else
|
||||
{
|
||||
dictType.setCreateBy(ShiroUtils.getLoginName());
|
||||
return dictTypeMapper.insertDictType(dictType);
|
||||
}
|
||||
dictType.setCreateBy(ShiroUtils.getLoginName());
|
||||
return dictTypeMapper.insertDictType(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictType(DictType dictType)
|
||||
{
|
||||
dictType.setUpdateBy(ShiroUtils.getLoginName());
|
||||
DictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
|
||||
dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());
|
||||
return dictTypeMapper.updateDictType(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,11 +131,7 @@ public class DictTypeServiceImpl implements IDictTypeService
|
|||
@Override
|
||||
public String checkDictTypeUnique(DictType dict)
|
||||
{
|
||||
if (dict.getDictId() == null)
|
||||
{
|
||||
dict.setDictId(-1L);
|
||||
}
|
||||
Long dictId = dict.getDictId();
|
||||
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||
DictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||
if (StringUtils.isNotNull(dictType) && dictType.getDictId() != dictId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public interface IDictDataService
|
|||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<DictData> selectDictDataList(DictData dictData);
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
|
|
@ -26,7 +26,16 @@ public interface IDictDataService
|
|||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<DictData> selectDictDataByType(String dictType);
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictLabel(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
|
|
@ -34,7 +43,7 @@ public interface IDictDataService
|
|||
* @return 字典数据
|
||||
*/
|
||||
public DictData selectDictDataById(Long dictCode);
|
||||
|
||||
|
||||
/**
|
||||
* 通过字典ID删除字典数据信息
|
||||
*
|
||||
|
|
@ -52,11 +61,19 @@ public interface IDictDataService
|
|||
public int deleteDictDataByIds(String ids);
|
||||
|
||||
/**
|
||||
* 保存字典数据信息
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveDictData(DictData dictData);
|
||||
public int insertDictData(DictData dictData);
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictData(DictData dictData);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public interface IDictTypeService
|
|||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<DictType> selectDictTypeList(DictType dictType);
|
||||
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
|
|
@ -32,7 +32,7 @@ public interface IDictTypeService
|
|||
* @return 字典类型
|
||||
*/
|
||||
public DictType selectDictTypeById(Long dictId);
|
||||
|
||||
|
||||
/**
|
||||
* 通过字典ID删除字典信息
|
||||
*
|
||||
|
|
@ -41,22 +41,30 @@ public interface IDictTypeService
|
|||
*/
|
||||
public int deleteDictTypeById(Long dictId);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除字典类型
|
||||
*
|
||||
* @param ids 需要删除的数据
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public int deleteDictTypeByIds(String ids) throws Exception;
|
||||
public int deleteDictTypeByIds(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 保存字典类型信息
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveDictType(DictType dictType);
|
||||
public int insertDictType(DictType dictType);
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictType(DictType dictType);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -44,9 +44,9 @@ public class MenuController extends BaseController
|
|||
@RequiresPermissions("system:menu:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<Menu> list()
|
||||
public List<Menu> list(Menu menu)
|
||||
{
|
||||
List<Menu> menuList = menuService.selectMenuAll();
|
||||
List<Menu> menuList = menuService.selectMenuList(menu);
|
||||
return menuList;
|
||||
}
|
||||
|
||||
|
|
@ -67,33 +67,14 @@ public class MenuController extends BaseController
|
|||
{
|
||||
return error(1, "菜单已分配,不允许删除");
|
||||
}
|
||||
if (menuService.deleteMenuById(menuId) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:menu:edit")
|
||||
@GetMapping("/edit/{menuId}")
|
||||
public String edit(@PathVariable("menuId") Long menuId, Model model)
|
||||
{
|
||||
Menu menu = menuService.selectMenuById(menuId);
|
||||
model.addAttribute("menu", menu);
|
||||
return prefix + "/edit";
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:menu:add")
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, Model model)
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
Menu menu = null;
|
||||
if (0L != parentId)
|
||||
|
|
@ -106,24 +87,42 @@ public class MenuController extends BaseController
|
|||
menu.setMenuId(0L);
|
||||
menu.setMenuName("主目录");
|
||||
}
|
||||
model.addAttribute("menu", menu);
|
||||
mmap.put("menu", menu);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存菜单
|
||||
* 新增保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.SAVE)
|
||||
@RequiresPermissions("system:menu:save")
|
||||
@PostMapping("/save")
|
||||
@Log(title = "菜单管理", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:menu:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult save(Menu menu)
|
||||
public AjaxResult addSave(Menu menu)
|
||||
{
|
||||
if (menuService.saveMenu(menu) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@GetMapping("/edit/{menuId}")
|
||||
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:menu:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(Menu menu)
|
||||
{
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -176,9 +175,9 @@ public class MenuController extends BaseController
|
|||
* 选择菜单树
|
||||
*/
|
||||
@GetMapping("/selectMenuTree/{menuId}")
|
||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, Model model)
|
||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
model.addAttribute("treeName", menuService.selectMenuById(menuId).getMenuName());
|
||||
mmap.put("treeName", menuService.selectMenuById(menuId).getMenuName());
|
||||
return prefix + "/tree";
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public class Menu extends BaseEntity
|
|||
/** 类型:0目录,1菜单,2按钮 */
|
||||
private String menuType;
|
||||
/** 菜单状态:0显示,1隐藏 */
|
||||
private int visible;
|
||||
private Integer visible;
|
||||
/** 权限字符串 */
|
||||
private String perms;
|
||||
/** 菜单图标 */
|
||||
|
|
@ -105,12 +105,12 @@ public class Menu extends BaseEntity
|
|||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public int getVisible()
|
||||
public Integer getVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(int visible)
|
||||
public void setVisible(Integer visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@ public interface MenuMapper
|
|||
*/
|
||||
public List<String> selectMenuTree(Long roleId);
|
||||
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuList(Menu menu);
|
||||
|
||||
/**
|
||||
* 查询系统所有菜单
|
||||
*
|
||||
|
|
@ -57,7 +65,7 @@ public interface MenuMapper
|
|||
* @return 菜单信息
|
||||
*/
|
||||
public Menu selectMenuById(Long menuId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询菜单数量
|
||||
*
|
||||
|
|
@ -73,7 +81,7 @@ public interface MenuMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(Menu menu);
|
||||
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
|
|
@ -81,7 +89,7 @@ public interface MenuMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(Menu menu);
|
||||
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@ public interface IMenuService
|
|||
*/
|
||||
public List<Menu> selectMenusByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuList(Menu menu);
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
|
|
@ -93,12 +101,20 @@ public interface IMenuService
|
|||
public int selectCountRoleMenuByMenuId(Long menuId);
|
||||
|
||||
/**
|
||||
* 保存菜单信息
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveMenu(Menu menu);
|
||||
public int insertMenu(Menu menu);
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(Menu menu);
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.ruoyi.project.system.role.mapper.RoleMenuMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("menuService")
|
||||
@Service
|
||||
public class MenuServiceImpl implements IMenuService
|
||||
{
|
||||
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
||||
|
|
@ -49,6 +49,17 @@ public class MenuServiceImpl implements IMenuService
|
|||
return TreeUtils.getChildPerms(menus, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
* @return 所有菜单信息
|
||||
*/
|
||||
@Override
|
||||
public List<Menu> selectMenuList(Menu menu)
|
||||
{
|
||||
return menuMapper.selectMenuList(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
|
|
@ -233,27 +244,31 @@ public class MenuServiceImpl implements IMenuService
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存菜单信息
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveMenu(Menu menu)
|
||||
public int insertMenu(Menu menu)
|
||||
{
|
||||
Long menuId = menu.getMenuId();
|
||||
if (StringUtils.isNotNull(menuId))
|
||||
{
|
||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return menuMapper.updateMenu(menu);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return menuMapper.insertMenu(menu);
|
||||
}
|
||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return menuMapper.insertMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu(Menu menu)
|
||||
{
|
||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return menuMapper.updateMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -265,14 +280,9 @@ public class MenuServiceImpl implements IMenuService
|
|||
@Override
|
||||
public String checkMenuNameUnique(Menu menu)
|
||||
{
|
||||
if (menu.getMenuId() == null)
|
||||
{
|
||||
menu.setMenuId(-1L);
|
||||
}
|
||||
Long menuId = menu.getMenuId();
|
||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||
Menu info = menuMapper.checkMenuNameUnique(menu.getMenuName());
|
||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getMenuId())
|
||||
&& info.getMenuId().longValue() != menuId.longValue())
|
||||
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
|
||||
{
|
||||
return UserConstants.MENU_NAME_NOT_UNIQUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.project.system.notice.domain.Notice;
|
||||
import com.ruoyi.project.system.notice.service.INoticeService;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.notice.domain.Notice;
|
||||
import com.ruoyi.project.system.notice.service.INoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
|
|
@ -55,41 +55,44 @@ public class NoticeController extends BaseController
|
|||
/**
|
||||
* 新增公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", action = BusinessType.INSERT)
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", action = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Notice notice)
|
||||
{
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:edit")
|
||||
@Log(title = "通知公告", action = BusinessType.UPDATE)
|
||||
@GetMapping("/edit/{noticeId}")
|
||||
public String edit(@PathVariable("noticeId") Integer noticeId, Model model)
|
||||
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
||||
{
|
||||
Notice notice = noticeService.selectNoticeById(noticeId);
|
||||
model.addAttribute("notice", notice);
|
||||
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存公告
|
||||
* 修改保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:save")
|
||||
@Log(title = "通知公告", action = BusinessType.SAVE)
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("system:notice:edit")
|
||||
@Log(title = "通知公告", action = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult save(Notice notice)
|
||||
public AjaxResult editSave(Notice notice)
|
||||
{
|
||||
if (noticeService.saveNotice(notice) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,12 +104,7 @@ public class NoticeController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
int rows = noticeService.deleteNoticeByIds(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class Notice extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 公告ID */
|
||||
private Integer noticeId;
|
||||
private Long noticeId;
|
||||
/** 公告标题 */
|
||||
private String noticeTitle;
|
||||
/** 公告类型(1通知 2公告) */
|
||||
|
|
@ -22,16 +22,16 @@ public class Notice extends BaseEntity
|
|||
/** 公告状态(0正常 1关闭) */
|
||||
private String status;
|
||||
|
||||
public void setNoticeId(Integer noticeId)
|
||||
{
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
public Integer getNoticeId()
|
||||
public Long getNoticeId()
|
||||
{
|
||||
return noticeId;
|
||||
}
|
||||
|
||||
public void setNoticeId(Long noticeId)
|
||||
{
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
public void setNoticeTitle(String noticeTitle)
|
||||
{
|
||||
this.noticeTitle = noticeTitle;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface NoticeMapper
|
|||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
public Notice selectNoticeById(Integer noticeId);
|
||||
public Notice selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface INoticeService
|
|||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
public Notice selectNoticeById(Integer noticeId);
|
||||
public Notice selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
|
|
@ -42,14 +42,6 @@ public interface INoticeService
|
|||
*/
|
||||
public int updateNotice(Notice notice);
|
||||
|
||||
/**
|
||||
* 保存公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveNotice(Notice notice);
|
||||
|
||||
/**
|
||||
* 删除公告信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.ruoyi.project.system.notice.service;
|
|||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.system.notice.mapper.NoticeMapper;
|
||||
import com.ruoyi.project.system.notice.domain.Notice;
|
||||
|
|
@ -29,7 +28,7 @@ public class NoticeServiceImpl implements INoticeService
|
|||
* @return 公告信息
|
||||
*/
|
||||
@Override
|
||||
public Notice selectNoticeById(Integer noticeId)
|
||||
public Notice selectNoticeById(Long noticeId)
|
||||
{
|
||||
return noticeMapper.selectNoticeById(noticeId);
|
||||
}
|
||||
|
|
@ -55,6 +54,7 @@ public class NoticeServiceImpl implements INoticeService
|
|||
@Override
|
||||
public int insertNotice(Notice notice)
|
||||
{
|
||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||
return noticeMapper.insertNotice(notice);
|
||||
}
|
||||
|
||||
|
|
@ -67,35 +67,10 @@ public class NoticeServiceImpl implements INoticeService
|
|||
@Override
|
||||
public int updateNotice(Notice notice)
|
||||
{
|
||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return noticeMapper.updateNotice(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveNotice(Notice notice)
|
||||
{
|
||||
Integer noticeId = notice.getNoticeId();
|
||||
int rows = 0;
|
||||
if (StringUtils.isNotNull(noticeId))
|
||||
{
|
||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||
// 修改公告
|
||||
rows = noticeMapper.updateNotice(notice);
|
||||
}
|
||||
else
|
||||
{
|
||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||
// 新增公告
|
||||
rows = noticeMapper.insertNotice(notice);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告对象
|
||||
*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -75,8 +75,7 @@ public class PostController extends BaseController
|
|||
{
|
||||
try
|
||||
{
|
||||
postService.deletePostByIds(ids);
|
||||
return success();
|
||||
return toAjax(postService.deletePostByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -87,41 +86,44 @@ public class PostController extends BaseController
|
|||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@Log(title = "岗位管理", action = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:post:add")
|
||||
@GetMapping("/add")
|
||||
public String add(Model model)
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:add")
|
||||
@Log(title = "岗位管理", action = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Post post)
|
||||
{
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@Log(title = "岗位管理", action = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:post:edit")
|
||||
@GetMapping("/edit/{postId}")
|
||||
public String edit(@PathVariable("postId") Long postId, Model model)
|
||||
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
||||
{
|
||||
Post post = postService.selectPostById(postId);
|
||||
model.addAttribute("post", post);
|
||||
mmap.put("post", postService.selectPostById(postId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存岗位
|
||||
* 修改保存岗位
|
||||
*/
|
||||
@Log(title = "岗位管理", action = BusinessType.SAVE)
|
||||
@RequiresPermissions("system:post:save")
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("system:post:edit")
|
||||
@Log(title = "岗位管理", action = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult save(Post post)
|
||||
public AjaxResult editSave(Post post)
|
||||
{
|
||||
if (postService.savePost(post) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,23 +13,23 @@ public class Post extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 岗位序号 */
|
||||
@Excel(name = "岗位序号", column = "A")
|
||||
@Excel(name = "岗位序号")
|
||||
private Long postId;
|
||||
|
||||
/** 岗位编码 */
|
||||
@Excel(name = "岗位编码", column = "B")
|
||||
@Excel(name = "岗位编码")
|
||||
private String postCode;
|
||||
|
||||
/** 岗位名称 */
|
||||
@Excel(name = "岗位名称", column = "C")
|
||||
@Excel(name = "岗位名称")
|
||||
private String postName;
|
||||
|
||||
/** 岗位排序 */
|
||||
@Excel(name = "岗位排序", column = "D")
|
||||
@Excel(name = "岗位排序")
|
||||
private String postSort;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", column = "E")
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/** 用户是否存在此岗位标识 默认不存在 */
|
||||
|
|
|
|||
|
|
@ -42,14 +42,6 @@ public interface PostMapper
|
|||
*/
|
||||
public Post selectPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 通过岗位ID删除岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostById(Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -41,29 +41,31 @@ public interface IPostService
|
|||
*/
|
||||
public Post selectPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 通过岗位ID删除岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean deletePostById(Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void deletePostByIds(String ids) throws Exception;
|
||||
public int deletePostByIds(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 保存岗位信息
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int savePost(Post post);
|
||||
|
||||
public int insertPost(Post post);
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePost(Post post);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ package com.ruoyi.project.system.post.service;
|
|||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.system.post.domain.Post;
|
||||
import com.ruoyi.project.system.post.mapper.PostMapper;
|
||||
|
|
@ -16,7 +14,7 @@ import com.ruoyi.project.system.user.mapper.UserPostMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("postService")
|
||||
@Service
|
||||
public class PostServiceImpl implements IPostService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -85,18 +83,6 @@ public class PostServiceImpl implements IPostService
|
|||
return postMapper.selectPostById(postId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过岗位ID删除岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean deletePostById(Long postId)
|
||||
{
|
||||
return postMapper.deletePostById(postId) > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
|
|
@ -104,7 +90,7 @@ public class PostServiceImpl implements IPostService
|
|||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void deletePostByIds(String ids) throws Exception
|
||||
public int deletePostByIds(String ids) throws Exception
|
||||
{
|
||||
Long[] postIds = Convert.toLongArray(ids);
|
||||
for (Long postId : postIds)
|
||||
|
|
@ -115,33 +101,33 @@ public class PostServiceImpl implements IPostService
|
|||
throw new Exception(String.format("%1$s已分配,不能删除", post.getPostName()));
|
||||
}
|
||||
}
|
||||
postMapper.deletePostByIds(postIds);
|
||||
return postMapper.deletePostByIds(postIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存岗位信息
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int savePost(Post post)
|
||||
public int insertPost(Post post)
|
||||
{
|
||||
Long postId = post.getPostId();
|
||||
int count = 0;
|
||||
if (StringUtils.isNotNull(postId))
|
||||
{
|
||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||
// 修改岗位信息
|
||||
count = postMapper.updatePost(post);
|
||||
}
|
||||
else
|
||||
{
|
||||
post.setCreateBy(ShiroUtils.getLoginName());
|
||||
// 新增岗位信息
|
||||
count = postMapper.insertPost(post);
|
||||
}
|
||||
return count;
|
||||
post.setCreateBy(ShiroUtils.getLoginName());
|
||||
return postMapper.insertPost(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePost(Post post)
|
||||
{
|
||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return postMapper.updatePost(post);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -72,42 +72,47 @@ public class RoleController extends BaseController
|
|||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", action = BusinessType.INSERT)
|
||||
@GetMapping("/add")
|
||||
public String add(Model model)
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", action = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Role role)
|
||||
{
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", action = BusinessType.UPDATE)
|
||||
@GetMapping("/edit/{roleId}")
|
||||
public String edit(@PathVariable("roleId") Long roleId, Model model)
|
||||
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
Role role = roleService.selectRoleById(roleId);
|
||||
model.addAttribute("role", role);
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色
|
||||
* 修改保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:save")
|
||||
@Log(title = "角色管理", action = BusinessType.SAVE)
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", action = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult save(Role role)
|
||||
public AjaxResult editSave(Role role)
|
||||
{
|
||||
if (roleService.saveRole(role) > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(roleService.updateRole(role));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:remove")
|
||||
|
|
@ -118,8 +123,7 @@ public class RoleController extends BaseController
|
|||
{
|
||||
try
|
||||
{
|
||||
roleService.deleteRoleByIds(ids);
|
||||
return success();
|
||||
return toAjax(roleService.deleteRoleByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,23 +15,23 @@ public class Role extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 角色ID */
|
||||
@Excel(name = "角色序号", column = "A")
|
||||
@Excel(name = "角色序号")
|
||||
private Long roleId;
|
||||
|
||||
/** 角色名称 */
|
||||
@Excel(name = "角色名称", column = "B")
|
||||
@Excel(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/** 角色权限 */
|
||||
@Excel(name = "角色权限", column = "C")
|
||||
@Excel(name = "角色权限")
|
||||
private String roleKey;
|
||||
|
||||
/** 角色排序 */
|
||||
@Excel(name = "角色排序", column = "D")
|
||||
@Excel(name = "角色排序")
|
||||
private String roleSort;
|
||||
|
||||
/** 角色状态(0正常 1停用) */
|
||||
@Excel(name = "角色状态", column = "E")
|
||||
@Excel(name = "角色状态")
|
||||
private String status;
|
||||
|
||||
/** 用户是否存在此角色标识 默认不存在 */
|
||||
|
|
|
|||
|
|
@ -63,17 +63,27 @@ public interface IRoleService
|
|||
* 批量删除角色用户信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void deleteRoleByIds(String ids) throws Exception;
|
||||
public int deleteRoleByIds(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 保存角色信息
|
||||
* 新增保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveRole(Role role);
|
||||
|
||||
public int insertRole(Role role);
|
||||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRole(Role role);
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
|
|
@ -81,7 +91,7 @@ public interface IRoleService
|
|||
* @return 结果
|
||||
*/
|
||||
public String checkRoleNameUnique(Role role);
|
||||
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,269 +1,269 @@
|
|||
package com.ruoyi.project.system.role.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.project.system.role.domain.RoleDept;
|
||||
import com.ruoyi.project.system.role.mapper.RoleDeptMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import com.ruoyi.project.system.role.domain.RoleMenu;
|
||||
import com.ruoyi.project.system.role.mapper.RoleMapper;
|
||||
import com.ruoyi.project.system.role.mapper.RoleMenuMapper;
|
||||
import com.ruoyi.project.system.user.mapper.UserRoleMapper;
|
||||
|
||||
/**
|
||||
* 角色 业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("roleService")
|
||||
public class RoleServiceImpl implements IRoleService
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private UserRoleMapper userRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleDeptMapper roleDeptMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<Role> selectRoleList(Role role)
|
||||
{
|
||||
return roleMapper.selectRoleList(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectRoleKeys(Long userId)
|
||||
{
|
||||
List<Role> perms = roleMapper.selectRolesByUserId(userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (Role perm : perms)
|
||||
{
|
||||
if (StringUtils.isNotNull(perms))
|
||||
{
|
||||
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<Role> selectRolesByUserId(Long userId)
|
||||
{
|
||||
List<Role> userRoles = roleMapper.selectRolesByUserId(userId);
|
||||
List<Role> roles = roleMapper.selectRolesAll();
|
||||
for (Role role : roles)
|
||||
{
|
||||
for (Role userRole : userRoles)
|
||||
{
|
||||
if (role.getRoleId() == userRole.getRoleId())
|
||||
{
|
||||
role.setFlag(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<Role> selectRoleAll()
|
||||
{
|
||||
return roleMapper.selectRolesAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public Role selectRoleById(Long roleId)
|
||||
{
|
||||
return roleMapper.selectRoleById(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteRoleById(Long roleId)
|
||||
{
|
||||
return roleMapper.deleteRoleById(roleId) > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void deleteRoleByIds(String ids) throws Exception
|
||||
{
|
||||
Long[] roleIds = Convert.toLongArray(ids);
|
||||
for (Long roleId : roleIds)
|
||||
{
|
||||
Role role = selectRoleById(roleId);
|
||||
if (countUserRoleByRoleId(roleId) > 0)
|
||||
{
|
||||
throw new Exception(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
||||
}
|
||||
}
|
||||
roleMapper.deleteRoleByIds(roleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveRole(Role role)
|
||||
{
|
||||
Long roleId = role.getRoleId();
|
||||
if (StringUtils.isNotNull(roleId))
|
||||
{
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
// 修改角色信息
|
||||
roleMapper.updateRole(role);
|
||||
// 删除角色与菜单关联
|
||||
roleMenuMapper.deleteRoleMenuByRoleId(roleId);
|
||||
//删除角色与部门关联(数据权限)
|
||||
roleDeptMapper.deleteRoleDeptByRoleId(roleId);
|
||||
}
|
||||
else
|
||||
{
|
||||
role.setCreateBy(ShiroUtils.getLoginName());
|
||||
// 新增角色信息
|
||||
roleMapper.insertRole(role);
|
||||
}
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
//新增角色和部门信息(数据权限)
|
||||
insertRoleDept(role);
|
||||
return insertRoleMenu(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色菜单信息
|
||||
*
|
||||
* @param role 角色对象
|
||||
*/
|
||||
public int insertRoleMenu(Role role)
|
||||
{
|
||||
int rows = 1;
|
||||
// 新增用户与角色管理
|
||||
List<RoleMenu> list = new ArrayList<RoleMenu>();
|
||||
for (Long menuId : role.getMenuIds())
|
||||
{
|
||||
RoleMenu rm = new RoleMenu();
|
||||
rm.setRoleId(role.getRoleId());
|
||||
rm.setMenuId(menuId);
|
||||
list.add(rm);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
rows = roleMenuMapper.batchRoleMenu(list);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色部门信息(数据权限)
|
||||
*
|
||||
* @param role 角色对象
|
||||
*/
|
||||
public void insertRoleDept(Role role)
|
||||
{
|
||||
// 新增角色与部门(数据权限)管理
|
||||
List<RoleDept> list = new ArrayList<RoleDept>();
|
||||
for (Long deptId : role.getDeptIds())
|
||||
{
|
||||
RoleDept rd = new RoleDept();
|
||||
rd.setRoleId(role.getRoleId());
|
||||
rd.setDeptId(deptId);
|
||||
list.add(rd);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
roleDeptMapper.batchRoleDept(list);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleNameUnique(Role role)
|
||||
{
|
||||
if (role.getRoleId() == null)
|
||||
{
|
||||
role.setRoleId(-1L);
|
||||
}
|
||||
Long roleId = role.getRoleId();
|
||||
Role info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getRoleId()) && info.getRoleId() != roleId)
|
||||
{
|
||||
return UserConstants.ROLE_NAME_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.ROLE_NAME_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int countUserRoleByRoleId(Long roleId)
|
||||
{
|
||||
return userRoleMapper.countUserRoleByRoleId(roleId);
|
||||
}
|
||||
|
||||
}
|
||||
package com.ruoyi.project.system.role.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.project.system.role.domain.RoleDept;
|
||||
import com.ruoyi.project.system.role.mapper.RoleDeptMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import com.ruoyi.project.system.role.domain.RoleMenu;
|
||||
import com.ruoyi.project.system.role.mapper.RoleMapper;
|
||||
import com.ruoyi.project.system.role.mapper.RoleMenuMapper;
|
||||
import com.ruoyi.project.system.user.mapper.UserRoleMapper;
|
||||
|
||||
/**
|
||||
* 角色 业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl implements IRoleService
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private UserRoleMapper userRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleDeptMapper roleDeptMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<Role> selectRoleList(Role role)
|
||||
{
|
||||
return roleMapper.selectRoleList(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectRoleKeys(Long userId)
|
||||
{
|
||||
List<Role> perms = roleMapper.selectRolesByUserId(userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (Role perm : perms)
|
||||
{
|
||||
if (StringUtils.isNotNull(perms))
|
||||
{
|
||||
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<Role> selectRolesByUserId(Long userId)
|
||||
{
|
||||
List<Role> userRoles = roleMapper.selectRolesByUserId(userId);
|
||||
List<Role> roles = roleMapper.selectRolesAll();
|
||||
for (Role role : roles)
|
||||
{
|
||||
for (Role userRole : userRoles)
|
||||
{
|
||||
if (role.getRoleId() == userRole.getRoleId())
|
||||
{
|
||||
role.setFlag(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<Role> selectRoleAll()
|
||||
{
|
||||
return roleMapper.selectRolesAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public Role selectRoleById(Long roleId)
|
||||
{
|
||||
return roleMapper.selectRoleById(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteRoleById(Long roleId)
|
||||
{
|
||||
return roleMapper.deleteRoleById(roleId) > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public int deleteRoleByIds(String ids) throws Exception
|
||||
{
|
||||
Long[] roleIds = Convert.toLongArray(ids);
|
||||
for (Long roleId : roleIds)
|
||||
{
|
||||
Role role = selectRoleById(roleId);
|
||||
if (countUserRoleByRoleId(roleId) > 0)
|
||||
{
|
||||
throw new Exception(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
||||
}
|
||||
}
|
||||
return roleMapper.deleteRoleByIds(roleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRole(Role role)
|
||||
{
|
||||
role.setCreateBy(ShiroUtils.getLoginName());
|
||||
// 新增角色信息
|
||||
roleMapper.insertRole(role);
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return insertRoleMenu(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRole(Role role)
|
||||
{
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
// 修改角色信息
|
||||
roleMapper.updateRole(role);
|
||||
// 删除角色与菜单关联
|
||||
roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
//新增角色和部门信息(数据权限)
|
||||
insertRoleDept(role);
|
||||
return insertRoleMenu(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色菜单信息
|
||||
*
|
||||
* @param role 角色对象
|
||||
*/
|
||||
public int insertRoleMenu(Role role)
|
||||
{
|
||||
int rows = 1;
|
||||
// 新增用户与角色管理
|
||||
List<RoleMenu> list = new ArrayList<RoleMenu>();
|
||||
for (Long menuId : role.getMenuIds())
|
||||
{
|
||||
RoleMenu rm = new RoleMenu();
|
||||
rm.setRoleId(role.getRoleId());
|
||||
rm.setMenuId(menuId);
|
||||
list.add(rm);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
rows = roleMenuMapper.batchRoleMenu(list);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色部门信息(数据权限)
|
||||
*
|
||||
* @param role 角色对象
|
||||
*/
|
||||
public void insertRoleDept(Role role)
|
||||
{
|
||||
// 新增角色与部门(数据权限)管理
|
||||
List<RoleDept> list = new ArrayList<RoleDept>();
|
||||
for (Long deptId : role.getDeptIds())
|
||||
{
|
||||
RoleDept rd = new RoleDept();
|
||||
rd.setRoleId(role.getRoleId());
|
||||
rd.setDeptId(deptId);
|
||||
list.add(rd);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
roleDeptMapper.batchRoleDept(list);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleNameUnique(Role role)
|
||||
{
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
Role info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
||||
{
|
||||
return UserConstants.ROLE_NAME_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.ROLE_NAME_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int countUserRoleByRoleId(Long roleId)
|
||||
{
|
||||
return userRoleMapper.countUserRoleByRoleId(roleId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.ruoyi.project.system.user.controller;
|
|||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import com.ruoyi.framework.config.RuoYiConfig;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
|
|
@ -27,23 +27,23 @@ public class IndexController extends BaseController
|
|||
|
||||
// 系统首页
|
||||
@GetMapping("/index")
|
||||
public String index(Model model)
|
||||
public String index(ModelMap mmap)
|
||||
{
|
||||
// 取身份信息
|
||||
User user = getUser();
|
||||
// 根据用户id取出菜单
|
||||
List<Menu> menus = menuService.selectMenusByUserId(user.getUserId());
|
||||
model.addAttribute("menus", menus);
|
||||
model.addAttribute("user", user);
|
||||
model.addAttribute("copyrightYear", ruoYiConfig.getCopyrightYear());
|
||||
mmap.put("menus", menus);
|
||||
mmap.put("user", user);
|
||||
mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
|
||||
return "index";
|
||||
}
|
||||
|
||||
// 系统介绍
|
||||
@GetMapping("/system/main")
|
||||
public String main(Model model)
|
||||
public String main(ModelMap mmap)
|
||||
{
|
||||
model.addAttribute("version", ruoYiConfig.getVersion());
|
||||
mmap.put("version", ruoYiConfig.getVersion());
|
||||
return "main";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import org.apache.shiro.authc.AuthenticationException;
|
|||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
|
@ -26,7 +25,7 @@ public class LoginController extends BaseController
|
|||
{
|
||||
|
||||
@GetMapping("/login")
|
||||
public String login(HttpServletRequest request, HttpServletResponse response, Model model)
|
||||
public String login(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
// 如果是Ajax请求,返回Json字符串。
|
||||
if (ServletUtils.isAjaxRequest((HttpServletRequest) request))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -13,11 +13,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.utils.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.service.DictService;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
import com.ruoyi.project.system.user.service.IUserService;
|
||||
|
||||
|
|
@ -37,27 +38,20 @@ public class ProfileController extends BaseController
|
|||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Autowired
|
||||
private DictService dict;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping()
|
||||
public String profile(Model model)
|
||||
public String profile(ModelMap mmap)
|
||||
{
|
||||
User user = getUser();
|
||||
String sex = user.getSex();
|
||||
if ("0".equals(sex))
|
||||
{
|
||||
user.setSex("性别:男");
|
||||
}
|
||||
else if ("1".equals(sex))
|
||||
{
|
||||
user.setSex("性别:女");
|
||||
}
|
||||
String roleGroup = userService.selectUserRoleGroup(user.getUserId());
|
||||
String postGroup = userService.selectUserPostGroup(user.getUserId());
|
||||
model.addAttribute("user", user);
|
||||
model.addAttribute("roleGroup", roleGroup);
|
||||
model.addAttribute("postGroup", postGroup);
|
||||
user.setSex(dict.getLabel("sys_user_sex", user.getSex()));
|
||||
mmap.put("user", user);
|
||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||
return prefix + "/profile";
|
||||
}
|
||||
|
||||
|
|
@ -75,10 +69,9 @@ public class ProfileController extends BaseController
|
|||
}
|
||||
|
||||
@GetMapping("/resetPwd/{userId}")
|
||||
public String resetPwd(@PathVariable("userId") Long userId, Model model)
|
||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
User user = userService.selectUserById(userId);
|
||||
model.addAttribute("user", user);
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
|
|
@ -99,36 +92,32 @@ public class ProfileController extends BaseController
|
|||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", action = BusinessType.UPDATE)
|
||||
@GetMapping("/edit/{userId}")
|
||||
public String edit(@PathVariable("userId") Long userId, Model model)
|
||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
User user = userService.selectUserById(userId);
|
||||
model.addAttribute("user", user);
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
*/
|
||||
@Log(title = "个人信息", action = BusinessType.UPDATE)
|
||||
@GetMapping("/avatar/{userId}")
|
||||
public String avatar(@PathVariable("userId") Long userId, Model model)
|
||||
public String avatar(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
User user = userService.selectUserById(userId);
|
||||
model.addAttribute("user", user);
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
return prefix + "/avatar";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", action = BusinessType.SAVE)
|
||||
@Log(title = "个人信息", action = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public AjaxResult update(User user)
|
||||
{
|
||||
if (userService.updateUser(user) > 0)
|
||||
if (userService.updateUserInfo(user) > 0)
|
||||
{
|
||||
setUser(userService.selectUserById(user.getUserId()));
|
||||
return success();
|
||||
|
|
@ -139,7 +128,7 @@ public class ProfileController extends BaseController
|
|||
/**
|
||||
* 保存头像
|
||||
*/
|
||||
@Log(title = "个人信息", action = BusinessType.SAVE)
|
||||
@Log(title = "个人信息", action = BusinessType.UPDATE)
|
||||
@PostMapping("/updateAvatar")
|
||||
@ResponseBody
|
||||
public AjaxResult updateAvatar(User user, @RequestParam("avatarfile") MultipartFile file)
|
||||
|
|
@ -150,7 +139,7 @@ public class ProfileController extends BaseController
|
|||
{
|
||||
String avatar = FileUploadUtils.upload(file);
|
||||
user.setAvatar(avatar);
|
||||
if (userService.updateUser(user) > 0)
|
||||
if (userService.updateUserInfo(user) > 0)
|
||||
{
|
||||
setUser(userService.selectUserById(user.getUserId()));
|
||||
return success();
|
||||
|
|
@ -160,7 +149,7 @@ public class ProfileController extends BaseController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("updateAvatar failed!", e);
|
||||
log.error("修改头像失败!", e);
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,16 @@
|
|||
package com.ruoyi.project.system.user.controller;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
|
|
@ -7,19 +18,10 @@ import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
|||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.post.domain.Post;
|
||||
import com.ruoyi.project.system.post.service.IPostService;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import com.ruoyi.project.system.role.service.IRoleService;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
import com.ruoyi.project.system.user.service.IUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
|
|
@ -75,60 +77,79 @@ public class UserController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
mmap.put("roles", roleService.selectRoleAll());
|
||||
mmap.put("posts", postService.selectPostAll());
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", action = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(User user)
|
||||
{
|
||||
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
|
||||
{
|
||||
return error("不允许修改超级管理员用户");
|
||||
}
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", action = BusinessType.UPDATE)
|
||||
@GetMapping("/edit/{userId}")
|
||||
public String edit(@PathVariable("userId") Long userId, Model model)
|
||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
User user = userService.selectUserById(userId);
|
||||
List<Role> roles = roleService.selectRolesByUserId(userId);
|
||||
List<Post> posts = postService.selectPostsByUserId(userId);
|
||||
model.addAttribute("roles", roles);
|
||||
model.addAttribute("posts", posts);
|
||||
model.addAttribute("user", user);
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
mmap.put("roles", roleService.selectRolesByUserId(userId));
|
||||
mmap.put("posts", postService.selectPostsByUserId(userId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* 修改保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", action = BusinessType.INSERT)
|
||||
@GetMapping("/add")
|
||||
public String add(Model model)
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", action = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(User user)
|
||||
{
|
||||
List<Role> roles = roleService.selectRoleAll();
|
||||
List<Post> posts = postService.selectPostAll();
|
||||
model.addAttribute("roles", roles);
|
||||
model.addAttribute("posts", posts);
|
||||
return prefix + "/add";
|
||||
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
|
||||
{
|
||||
return error("不允许修改超级管理员用户");
|
||||
}
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:resetPwd")
|
||||
@Log(title = "重置密码", action = BusinessType.UPDATE)
|
||||
@GetMapping("/resetPwd/{userId}")
|
||||
public String resetPwd(@PathVariable("userId") Long userId, Model model)
|
||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
User user = userService.selectUserById(userId);
|
||||
model.addAttribute("user", user);
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:resetPwd")
|
||||
@Log(title = "重置密码", action = BusinessType.SAVE)
|
||||
@Log(title = "重置密码", action = BusinessType.UPDATE)
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public AjaxResult resetPwd(User user)
|
||||
{
|
||||
int rows = userService.resetUserPwd(user);
|
||||
if (rows > 0)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
return toAjax(userService.resetUserPwd(user));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:remove")
|
||||
|
|
@ -139,8 +160,7 @@ public class UserController extends BaseController
|
|||
{
|
||||
try
|
||||
{
|
||||
userService.deleteUserByIds(ids);
|
||||
return success();
|
||||
return toAjax(userService.deleteUserByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -148,23 +168,6 @@ public class UserController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:save")
|
||||
@Log(title = "用户管理", action = BusinessType.SAVE)
|
||||
@PostMapping("/save")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult save(User user)
|
||||
{
|
||||
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
|
||||
{
|
||||
return error("不允许修改超级管理员用户");
|
||||
}
|
||||
return userService.saveUser(user) > 0 ? success() : error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户名
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class User extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户序号", column = "A")
|
||||
@Excel(name = "用户序号")
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
|
|
@ -28,23 +28,23 @@ public class User extends BaseEntity
|
|||
private Long parentId;
|
||||
|
||||
/** 登录名称 */
|
||||
@Excel(name = "登录名称", column = "B")
|
||||
@Excel(name = "登录名称")
|
||||
private String loginName;
|
||||
|
||||
/** 用户名称 */
|
||||
@Excel(name = "用户名称", column = "C")
|
||||
@Excel(name = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱", column = "D")
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/** 手机号码 */
|
||||
@Excel(name = "手机号码", column = "E")
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/** 用户性别 */
|
||||
@Excel(name = "用户性别", column = "F")
|
||||
@Excel(name = "用户性别")
|
||||
private String sex;
|
||||
|
||||
/** 用户头像 */
|
||||
|
|
@ -57,18 +57,18 @@ public class User extends BaseEntity
|
|||
private String salt;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态", column = "G")
|
||||
@Excel(name = "帐号状态")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 最后登陆IP */
|
||||
@Excel(name = "最后登陆IP", column = "H")
|
||||
@Excel(name = "最后登陆IP")
|
||||
private String loginIp;
|
||||
|
||||
/** 最后登陆时间 */
|
||||
@Excel(name = "最后登陆时间", column = "I")
|
||||
@Excel(name = "最后登陆时间")
|
||||
private Date loginDate;
|
||||
|
||||
/** 部门对象 */
|
||||
|
|
|
|||
|
|
@ -107,12 +107,4 @@ public interface UserMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public User checkEmailUnique(String email);
|
||||
|
||||
/**
|
||||
* 批量添加用户
|
||||
*
|
||||
* @param userList
|
||||
* @return
|
||||
*/
|
||||
public int batchAddUser(List<User> userList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,10 @@ public interface IUserService
|
|||
* 批量删除用户信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void deleteUserByIds(String ids) throws Exception;
|
||||
public int deleteUserByIds(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
|
|
@ -72,16 +74,24 @@ public interface IUserService
|
|||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveUser(User user);
|
||||
public int insertUser(User user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* 保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser(User user);
|
||||
|
||||
/**
|
||||
* 修改用户详细信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserInfo(User user);
|
||||
|
||||
/**
|
||||
* 修改用户密码信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.ruoyi.project.system.user.mapper.UserRoleMapper;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("userService")
|
||||
@Service
|
||||
public class UserServiceImpl implements IUserService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -130,7 +130,7 @@ public class UserServiceImpl implements IUserService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserByIds(String ids) throws Exception
|
||||
public int deleteUserByIds(String ids) throws Exception
|
||||
{
|
||||
Long[] userIds = Convert.toLongArray(ids);
|
||||
for (Long userId : userIds)
|
||||
|
|
@ -140,58 +140,60 @@ public class UserServiceImpl implements IUserService
|
|||
throw new Exception("不允许删除超级管理员用户");
|
||||
}
|
||||
}
|
||||
userMapper.deleteUserByIds(userIds);
|
||||
return userMapper.deleteUserByIds(userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
* 新增保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveUser(User user)
|
||||
public int insertUser(User user)
|
||||
{
|
||||
int count = 0;
|
||||
Long userId = user.getUserId();
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||
// 修改用户信息
|
||||
count = updateUser(user);
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
// 删除用户与岗位关联
|
||||
userPostMapper.deleteUserPostByUserId(userId);
|
||||
// 新增用户与岗位管理
|
||||
insertUserPost(user);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
user.randomSalt();
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
user.setCreateBy(ShiroUtils.getLoginName());
|
||||
// 新增用户信息
|
||||
count = userMapper.insertUser(user);
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
}
|
||||
return count;
|
||||
user.randomSalt();
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
user.setCreateBy(ShiroUtils.getLoginName());
|
||||
// 新增用户信息
|
||||
int rows = userMapper.insertUser(user);
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* 修改保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUser(User user)
|
||||
{
|
||||
Long userId = user.getUserId();
|
||||
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
// 删除用户与岗位关联
|
||||
userPostMapper.deleteUserPostByUserId(userId);
|
||||
// 新增用户与岗位管理
|
||||
insertUserPost(user);
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户个人详细信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserInfo(User user)
|
||||
{
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
|
@ -207,7 +209,7 @@ public class UserServiceImpl implements IUserService
|
|||
{
|
||||
user.randomSalt();
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
return updateUser(user);
|
||||
return updateUserInfo(user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -280,14 +282,9 @@ public class UserServiceImpl implements IUserService
|
|||
@Override
|
||||
public String checkPhoneUnique(User user)
|
||||
{
|
||||
if (user.getUserId() == null)
|
||||
{
|
||||
user.setUserId(-1L);
|
||||
}
|
||||
Long userId = user.getUserId();
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
User info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getUserId())
|
||||
&& info.getUserId().longValue() != userId.longValue())
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
||||
{
|
||||
return UserConstants.USER_PHONE_NOT_UNIQUE;
|
||||
}
|
||||
|
|
@ -303,14 +300,9 @@ public class UserServiceImpl implements IUserService
|
|||
@Override
|
||||
public String checkEmailUnique(User user)
|
||||
{
|
||||
if (user.getUserId() == null)
|
||||
{
|
||||
user.setUserId(-1L);
|
||||
}
|
||||
Long userId = user.getUserId();
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
User info = userMapper.checkEmailUnique(user.getEmail());
|
||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getUserId())
|
||||
&& info.getUserId().longValue() != userId.longValue())
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
||||
{
|
||||
return UserConstants.USER_EMAIL_NOT_UNIQUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import com.ruoyi.project.tool.gen.util.VelocityInitializer;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("genService")
|
||||
@Service
|
||||
public class GenServiceImpl implements IGenService
|
||||
{
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ import com.ruoyi.project.tool.gen.domain.TableInfo;
|
|||
public class GenUtils
|
||||
{
|
||||
/** 项目空间路径 */
|
||||
private static final String projectPath = "main/java/com/ruoyi/project";
|
||||
private static final String PROJECT_PATH = "main/java/com/ruoyi/project";
|
||||
|
||||
/** mybatis空间路径 */
|
||||
private static final String myBatisPath = "main/resources/mybatis";
|
||||
private static final String MYBATIS_PATH = "main/resources/mybatis";
|
||||
|
||||
/** html空间路径 */
|
||||
private static final String templatesPath = "main/resources/templates";
|
||||
private static final String TEMPLATES_PATH = "main/resources/templates";
|
||||
|
||||
/**
|
||||
* 设置列信息
|
||||
|
|
@ -119,9 +119,9 @@ public class GenUtils
|
|||
String classname = table.getClassname();
|
||||
// 大写类名
|
||||
String className = table.getClassName();
|
||||
String javaPath = projectPath + "/" + moduleName + "/";
|
||||
String mybatisPath = myBatisPath + "/" + moduleName + "/" + className;
|
||||
String htmlPath = templatesPath + "/" + moduleName + "/" + classname;
|
||||
String javaPath = PROJECT_PATH + "/" + moduleName + "/";
|
||||
String mybatisPath = MYBATIS_PATH + "/" + moduleName + "/" + className;
|
||||
String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + classname;
|
||||
|
||||
if (StringUtils.isNotEmpty(classname))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
# 项目名称、版本、版权年份
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
#名称
|
||||
name: RuoYi
|
||||
version: 2.1.0
|
||||
#版本
|
||||
version: 2.2.0
|
||||
#版权年份
|
||||
copyrightYear: 2018
|
||||
#头像上传路径
|
||||
profile: D:/profile/
|
||||
|
||||
#开发环境配置
|
||||
server:
|
||||
#端口
|
||||
|
|
@ -41,7 +44,6 @@ spring:
|
|||
multipart:
|
||||
max-file-size: 30MB
|
||||
max-request-size: 30MB
|
||||
|
||||
devtools:
|
||||
restart:
|
||||
#禁用devtools模块的热部署功能
|
||||
|
|
|
|||
|
|
@ -23,47 +23,5 @@
|
|||
statistics="true">
|
||||
</cache>
|
||||
|
||||
<!-- 系统用户缓存 没必要过期 -->
|
||||
<cache name="sys-userCache"
|
||||
maxEntriesLocalHeap="10000"
|
||||
overflowToDisk="false"
|
||||
eternal="false"
|
||||
diskPersistent="false"
|
||||
timeToLiveSeconds="0"
|
||||
timeToIdleSeconds="0"
|
||||
statistics="true"/>
|
||||
|
||||
<!-- 系统用户授权缓存 没必要过期 -->
|
||||
<cache name="sys-authCache"
|
||||
maxEntriesLocalHeap="10000"
|
||||
overflowToDisk="false"
|
||||
eternal="false"
|
||||
diskPersistent="false"
|
||||
timeToLiveSeconds="0"
|
||||
timeToIdleSeconds="0"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
statistics="true"/>
|
||||
|
||||
<!-- 菜单缓存 没必要过期 -->
|
||||
<cache name="sys-menuCache"
|
||||
maxEntriesLocalHeap="10000"
|
||||
overflowToDisk="false"
|
||||
eternal="false"
|
||||
diskPersistent="false"
|
||||
timeToLiveSeconds="0"
|
||||
timeToIdleSeconds="0"
|
||||
statistics="true"/>
|
||||
|
||||
|
||||
<!-- shiro 会话缓存 不需要序列化到磁盘 此处我们放到db中了 此处cache没必要过期 因为我们存放到db了 -->
|
||||
<cache name="shiro-activeSessionCache"
|
||||
maxEntriesLocalHeap="10000"
|
||||
overflowToDisk="false"
|
||||
eternal="false"
|
||||
diskPersistent="false"
|
||||
timeToLiveSeconds="0"
|
||||
timeToIdleSeconds="0"
|
||||
statistics="true"/>
|
||||
|
||||
</ehcache>
|
||||
|
||||
|
|
@ -9,15 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="jobName" column="job_name" />
|
||||
<result property="jobGroup" column="job_group" />
|
||||
<result property="methodName" column="method_name" />
|
||||
<result property="params" column="params" />
|
||||
<result property="methodParams" column="method_params" />
|
||||
<result property="jobMessage" column="job_message" />
|
||||
<result property="status" column="status" />
|
||||
<result property="status" column="status" />
|
||||
<result property="exceptionInfo" column="exception_info" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectJobLogVo">
|
||||
select job_log_id, job_name, job_group, method_name, params, job_message, status, exception_info, create_time from sys_job_log
|
||||
select job_log_id, job_name, job_group, method_name, method_params, job_message, status, exception_info, create_time from sys_job_log
|
||||
</sql>
|
||||
|
||||
<select id="selectJobLogList" parameterType="JobLog" resultMap="JobLogResult">
|
||||
|
|
@ -32,6 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="methodName != null and methodName != ''">
|
||||
AND method_name like concat('%', #{methodName}, '%')
|
||||
</if>
|
||||
<if test="params != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -61,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jobName != null and jobName != ''">job_name,</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
|
||||
<if test="methodName != null and methodName != ''">method_name,</if>
|
||||
<if test="params != null and params != ''">params,</if>
|
||||
<if test="methodParams != null and methodParams != ''">method_params,</if>
|
||||
<if test="jobMessage != null and jobMessage != ''">job_message,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
|
||||
|
|
@ -71,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jobName != null and jobName != ''">#{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
|
||||
<if test="methodName != null and methodName != ''">#{methodName},</if>
|
||||
<if test="params != null and params != ''">#{params},</if>
|
||||
<if test="methodParams != null and methodParams != ''">#{methodParams},</if>
|
||||
<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="jobName" column="job_name" />
|
||||
<result property="jobGroup" column="job_group" />
|
||||
<result property="methodName" column="method_name" />
|
||||
<result property="params" column="params" />
|
||||
<result property="methodParams" column="method_params" />
|
||||
<result property="cronExpression" column="cron_expression" />
|
||||
<result property="misfirePolicy" column="misfire_policy" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
|
@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectJobVo">
|
||||
select job_id, job_name, job_group, method_name, params, cron_expression, status, create_by, create_time, remark from sys_job
|
||||
select job_id, job_name, job_group, method_name, method_params, cron_expression, misfire_policy, status, create_by, create_time, remark from sys_job
|
||||
</sql>
|
||||
|
||||
<select id="selectJobList" parameterType="Job" resultMap="JobResult">
|
||||
|
|
@ -64,25 +65,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
|
||||
<if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
|
||||
<if test="params != null and params != ''">params = #{params},</if>
|
||||
<if test="methodParams != null and methodParams != ''">method_params = #{methodParams},</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
|
||||
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
|
||||
<if test="status !=null">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="jobId != null">and job_id = #{jobId}</if>
|
||||
where job_id = #{jobId}
|
||||
</update>
|
||||
|
||||
<insert id="insertJob" parameterType="Post" useGeneratedKeys="true" keyProperty="jobId">
|
||||
<insert id="insertJob" parameterType="Job" useGeneratedKeys="true" keyProperty="jobId">
|
||||
insert into sys_job(
|
||||
<if test="jobId != null and jobId != 0">job_id,</if>
|
||||
<if test="jobName != null and jobName != ''">job_name,</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
|
||||
<if test="methodName != null and methodName != ''">method_name,</if>
|
||||
<if test="params != null and params != ''">params,</if>
|
||||
<if test="methodParams != null and methodParams != ''">method_params,</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
|
||||
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
|
|
@ -92,8 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jobName != null and jobName != ''">#{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
|
||||
<if test="methodName != null and methodName != ''">#{methodName},</if>
|
||||
<if test="params != null and params != ''">#{params},</if>
|
||||
<if test="methodParams != null and methodParams != ''">#{method_params},</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
|
||||
<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="loginName != null and loginName != ''">
|
||||
AND login_name like concat('%', #{loginName}, '%')
|
||||
</if>
|
||||
<if test="params != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(login_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(login_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue