Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fe158fa94 | ||
|
|
a4c1912ab2 | ||
|
|
62151b0c95 | ||
|
|
32ab3189ac | ||
|
|
c6d3e8235f | ||
|
|
4472dd7b49 | ||
|
|
399b20f903 | ||
|
|
4516d2ef93 | ||
|
|
27881c8635 | ||
|
|
f16e013812 | ||
|
|
8cf0c3e806 | ||
|
|
14a77a8435 | ||
|
|
eea1061772 | ||
|
|
1a5e3606d2 | ||
|
|
58f21c0350 | ||
|
|
7c99e72067 | ||
|
|
372c198d13 | ||
|
|
9631720a38 | ||
|
|
e5c9aca10f | ||
|
|
f096e03342 | ||
|
|
cac5130504 | ||
|
|
43b7bfa28d | ||
|
|
e93e0c4cb7 | ||
|
|
f9c82e1f14 | ||
|
|
fd75ee49d6 | ||
|
|
f67d7179cd | ||
|
|
e8eaeadbb0 | ||
|
|
bb7799c1aa | ||
|
|
07ffcbf6eb | ||
|
|
d7dc50a157 | ||
|
|
b0f9dc804a | ||
|
|
b7c95affc8 | ||
|
|
6bf77f610e | ||
|
|
c42f2d9f3a | ||
|
|
79a4f8b30b | ||
|
|
54c1079cf4 | ||
|
|
d394307901 | ||
|
|
3d37041193 | ||
|
|
b438c7c1ad | ||
|
|
db8f960b0d | ||
|
|
127b532825 | ||
|
|
92fffea429 | ||
|
|
32975b3ed7 | ||
|
|
6d714b0008 | ||
|
|
adedb39132 | ||
|
|
fc862841ad | ||
|
|
f6798b90bf | ||
|
|
468281ee06 | ||
|
|
8467b7e62c | ||
|
|
336faf6feb | ||
|
|
982ce06cde | ||
|
|
c7595fe5b6 | ||
|
|
a647e22dd3 | ||
|
|
8b4d3cecb4 | ||
|
|
afea140046 | ||
|
|
f1bb10606b | ||
|
|
95b5b12c4d | ||
|
|
06e25ac4a3 | ||
|
|
7d74dfd0f4 | ||
|
|
f6f8c0b03a | ||
|
|
2401c5552e | ||
|
|
743caa2911 | ||
|
|
9d47a4c6cc | ||
|
|
6dc56c6e8d | ||
|
|
470b234528 | ||
|
|
0047773f24 | ||
|
|
dbfcd39a7e | ||
|
|
28dd8a0dee | ||
|
|
7d733d868c | ||
|
|
d5d7cd6592 | ||
|
|
4d9c611a7e | ||
|
|
43bde8362b | ||
|
|
791c767aed | ||
|
|
f65728611a | ||
|
|
67bd4d3141 | ||
|
|
f22af6d423 | ||
|
|
f081c89e73 | ||
|
|
0fe4b96933 | ||
|
|
c42b3d8648 | ||
|
|
9f8cb8759b | ||
|
|
cb7af9a547 | ||
|
|
49ef4086fa | ||
|
|
19b8317cb3 | ||
|
|
ef5687b71c | ||
|
|
58b4a50fdb | ||
|
|
535f2fafc4 |
@@ -4,16 +4,20 @@
|
||||
|
||||
性别男,若依是女儿的名字。
|
||||
|
||||
若依基于hplus和inspinia两套后台系统摸版开发。有需要可自行到群内下载。
|
||||
若依基于hplus和inspinia两套后台系统模板开发。有需要可自行到群内下载。
|
||||
|
||||
http://www.zi-han.net/theme/hplus
|
||||
|
||||
http://webapplayers.com/inspinia_admin-v2.7.1
|
||||
http://webapplayers.com/inspinia_admin-v2.7.1
|
||||
|
||||
阿里云优惠活动(2CPU 4GRAM 1M带宽 40G高效云盘):https://promotion.aliyun.com/ntms/act/vm/aliyun-group/buy.html?group=BphATfDhsQ
|
||||
|
||||
云产品通用1000元代金券,可叠加官网常规优惠使用 :https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=brki8iof
|
||||
|
||||
## 内置功能
|
||||
|
||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现。
|
||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
|
||||
3. 岗位管理:配置系统用户所属担任职务。
|
||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
|
||||
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
|
||||
@@ -38,31 +42,27 @@ http://webapplayers.com/inspinia_admin-v2.7.1
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/25b5e333768d013d45a990c152dbe4d9d6e.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/55f92435662e6a799e9daac8a74fd46a1eb.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132411_4c5I_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/e05d6184cde91f7bb74736a11727ac863fe.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/2fc14293b0c7a2a938441bb89b3edde98c1.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132436_rRBh_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132442_umjM_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/1ffdb33f4ae588dd77d7b29779154fd555e.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/302762bb406c43ce7680637a793b1f67820.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132449_OtY8_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132454_4Evz_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/c3eab05442a6ffe87fd63cb1d4855b11d39.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/2b6483aa20459f9bfb9911d614ef8ac3c97.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132520_Zzkj_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132539_5bJe_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/0aff434b32d6012dbf890c7f4603651c917.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/1f1f079c084d60c41ebfdd964d32b956efa.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132548_ne4U_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132557_Fab4_1438828.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/3cc7a4a5885978c1799d874d7727cfcf7a0.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/a323d288bf509b7180b1538fe2193d325b3.jpg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/09cd252f86ce338745de291a78b271313be.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/10b12c7e673fee5ac3254f246354a4805b7.jpg"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132617_MLmV_1438828.png"/></td>
|
||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132626_3iBs_1438828.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
Binary file not shown.
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>RuoYi</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>2.4.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>RuoYi</name>
|
||||
@@ -14,7 +14,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.3.RELEASE</version>
|
||||
<version>2.0.4.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
@@ -86,12 +86,6 @@
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- thymeleaf网页解析 -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.nekohtml</groupId>
|
||||
<artifactId>nekohtml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
@@ -114,10 +108,10 @@
|
||||
|
||||
<!--阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--常用工具类 -->
|
||||
<dependency>
|
||||
|
||||
+2
-2
@@ -1032,7 +1032,7 @@ varchar(50) default ''
|
||||
<text x='792' y='528' text-anchor='end' class='colType'>t</text> <a xlink:href='#sys_user_online.status'><text id='ry.sys_user_online.status' x='678' y='546'>status</text><title>status
|
||||
varchar(10) default ''
|
||||
在线状态on_line在线off_line离线</title></a>
|
||||
<text x='792' y='543' text-anchor='end' class='colType'>t</text> <use id='nn' x='662' y='552' xlink:href='#nn'/><a xlink:href='#sys_user_online.start_timestsamp'><text id='ry.sys_user_online.start_timestsamp' x='678' y='561'>start_timestsamp</text><title>start_timestsamp
|
||||
<text x='792' y='543' text-anchor='end' class='colType'>t</text> <use id='nn' x='662' y='552' xlink:href='#nn'/><a xlink:href='#sys_user_online.start_timestamp'><text id='ry.sys_user_online.start_timestamp' x='678' y='561'>start_timestamp</text><title>start_timestamp
|
||||
* timestamp default CURRENT_TIMESTAMP
|
||||
session创建时间</title></a>
|
||||
<text x='792' y='558' text-anchor='end' class='colType'>d</text> <use id='nn' x='662' y='567' xlink:href='#nn'/><a xlink:href='#sys_user_online.last_access_time'><text id='ry.sys_user_online.last_access_time' x='678' y='576'>last_access_time</text><title>last_access_time
|
||||
@@ -2811,7 +2811,7 @@ varchar(1)</title></a>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>*</td>
|
||||
<td><a name='sys_user_online.start_timestsamp'>start_timestsamp</a></td>
|
||||
<td><a name='sys_user_online.start_timestamp'>start_timestsamp</a></td>
|
||||
<td> timestamp DEFAULT CURRENT_TIMESTAMP </td>
|
||||
<td> session创建时间 </td>
|
||||
</tr>
|
||||
|
||||
+2
-2
@@ -3655,8 +3655,8 @@ TableComment 0 新宋体,8,N</a:FontList>
|
||||
</o:Column>
|
||||
<o:Column Id="o163">
|
||||
<a:ObjectID>0CAF2F1F-459F-4F78-9075-D95F924A4FF7</a:ObjectID>
|
||||
<a:Name>start_timestsamp</a:Name>
|
||||
<a:Code>start_timestsamp</a:Code>
|
||||
<a:Name>start_timestamp</a:Name>
|
||||
<a:Code>start_timestamp</a:Code>
|
||||
<a:CreationDate>1524449375</a:CreationDate>
|
||||
<a:Creator>Administrator</a:Creator>
|
||||
<a:ModificationDate>1524449375</a:ModificationDate>
|
||||
|
||||
@@ -5,12 +5,14 @@ drop table if exists sys_dept;
|
||||
create table sys_dept (
|
||||
dept_id int(11) not null auto_increment comment '部门id',
|
||||
parent_id int(11) default 0 comment '父部门id',
|
||||
ancestors varchar(50) default '' comment '祖级列表',
|
||||
dept_name varchar(30) default '' comment '部门名称',
|
||||
order_num int(4) default 0 comment '显示顺序',
|
||||
leader varchar(20) default '' comment '负责人',
|
||||
phone varchar(11) default '' comment '联系电话',
|
||||
email varchar(50) default '' comment '邮箱',
|
||||
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
@@ -21,17 +23,16 @@ create table sys_dept (
|
||||
-- ----------------------------
|
||||
-- 初始化-部门表数据
|
||||
-- ----------------------------
|
||||
insert into sys_dept values(100, 0, '若依集团', 0, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(101, 100, '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(102, 100, '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(103, 100, '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(104, 100, '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(105, 100, '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(106, 101, '研发一部', 1, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(107, 101, '研发二部', 2, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(108, 102, '市场一部', 1, '若依', '15888888888', 'ry@qq.com', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(109, 102, '市场二部', 2, '若依', '15888888888', 'ry@qq.com', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
|
||||
insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||
|
||||
-- ----------------------------
|
||||
-- 2、用户信息表
|
||||
@@ -64,8 +65,9 @@ create table sys_user (
|
||||
-- ----------------------------
|
||||
-- 初始化-用户信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_user values(1, 106, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '29c67a30398638269fe600f73a054934', '111111', '0', '0', '127.0.0.1', '2018-03-16 11-33-00', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||
insert into sys_user values(2, 108, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '8e6d98b90472783cc73c17047ddccf36', '222222', '0', '0', '127.0.0.1', '2018-03-16 11-33-00', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '测试员');
|
||||
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '29c67a30398638269fe600f73a054934', '111111', '0', '0', '127.0.0.1', '2018-03-16 11-33-00', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '8e6d98b90472783cc73c17047ddccf36', '222222', '0', '0', '127.0.0.1', '2018-03-16 11-33-00', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '测试员');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 3、岗位信息表
|
||||
@@ -104,7 +106,9 @@ create table sys_role (
|
||||
role_name varchar(30) not null comment '角色名称',
|
||||
role_key varchar(100) not null comment '角色权限字符串',
|
||||
role_sort int(4) not null comment '显示顺序',
|
||||
data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限)',
|
||||
status char(1) not null comment '角色状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
@@ -116,8 +120,8 @@ create table sys_role (
|
||||
-- ----------------------------
|
||||
-- 初始化-角色信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_role values('1', '管理员', 'admin', 1, '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||
insert into sys_role values('2', '普通角色', 'common', 2, '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色');
|
||||
insert into sys_role values('1', '管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||
insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
@@ -128,12 +132,12 @@ create table sys_menu (
|
||||
menu_id int(11) not null auto_increment comment '菜单ID',
|
||||
menu_name varchar(50) not null comment '菜单名称',
|
||||
parent_id int(11) default 0 comment '父菜单ID',
|
||||
order_num int(4) default null comment '显示顺序',
|
||||
url varchar(200) default '' comment '请求地址',
|
||||
order_num int(4) default 0 comment '显示顺序',
|
||||
url varchar(200) default '#' comment '请求地址',
|
||||
menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)',
|
||||
visible char(1) default 0 comment '菜单状态(0显示 1隐藏)',
|
||||
perms varchar(100) default '' comment '权限标识',
|
||||
icon varchar(100) default '' comment '菜单图标',
|
||||
icon varchar(100) default '#' comment '菜单图标',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
@@ -173,62 +177,70 @@ 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: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:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
insert into sys_menu values('1005', '重置密码', '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('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('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', '4', '#', 'F', '0', 'system:role:export', '#', '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('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('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('1015', '部门查询', '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('1016', '部门新增', '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('1017', '部门修改', '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('1018', '部门删除', '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('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('1019', '岗位查询', '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('1020', '岗位新增', '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('1021', '岗位修改', '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('1022', '岗位删除', '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('1023', '岗位导出', '104', '4', '#', 'F', '0', 'system:post:export', '#', '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('1024', '字典查询', '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('1025', '字典新增', '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('1026', '字典修改', '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('1027', '字典删除', '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('1028', '字典导出', '105', '4', '#', 'F', '0', 'system:dict:export', '#', '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('1029', '参数查询', '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('1030', '参数新增', '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('1031', '参数修改', '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('1032', '参数删除', '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('1033', '参数导出', '106', '4', '#', 'F', '0', 'system:config:export', '#', '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('1034', '公告查询', '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('1035', '公告新增', '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('1036', '公告修改', '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('1037', '公告删除', '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('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('1038', '操作查询', '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('1039', '操作删除', '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('1040', '详细信息', '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('1041', '日志导出', '500', '3', '#', 'F', '0', 'monitor:operlog:export', '#', '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('1042', '登录查询', '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('1043', '登录删除', '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('1044', '日志导出', '501', '2', '#', 'F', '0', 'monitor:logininfor:export', '#', '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('1045', '在线查询', '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('1046', '批量强退', '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('1047', '单条强退', '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('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('1048', '任务查询', '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('1049', '任务新增', '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('1050', '任务修改', '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('1051', '任务删除', '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('1052', '状态修改', '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('1053', '任务导出', '110', '5', '#', 'F', '0', 'monitor:job:export', '#', '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', '');
|
||||
insert into sys_menu values('1054', '生成查询', '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('1055', '生成代码', '113', '2', '#', 'F', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
@@ -261,77 +273,103 @@ create table sys_role_menu (
|
||||
-- ----------------------------
|
||||
-- 初始化-角色和菜单关联表数据
|
||||
-- ----------------------------
|
||||
insert into sys_role_menu values ('1', '1');
|
||||
insert into sys_role_menu values ('1', '2');
|
||||
insert into sys_role_menu values ('1', '3');
|
||||
insert into sys_role_menu values ('1', '100');
|
||||
insert into sys_role_menu values ('1', '101');
|
||||
insert into sys_role_menu values ('1', '102');
|
||||
insert into sys_role_menu values ('1', '103');
|
||||
insert into sys_role_menu values ('1', '104');
|
||||
insert into sys_role_menu values ('1', '105');
|
||||
insert into sys_role_menu values ('1', '106');
|
||||
insert into sys_role_menu values ('1', '107');
|
||||
insert into sys_role_menu values ('1', '108');
|
||||
insert into sys_role_menu values ('1', '109');
|
||||
insert into sys_role_menu values ('1', '110');
|
||||
insert into sys_role_menu values ('1', '111');
|
||||
insert into sys_role_menu values ('1', '112');
|
||||
insert into sys_role_menu values ('1', '113');
|
||||
insert into sys_role_menu values ('1', '114');
|
||||
insert into sys_role_menu values ('1', '500');
|
||||
insert into sys_role_menu values ('1', '501');
|
||||
insert into sys_role_menu values ('1', '1000');
|
||||
insert into sys_role_menu values ('1', '1001');
|
||||
insert into sys_role_menu values ('1', '1002');
|
||||
insert into sys_role_menu values ('1', '1003');
|
||||
insert into sys_role_menu values ('1', '1004');
|
||||
insert into sys_role_menu values ('1', '1005');
|
||||
insert into sys_role_menu values ('1', '1006');
|
||||
insert into sys_role_menu values ('1', '1007');
|
||||
insert into sys_role_menu values ('1', '1008');
|
||||
insert into sys_role_menu values ('1', '1009');
|
||||
insert into sys_role_menu values ('1', '1010');
|
||||
insert into sys_role_menu values ('1', '1011');
|
||||
insert into sys_role_menu values ('1', '1012');
|
||||
insert into sys_role_menu values ('1', '1013');
|
||||
insert into sys_role_menu values ('1', '1014');
|
||||
insert into sys_role_menu values ('1', '1015');
|
||||
insert into sys_role_menu values ('1', '1016');
|
||||
insert into sys_role_menu values ('1', '1017');
|
||||
insert into sys_role_menu values ('1', '1018');
|
||||
insert into sys_role_menu values ('1', '1019');
|
||||
insert into sys_role_menu values ('1', '1020');
|
||||
insert into sys_role_menu values ('1', '1021');
|
||||
insert into sys_role_menu values ('1', '1022');
|
||||
insert into sys_role_menu values ('1', '1023');
|
||||
insert into sys_role_menu values ('1', '1024');
|
||||
insert into sys_role_menu values ('1', '1025');
|
||||
insert into sys_role_menu values ('1', '1026');
|
||||
insert into sys_role_menu values ('1', '1027');
|
||||
insert into sys_role_menu values ('1', '1028');
|
||||
insert into sys_role_menu values ('1', '1029');
|
||||
insert into sys_role_menu values ('1', '1030');
|
||||
insert into sys_role_menu values ('1', '1031');
|
||||
insert into sys_role_menu values ('1', '1032');
|
||||
insert into sys_role_menu values ('1', '1033');
|
||||
insert into sys_role_menu values ('1', '1034');
|
||||
insert into sys_role_menu values ('1', '1035');
|
||||
insert into sys_role_menu values ('1', '1036');
|
||||
insert into sys_role_menu values ('1', '1037');
|
||||
insert into sys_role_menu values ('1', '1038');
|
||||
insert into sys_role_menu values ('1', '1039');
|
||||
insert into sys_role_menu values ('1', '1040');
|
||||
insert into sys_role_menu values ('1', '1041');
|
||||
insert into sys_role_menu values ('1', '1042');
|
||||
insert into sys_role_menu values ('1', '1043');
|
||||
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 ('2', '1');
|
||||
insert into sys_role_menu values ('2', '2');
|
||||
insert into sys_role_menu values ('2', '3');
|
||||
insert into sys_role_menu values ('2', '100');
|
||||
insert into sys_role_menu values ('2', '101');
|
||||
insert into sys_role_menu values ('2', '102');
|
||||
insert into sys_role_menu values ('2', '103');
|
||||
insert into sys_role_menu values ('2', '104');
|
||||
insert into sys_role_menu values ('2', '105');
|
||||
insert into sys_role_menu values ('2', '106');
|
||||
insert into sys_role_menu values ('2', '107');
|
||||
insert into sys_role_menu values ('2', '108');
|
||||
insert into sys_role_menu values ('2', '109');
|
||||
insert into sys_role_menu values ('2', '110');
|
||||
insert into sys_role_menu values ('2', '111');
|
||||
insert into sys_role_menu values ('2', '112');
|
||||
insert into sys_role_menu values ('2', '113');
|
||||
insert into sys_role_menu values ('2', '114');
|
||||
insert into sys_role_menu values ('2', '500');
|
||||
insert into sys_role_menu values ('2', '501');
|
||||
insert into sys_role_menu values ('2', '1000');
|
||||
insert into sys_role_menu values ('2', '1001');
|
||||
insert into sys_role_menu values ('2', '1002');
|
||||
insert into sys_role_menu values ('2', '1003');
|
||||
insert into sys_role_menu values ('2', '1004');
|
||||
insert into sys_role_menu values ('2', '1005');
|
||||
insert into sys_role_menu values ('2', '1006');
|
||||
insert into sys_role_menu values ('2', '1007');
|
||||
insert into sys_role_menu values ('2', '1008');
|
||||
insert into sys_role_menu values ('2', '1009');
|
||||
insert into sys_role_menu values ('2', '1010');
|
||||
insert into sys_role_menu values ('2', '1011');
|
||||
insert into sys_role_menu values ('2', '1012');
|
||||
insert into sys_role_menu values ('2', '1013');
|
||||
insert into sys_role_menu values ('2', '1014');
|
||||
insert into sys_role_menu values ('2', '1015');
|
||||
insert into sys_role_menu values ('2', '1016');
|
||||
insert into sys_role_menu values ('2', '1017');
|
||||
insert into sys_role_menu values ('2', '1018');
|
||||
insert into sys_role_menu values ('2', '1019');
|
||||
insert into sys_role_menu values ('2', '1020');
|
||||
insert into sys_role_menu values ('2', '1021');
|
||||
insert into sys_role_menu values ('2', '1022');
|
||||
insert into sys_role_menu values ('2', '1023');
|
||||
insert into sys_role_menu values ('2', '1024');
|
||||
insert into sys_role_menu values ('2', '1025');
|
||||
insert into sys_role_menu values ('2', '1026');
|
||||
insert into sys_role_menu values ('2', '1027');
|
||||
insert into sys_role_menu values ('2', '1028');
|
||||
insert into sys_role_menu values ('2', '1029');
|
||||
insert into sys_role_menu values ('2', '1030');
|
||||
insert into sys_role_menu values ('2', '1031');
|
||||
insert into sys_role_menu values ('2', '1032');
|
||||
insert into sys_role_menu values ('2', '1033');
|
||||
insert into sys_role_menu values ('2', '1034');
|
||||
insert into sys_role_menu values ('2', '1035');
|
||||
insert into sys_role_menu values ('2', '1036');
|
||||
insert into sys_role_menu values ('2', '1037');
|
||||
insert into sys_role_menu values ('2', '1038');
|
||||
insert into sys_role_menu values ('2', '1039');
|
||||
insert into sys_role_menu values ('2', '1040');
|
||||
insert into sys_role_menu values ('2', '1041');
|
||||
insert into sys_role_menu values ('2', '1042');
|
||||
insert into sys_role_menu values ('2', '1043');
|
||||
insert into sys_role_menu values ('2', '1044');
|
||||
insert into sys_role_menu values ('2', '1045');
|
||||
insert into sys_role_menu values ('2', '1046');
|
||||
insert into sys_role_menu values ('2', '1047');
|
||||
insert into sys_role_menu values ('2', '1048');
|
||||
insert into sys_role_menu values ('2', '1049');
|
||||
insert into sys_role_menu values ('2', '1050');
|
||||
insert into sys_role_menu values ('2', '1051');
|
||||
insert into sys_role_menu values ('2', '1052');
|
||||
insert into sys_role_menu values ('2', '1053');
|
||||
insert into sys_role_menu values ('2', '1054');
|
||||
insert into sys_role_menu values ('2', '1055');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 8、用户与岗位关联表 用户1-N岗位
|
||||
-- 8、角色和部门关联表 角色1-N部门
|
||||
-- ----------------------------
|
||||
drop table if exists sys_role_dept;
|
||||
create table sys_role_dept (
|
||||
role_id int(11) not null comment '角色ID',
|
||||
dept_id int(11) not null comment '部门ID',
|
||||
primary key(role_id, dept_id)
|
||||
) engine=innodb default charset=utf8 comment = '角色和部门关联表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-角色和部门关联表数据
|
||||
-- ----------------------------
|
||||
insert into sys_role_dept values ('2', '100');
|
||||
insert into sys_role_dept values ('2', '101');
|
||||
insert into sys_role_dept values ('2', '105');
|
||||
|
||||
-- ----------------------------
|
||||
-- 9、用户与岗位关联表 用户1-N岗位
|
||||
-- ----------------------------
|
||||
drop table if exists sys_user_post;
|
||||
create table sys_user_post
|
||||
@@ -349,22 +387,22 @@ insert into sys_user_post values ('2', '2');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 9、操作日志记录
|
||||
-- 10、操作日志记录
|
||||
-- ----------------------------
|
||||
drop table if exists sys_oper_log;
|
||||
create table sys_oper_log (
|
||||
oper_id int(11) not null auto_increment comment '日志主键',
|
||||
title varchar(50) default '' comment '模块标题',
|
||||
action varchar(100) default '' comment '功能请求',
|
||||
business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
|
||||
method varchar(100) default '' comment '方法名称',
|
||||
channel varchar(20) default '' comment '来源渠道(manage后台用户 mobile手机端用户 other其它)',
|
||||
operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)',
|
||||
oper_name varchar(50) default '' comment '操作人员',
|
||||
dept_name varchar(50) default '' comment '部门名称',
|
||||
oper_url varchar(255) default '' comment '请求URL',
|
||||
oper_ip varchar(30) default '' comment '主机地址',
|
||||
oper_location varchar(255) default '' comment '操作地点',
|
||||
oper_param varchar(255) default '' comment '请求参数',
|
||||
status char(1) default '0' comment '操作状态(0正常 1异常)',
|
||||
status int(1) default 0 comment '操作状态(0正常 1异常)',
|
||||
error_msg varchar(2000) default '' comment '错误消息',
|
||||
oper_time datetime comment '操作时间',
|
||||
primary key (oper_id)
|
||||
@@ -372,7 +410,7 @@ create table sys_oper_log (
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 10、字典类型表
|
||||
-- 11、字典类型表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_dict_type;
|
||||
create table sys_dict_type
|
||||
@@ -400,8 +438,9 @@ insert into sys_dict_type values(7, '通知状态', 'sys_notice_status', '0',
|
||||
insert into sys_dict_type values(8, '操作类型', 'sys_oper_type', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '操作类型列表');
|
||||
insert into sys_dict_type values(9, '系统状态', 'sys_common_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '登录状态列表');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 11、字典数据表
|
||||
-- 12、字典数据表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_dict_data;
|
||||
create table sys_dict_data
|
||||
@@ -411,8 +450,8 @@ create table sys_dict_data
|
||||
dict_label varchar(100) default '' comment '字典标签',
|
||||
dict_value varchar(100) default '' comment '字典键值',
|
||||
dict_type varchar(100) default '' comment '字典类型',
|
||||
css_class varchar(500) default '' comment '样式属性',
|
||||
list_class varchar(500) 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 '创建者',
|
||||
@@ -424,34 +463,35 @@ 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', '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', '停用状态');
|
||||
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', '', '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', '', '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', '', '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', '', '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', '', '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', '', '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', '', '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', '', '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', '', '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', '', '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、参数配置表
|
||||
-- 13、参数配置表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_config;
|
||||
create table sys_config (
|
||||
@@ -473,7 +513,7 @@ insert into sys_config values(2, '用户管理-账号初始密码', 'sys.use
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 13、系统访问记录
|
||||
-- 14、系统访问记录
|
||||
-- ----------------------------
|
||||
drop table if exists sys_logininfor;
|
||||
create table sys_logininfor (
|
||||
@@ -491,7 +531,7 @@ create table sys_logininfor (
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 14、在线用户记录
|
||||
-- 15、在线用户记录
|
||||
-- ----------------------------
|
||||
drop table if exists sys_user_online;
|
||||
create table sys_user_online (
|
||||
@@ -503,7 +543,7 @@ create table sys_user_online (
|
||||
browser varchar(50) default '' comment '浏览器类型',
|
||||
os varchar(50) default '' comment '操作系统',
|
||||
status varchar(10) default '' comment '在线状态on_line在线off_line离线',
|
||||
start_timestsamp datetime comment 'session创建时间',
|
||||
start_timestamp datetime comment 'session创建时间',
|
||||
last_access_time datetime comment 'session最后访问时间',
|
||||
expire_time int(5) default 0 comment '超时时间,单位为分钟',
|
||||
primary key (sessionId)
|
||||
@@ -511,7 +551,7 @@ create table sys_user_online (
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 15、定时任务调度表
|
||||
-- 16、定时任务调度表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_job;
|
||||
create table sys_job (
|
||||
@@ -536,7 +576,7 @@ insert into sys_job values(2, 'ryTask', '系统默认(有参)', 'ryParams',
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 16、定时任务调度日志表
|
||||
-- 17、定时任务调度日志表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_job_log;
|
||||
create table sys_job_log (
|
||||
@@ -554,7 +594,7 @@ create table sys_job_log (
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 17、通知公告表
|
||||
-- 18、通知公告表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_notice;
|
||||
create table sys_notice (
|
||||
@@ -571,7 +611,6 @@ create table sys_notice (
|
||||
primary key (notice_id)
|
||||
) engine=innodb auto_increment=10 default charset=utf8 comment = '通知公告表';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-公告信息表数据
|
||||
-- ----------------------------
|
||||
@@ -3,15 +3,14 @@ package com.ruoyi;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@MapperScan("com.ruoyi.project.*.*.mapper")
|
||||
public class RuoYiApplication
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用Map数据
|
||||
* 通用数据库映射Map数据
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@@ -39,7 +39,7 @@ public class CommonMap
|
||||
javaTypeMap.put("text", "String");
|
||||
javaTypeMap.put("mediumtext", "String");
|
||||
javaTypeMap.put("longtext", "String");
|
||||
javaTypeMap.put("time", "Date");
|
||||
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,27 @@
|
||||
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 EXPORT_PERMISSION = "export";
|
||||
|
||||
/** 显示权限 */
|
||||
public static final String VIEW_PERMISSION = "view";
|
||||
|
||||
/** 查询权限 */
|
||||
public static final String LIST_PERMISSION = "list";
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public interface ShiroConstants
|
||||
/**
|
||||
* 验证码开关
|
||||
*/
|
||||
public static final String CURRENT_EBABLED = "captchaEbabled";
|
||||
public static final String CURRENT_ENABLED = "captchaEnabled";
|
||||
|
||||
/**
|
||||
* 验证码开关
|
||||
|
||||
@@ -49,6 +49,18 @@ public class UserConstants
|
||||
public final static String ROLE_NAME_UNIQUE = "0";
|
||||
public final static String ROLE_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 岗位名称是否唯一的返回结果码 */
|
||||
public final static String POST_NAME_UNIQUE = "0";
|
||||
public final static String POST_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 角色权限是否唯一的返回结果码 */
|
||||
public final static String ROLE_KEY_UNIQUE = "0";
|
||||
public final static String ROLE_KEY_NOT_UNIQUE = "1";
|
||||
|
||||
/** 岗位编码是否唯一的返回结果码 */
|
||||
public final static String POST_CODE_UNIQUE = "0";
|
||||
public final static String POST_CODE_NOT_UNIQUE = "1";
|
||||
|
||||
/** 菜单名称是否唯一的返回结果码 */
|
||||
public final static String MENU_NAME_UNIQUE = "0";
|
||||
public final static String MENU_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.common.exception.base;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,17 @@
|
||||
package com.ruoyi.common.exception.user;
|
||||
|
||||
/**
|
||||
* 用户账号已被删除
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class UserDeleteException extends UserException
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UserDeleteException()
|
||||
{
|
||||
super("user.password.delete", null);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.framework.config.RuoYiConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -18,20 +19,21 @@ public class AddressUtils
|
||||
|
||||
public static String getRealAddressByIP(String ip)
|
||||
{
|
||||
String address = "";
|
||||
try
|
||||
String address = "XX XX";
|
||||
if (RuoYiConfig.isAddressEnabled())
|
||||
{
|
||||
address = HttpUtils.sendPost(IP_URL, "ip=" + ip);
|
||||
JSONObject json = JSONObject.parseObject(address);
|
||||
JSONObject object = json.getObject("data", JSONObject.class);
|
||||
String region = object.getString("region");
|
||||
String city = object.getString("city");
|
||||
String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip);
|
||||
if (StringUtils.isEmpty(rspStr))
|
||||
{
|
||||
log.error("获取地理位置异常 {}", ip);
|
||||
return address;
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(rspStr);
|
||||
JSONObject data = obj.getObject("data", JSONObject.class);
|
||||
String region = data.getString("region");
|
||||
String city = data.getString("city");
|
||||
address = region + " " + city;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("根据IP获取所在位置----------错误消息:" + e.getMessage());
|
||||
}
|
||||
return address;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.ruoyi.common.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.text.StrBuilder;
|
||||
|
||||
import com.ruoyi.common.support.StrFormatter;
|
||||
|
||||
/**
|
||||
@@ -12,7 +10,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 = "";
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.project.monitor.logininfor.domain.Logininfor;
|
||||
import com.ruoyi.project.monitor.logininfor.service.LogininforServiceImpl;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
|
||||
/**
|
||||
* 记录用户日志信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class SystemLogUtils
|
||||
{
|
||||
|
||||
private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user");
|
||||
|
||||
/**
|
||||
* 记录格式 [ip][用户名][操作][错误消息]
|
||||
* <p/>
|
||||
* 注意操作如下: loginError 登录失败 loginSuccess 登录成功 passwordError 密码错误 changePassword 修改密码 changeStatus 修改状态
|
||||
*
|
||||
* @param username
|
||||
* @param op
|
||||
* @param msg
|
||||
* @param args
|
||||
*/
|
||||
public static void log(String username, String status, String msg, Object... args)
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(LogUtils.getBlock(ShiroUtils.getIp()));
|
||||
s.append(AddressUtils.getRealAddressByIP(ShiroUtils.getIp()));
|
||||
s.append(LogUtils.getBlock(username));
|
||||
s.append(LogUtils.getBlock(status));
|
||||
s.append(LogUtils.getBlock(msg));
|
||||
|
||||
sys_user_logger.info(s.toString(), args);
|
||||
|
||||
if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status))
|
||||
{
|
||||
saveOpLog(username, msg, Constants.SUCCESS);
|
||||
}
|
||||
else if (Constants.LOGIN_FAIL.equals(status))
|
||||
{
|
||||
saveOpLog(username, msg, Constants.FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOpLog(String username, String message, String status)
|
||||
{
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
|
||||
// 获取客户端操作系统
|
||||
String os = userAgent.getOperatingSystem().getName();
|
||||
// 获取客户端浏览器
|
||||
String browser = userAgent.getBrowser().getName();
|
||||
LogininforServiceImpl logininforService = SpringUtils.getBean(LogininforServiceImpl.class);
|
||||
Logininfor logininfor = new Logininfor();
|
||||
logininfor.setLoginName(username);
|
||||
logininfor.setStatus(status);
|
||||
logininfor.setIpaddr(ShiroUtils.getIp());
|
||||
logininfor.setLoginLocation(AddressUtils.getRealAddressByIP(ShiroUtils.getIp()));
|
||||
logininfor.setBrowser(browser);
|
||||
logininfor.setOs(os);
|
||||
logininfor.setMsg(message);
|
||||
logininforService.insertLogininfor(logininfor);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.ruoyi.common.utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.project.system.menu.domain.Menu;
|
||||
|
||||
/**
|
||||
|
||||
+13
-5
@@ -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)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.common.utils.poi;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -31,6 +32,7 @@ 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;
|
||||
@@ -52,34 +54,62 @@ public class ExcelUtil<T>
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对excel表单默认第一个索引名转换成list
|
||||
*
|
||||
* @param input 输入流
|
||||
* @return 转换后集合
|
||||
*/
|
||||
public List<T> importExcel(InputStream input) throws Exception
|
||||
{
|
||||
return importExcel(StringUtils.EMPTY, input);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对excel表单指定表格索引名转换成list
|
||||
*
|
||||
* @param sheetName 表格索引名
|
||||
* @param input 输入流
|
||||
* @return 转换后集合
|
||||
*/
|
||||
public List<T> importExcel(String sheetName, InputStream input) throws Exception
|
||||
{
|
||||
List<T> list = new ArrayList<T>();
|
||||
|
||||
Workbook workbook = WorkbookFactory.create(input);
|
||||
Sheet sheet = workbook.getSheet(sheetName);
|
||||
if (!sheetName.trim().equals(""))
|
||||
Sheet sheet = null;
|
||||
if (StringUtils.isNotEmpty(sheetName))
|
||||
{
|
||||
sheet = workbook.getSheet(sheetName); // 如果指定sheet名,则取指定sheet中的内容.
|
||||
// 如果指定sheet名,则取指定sheet中的内容.
|
||||
sheet = workbook.getSheet(sheetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果传入的sheet名不存在则默认指向第1个sheet.
|
||||
sheet = workbook.getSheetAt(0);
|
||||
}
|
||||
|
||||
if (sheet == null)
|
||||
{
|
||||
sheet = workbook.getSheetAt(0); // 如果传入的sheet名不存在则默认指向第1个sheet.
|
||||
throw new IOException("文件sheet不存在");
|
||||
}
|
||||
|
||||
int rows = sheet.getPhysicalNumberOfRows();
|
||||
|
||||
if (rows > 0)
|
||||
{
|
||||
// 有数据时才处理
|
||||
Field[] allFields = clazz.getDeclaredFields(); // 得到类的所有field.
|
||||
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>(); // 定义一个map用于存放列的序号和field.
|
||||
// 有数据时才处理 得到类的所有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))
|
||||
{
|
||||
field.setAccessible(true);// 设置类的私有字段属性可访问.
|
||||
// 设置类的私有字段属性可访问.
|
||||
field.setAccessible(true);
|
||||
fieldsMap.put(col, field);
|
||||
}
|
||||
}
|
||||
@@ -98,19 +128,21 @@ public class ExcelUtil<T>
|
||||
}
|
||||
else
|
||||
{
|
||||
// 先设置Cell的类型,然后就可以把纯数字作为String类型读进来了 by zhuyangyong 20171228
|
||||
// 先设置Cell的类型,然后就可以把纯数字作为String类型读进来了
|
||||
row.getCell(j).setCellType(Cell.CELL_TYPE_STRING);
|
||||
cell = row.getCell(j);
|
||||
}
|
||||
|
||||
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 + 1);
|
||||
// 取得类型,并根据对象类型设置值.
|
||||
Class<?> fieldType = field.getType();
|
||||
if (String.class == fieldType)
|
||||
@@ -179,7 +211,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)
|
||||
@@ -190,32 +223,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);
|
||||
cell = row.createCell(i); // 创建列
|
||||
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);
|
||||
@@ -230,8 +270,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);
|
||||
@@ -240,17 +282,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, i, i); // 这里默认设了2-101列提示.
|
||||
// 这里默认设了2-101列提示.
|
||||
setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, i, i);
|
||||
}
|
||||
// 如果设置了combo属性则本列只能选择不能输入
|
||||
if (attr.combo().length > 0)
|
||||
{
|
||||
setHSSFValidation(sheet, attr.combo(), 1, 100, i, i); // 这里默认设了2-101列只能选择不能输入.
|
||||
// 这里默认设了2-101列只能选择不能输入.
|
||||
setHSSFValidation(sheet, attr.combo(), 1, 100, i, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,18 +308,22 @@ 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(j);// 创建cell
|
||||
// 创建cell
|
||||
cell = row.createCell(j);
|
||||
cell.setCellStyle(cs);
|
||||
try
|
||||
{
|
||||
@@ -292,11 +341,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 +355,7 @@ public class ExcelUtil<T>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("导出Excel失败{}", e);
|
||||
log.error("导出Excel失败{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,29 +370,11 @@ public class ExcelUtil<T>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("关闭flush失败{}", e);
|
||||
log.error("关闭flush失败{}", e.getMessage());
|
||||
return AjaxResult.error("导出Excel失败,请联系网站管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将EXCEL中A,B,C,D,E列映射成0,1,2,3
|
||||
*
|
||||
* @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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置单元格上提示
|
||||
*
|
||||
@@ -362,9 +395,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 +420,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,46 @@
|
||||
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.endsWithIgnoreCase(permission, PermissionConstants.EXPORT_PERMISSION))
|
||||
{
|
||||
msg = MessageUtils.message("no.export.permission", permission);
|
||||
}
|
||||
else if (StringUtils.endsWithAny(permission, new String[] { PermissionConstants.VIEW_PERMISSION, PermissionConstants.LIST_PERMISSION }))
|
||||
{
|
||||
msg = MessageUtils.message("no.view.permission", permission);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.framework.shiro.realm.UserRealm;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
@@ -36,8 +36,13 @@ public class ShiroUtils
|
||||
|
||||
public static User getUser()
|
||||
{
|
||||
User user = new User();
|
||||
BeanUtils.copyBeanProp(user, getSubjct().getPrincipal());
|
||||
User user = null;
|
||||
Object obj = getSubjct().getPrincipal();
|
||||
if (StringUtils.isNotNull(obj))
|
||||
{
|
||||
user = new User();
|
||||
BeanUtils.copyBeanProp(user, obj);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,36 +11,44 @@ import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 防止XSS攻击的过滤器
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@WebFilter(filterName = "xssFilter", urlPatterns = "/system/*")
|
||||
public class XssFilter implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* 排除链接
|
||||
*/
|
||||
public List<String> excludes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* xss过滤开关
|
||||
*/
|
||||
public boolean enabled = false;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException
|
||||
{
|
||||
String temp = filterConfig.getInitParameter("excludes");
|
||||
if (temp != null)
|
||||
String tempExcludes = filterConfig.getInitParameter("excludes");
|
||||
String tempEnabled = filterConfig.getInitParameter("enabled");
|
||||
if (StringUtils.isNotEmpty(tempExcludes))
|
||||
{
|
||||
String[] url = temp.split(",");
|
||||
String[] url = tempExcludes.split(",");
|
||||
for (int i = 0; url != null && i < url.length; i++)
|
||||
{
|
||||
excludes.add(url[i]);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempEnabled))
|
||||
{
|
||||
enabled = Boolean.valueOf(tempEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,6 +68,10 @@ public class XssFilter implements Filter
|
||||
|
||||
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (excludes == null || excludes.isEmpty())
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.ruoyi.framework.aspectj;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Ds;
|
||||
import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder;
|
||||
|
||||
/**
|
||||
* 多数据源处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Aspect
|
||||
@Order(1)
|
||||
@Component
|
||||
public class DsAspect
|
||||
{
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.Ds)")
|
||||
public void dsPointCut()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Around("dsPointCut()")
|
||||
public Object around(ProceedingJoinPoint point) throws Throwable
|
||||
{
|
||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||
|
||||
Method method = signature.getMethod();
|
||||
|
||||
Ds dataSource = method.getAnnotation(Ds.class);
|
||||
|
||||
if (StringUtils.isNotNull(dataSource))
|
||||
{
|
||||
DynamicDataSourceContextHolder.setDateSoureType(dataSource.value().name());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return point.proceed();
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 销毁数据源 在执行方法之后
|
||||
DynamicDataSourceContextHolder.clearDateSoureType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.ruoyi.framework.aspectj;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import com.ruoyi.common.utils.AddressUtils;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
@@ -12,18 +11,16 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessStatus;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessStatus;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.project.monitor.operlog.domain.OperLog;
|
||||
import com.ruoyi.project.monitor.operlog.service.IOperLogService;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
|
||||
/**
|
||||
@@ -33,14 +30,10 @@ import com.ruoyi.project.system.user.domain.User;
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@EnableAsync
|
||||
public class LogAspect
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
||||
|
||||
@Autowired
|
||||
private IOperLogService operLogService;
|
||||
|
||||
// 配置织入点
|
||||
@Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.Log)")
|
||||
public void logPointCut()
|
||||
@@ -70,7 +63,6 @@ public class LogAspect
|
||||
handleLog(joinPoint, e);
|
||||
}
|
||||
|
||||
@Async
|
||||
protected void handleLog(final JoinPoint joinPoint, final Exception e)
|
||||
{
|
||||
try
|
||||
@@ -87,12 +79,10 @@ public class LogAspect
|
||||
|
||||
// *========数据库日志=========*//
|
||||
OperLog operLog = new OperLog();
|
||||
operLog.setStatus(BusinessStatus.SUCCESS);
|
||||
operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
|
||||
// 请求的地址
|
||||
String ip = ShiroUtils.getIp();
|
||||
operLog.setOperIp(ip);
|
||||
// 操作地点
|
||||
operLog.setOperLocation(AddressUtils.getRealAddressByIP(ip));
|
||||
|
||||
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
||||
if (currentUser != null)
|
||||
@@ -107,7 +97,7 @@ public class LogAspect
|
||||
|
||||
if (e != null)
|
||||
{
|
||||
operLog.setStatus(BusinessStatus.FAIL);
|
||||
operLog.setStatus(BusinessStatus.FAIL.ordinal());
|
||||
operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
|
||||
}
|
||||
// 设置方法名称
|
||||
@@ -117,7 +107,7 @@ public class LogAspect
|
||||
// 处理设置注解上的参数
|
||||
getControllerMethodDescription(controllerLog, operLog);
|
||||
// 保存数据库
|
||||
operLogService.insertOperlog(operLog);
|
||||
AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
@@ -138,11 +128,11 @@ public class LogAspect
|
||||
public void getControllerMethodDescription(Log log, OperLog operLog) throws Exception
|
||||
{
|
||||
// 设置action动作
|
||||
operLog.setAction(log.action());
|
||||
operLog.setBusinessType(log.businessType().ordinal());
|
||||
// 设置标题
|
||||
operLog.setTitle(log.title());
|
||||
// 设置channel
|
||||
operLog.setChannel(log.channel());
|
||||
// 设置操作人类别
|
||||
operLog.setOperatorType(log.operatorType().ordinal());
|
||||
// 是否需要保存request,参数和值
|
||||
if (log.isSaveRequestData())
|
||||
{
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.framework.aspectj.lang.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
||||
|
||||
/**
|
||||
* 自定义多数据源切换注解
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Ds
|
||||
{
|
||||
/**
|
||||
* 切换数据源名称
|
||||
*/
|
||||
public DataSourceType value() default DataSourceType.MASTER;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 自定义注解
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,8 @@ import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.OperatorType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.OperatorType;
|
||||
|
||||
/**
|
||||
* 自定义操作日志记录注解
|
||||
@@ -22,10 +23,10 @@ public @interface Log
|
||||
String title() default "";
|
||||
|
||||
/** 功能 */
|
||||
String action() default "";
|
||||
BusinessType businessType() default BusinessType.OTHER;
|
||||
|
||||
/** 渠道 */
|
||||
String channel() default OperatorType.MANAGE;
|
||||
/** 操作人类别 */
|
||||
OperatorType operatorType() default OperatorType.MANAGE;
|
||||
|
||||
/** 是否保存请求的参数 */
|
||||
boolean isSaveRequestData() default true;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.ruoyi.framework.aspectj.lang.constant;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public class BusinessStatus
|
||||
{
|
||||
/** 其它 */
|
||||
public static final String OTHER = "-1";
|
||||
|
||||
/** 成功 */
|
||||
public static final String SUCCESS = "0";
|
||||
|
||||
/** 失败 */
|
||||
public static final String FAIL = "1";
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.ruoyi.framework.aspectj.lang.constant;
|
||||
|
||||
/**
|
||||
* 业务操作类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public class BusinessType
|
||||
{
|
||||
/** 其它 */
|
||||
public static final String OTHER = "0";
|
||||
/** 新增 */
|
||||
public static final String INSERT = "1";
|
||||
/** 修改 */
|
||||
public static final String UPDATE = "2";
|
||||
/** 删除 */
|
||||
public static final String DELETE = "3";
|
||||
/** 授权 */
|
||||
public static final String GRANT = "4";
|
||||
/** 导出 */
|
||||
public static final String EXPORT = "5";
|
||||
/** 导入 */
|
||||
public static final String IMPORT = "6";
|
||||
/** 强退 */
|
||||
public static final String FORCE = "7";
|
||||
/** 生成代码 */
|
||||
public static final String GENCODE = "8";
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.ruoyi.framework.aspectj.lang.constant;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public class OperatorType
|
||||
{
|
||||
/** 其它 */
|
||||
public static final String OTHER = "0";
|
||||
|
||||
/** 后台用户 */
|
||||
public static final String MANAGE = "1";
|
||||
|
||||
/** 渠道用户 */
|
||||
public static final String CHANNEL = "2";
|
||||
|
||||
/** 手机端用户 */
|
||||
public static final String MOBILE = "3";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.framework.aspectj.lang.enums;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public enum BusinessStatus
|
||||
{
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS,
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL,
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.framework.aspectj.lang.enums;
|
||||
|
||||
/**
|
||||
* 业务操作类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public enum BusinessType
|
||||
{
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
INSERT,
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE,
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
GRANT,
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
EXPORT,
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
IMPORT,
|
||||
|
||||
/**
|
||||
* 强退
|
||||
*/
|
||||
FORCE,
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
GENCODE,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.framework.aspectj.lang.enums;
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum DataSourceType
|
||||
{
|
||||
/**
|
||||
* 主库
|
||||
*/
|
||||
MASTER,
|
||||
|
||||
/**
|
||||
* 从库
|
||||
*/
|
||||
SLAVE
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.framework.aspectj.lang.enums;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public enum OperatorType
|
||||
{
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 后台用户
|
||||
*/
|
||||
|
||||
MANAGE,
|
||||
|
||||
/**
|
||||
* 手机端用户
|
||||
*/
|
||||
MOBILE
|
||||
}
|
||||
@@ -1,161 +1,47 @@
|
||||
package com.ruoyi.framework.config;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.support.http.StatViewServlet;
|
||||
import com.alibaba.druid.support.http.WebStatFilter;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
||||
import com.ruoyi.framework.datasource.DynamicDataSource;
|
||||
|
||||
/**
|
||||
* Druid数据库信息配置加载
|
||||
* druid 配置多数据源
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class DruidConfig
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(DruidConfig.class);
|
||||
|
||||
@Value("${spring.datasource.url}")
|
||||
private String dbUrl;
|
||||
|
||||
@Value("${spring.datasource.username}")
|
||||
private String username;
|
||||
|
||||
@Value("${spring.datasource.password}")
|
||||
private String password;
|
||||
|
||||
@Value("${spring.datasource.driverClassName}")
|
||||
private String driverClassName;
|
||||
|
||||
@Value("${spring.datasource.initialSize}")
|
||||
private int initialSize;
|
||||
|
||||
@Value("${spring.datasource.minIdle}")
|
||||
private int minIdle;
|
||||
|
||||
@Value("${spring.datasource.maxActive}")
|
||||
private int maxActive;
|
||||
|
||||
@Value("${spring.datasource.maxWait}")
|
||||
private int maxWait;
|
||||
|
||||
@Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
|
||||
private int timeBetweenEvictionRunsMillis;
|
||||
|
||||
@Value("${spring.datasource.minEvictableIdleTimeMillis}")
|
||||
private int minEvictableIdleTimeMillis;
|
||||
|
||||
@Value("${spring.datasource.validationQuery}")
|
||||
private String validationQuery;
|
||||
|
||||
@Value("${spring.datasource.testWhileIdle}")
|
||||
private boolean testWhileIdle;
|
||||
|
||||
@Value("${spring.datasource.testOnBorrow}")
|
||||
private boolean testOnBorrow;
|
||||
|
||||
@Value("${spring.datasource.testOnReturn}")
|
||||
private boolean testOnReturn;
|
||||
|
||||
@Value("${spring.datasource.poolPreparedStatements}")
|
||||
private boolean poolPreparedStatements;
|
||||
|
||||
@Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
|
||||
private int maxPoolPreparedStatementPerConnectionSize;
|
||||
|
||||
@Value("${spring.datasource.filters}")
|
||||
private String filters;
|
||||
|
||||
@Value("{spring.datasource.connectionProperties}")
|
||||
private String connectionProperties;
|
||||
|
||||
@Bean(initMethod = "init", destroyMethod = "close") /** 声明其为Bean实例 */
|
||||
@Primary /** 在同样的DataSource中,首先使用被标注的DataSource */
|
||||
public DataSource dataSource()
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.master")
|
||||
public DataSource masterDataSource()
|
||||
{
|
||||
DruidDataSource datasource = new DruidDataSource();
|
||||
|
||||
datasource.setUrl(this.dbUrl);
|
||||
datasource.setUsername(username);
|
||||
datasource.setPassword(password);
|
||||
datasource.setDriverClassName(driverClassName);
|
||||
|
||||
/** configuration */
|
||||
datasource.setInitialSize(initialSize);
|
||||
datasource.setMinIdle(minIdle);
|
||||
datasource.setMaxActive(maxActive);
|
||||
datasource.setMaxWait(maxWait);
|
||||
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
|
||||
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
|
||||
datasource.setValidationQuery(validationQuery);
|
||||
datasource.setTestWhileIdle(testWhileIdle);
|
||||
datasource.setTestOnBorrow(testOnBorrow);
|
||||
datasource.setTestOnReturn(testOnReturn);
|
||||
datasource.setPoolPreparedStatements(poolPreparedStatements);
|
||||
datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
|
||||
try
|
||||
{
|
||||
datasource.setFilters(filters);
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.error("druid configuration initialization filter", e);
|
||||
}
|
||||
datasource.setConnectionProperties(connectionProperties);
|
||||
|
||||
return datasource;
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册一个StatViewServlet 相当于在web.xml中声明了一个servlet
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Bean
|
||||
public ServletRegistrationBean druidServlet()
|
||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||
public DataSource slaveDataSource()
|
||||
{
|
||||
ServletRegistrationBean reg = new ServletRegistrationBean();
|
||||
reg.setServlet(new StatViewServlet());
|
||||
reg.addUrlMappings("/monitor/druid/*");
|
||||
/** 白名单 */
|
||||
// reg.addInitParameter("allow", "10.211.61.45,127.0.0.1,123.207.20.136");
|
||||
/** IP黑名单(共同存在时,deny优先于allow) */
|
||||
// reg.addInitParameter("deny", "10.211.61.4");
|
||||
/** 是否能够重置数据 禁用HTML页面上的“Reset All”功能 */
|
||||
reg.addInitParameter("resetEnable", "false");
|
||||
return reg;
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册一个:filterRegistrationBean 相当于在web.xml中声明了一个Filter
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegistrationBean()
|
||||
@Bean(name = "dynamicDataSource")
|
||||
@Primary
|
||||
public DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource)
|
||||
{
|
||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
||||
filterRegistrationBean.setFilter(new WebStatFilter());
|
||||
/** 添加过滤规则. */
|
||||
filterRegistrationBean.addUrlPatterns("/*");
|
||||
/** 监控选项滤器 */
|
||||
filterRegistrationBean.addInitParameter("DruidWebStatFilter", "/*");
|
||||
/** 添加不需要忽略的格式信息. */
|
||||
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/monitor/druid/*");
|
||||
/** 配置profileEnable能够监控单个url调用的sql列表 */
|
||||
filterRegistrationBean.addInitParameter("profileEnable", "true");
|
||||
/** 当前的cookie的用户 */
|
||||
filterRegistrationBean.addInitParameter("principalCookieName", "USER_COOKIE");
|
||||
/** 当前的session的用户 */
|
||||
filterRegistrationBean.addInitParameter("principalSessionName", "USER_SESSION");
|
||||
return filterRegistrationBean;
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||
targetDataSources.put(DataSourceType.SLAVE.name(), slaveDataSource);
|
||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.ruoyi.framework.config;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.servlet.DispatcherType;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.xss.XssFilter;
|
||||
|
||||
/**
|
||||
@@ -16,6 +18,15 @@ import com.ruoyi.common.xss.XssFilter;
|
||||
@Configuration
|
||||
public class FilterConfig
|
||||
{
|
||||
@Value("${xss.enabled}")
|
||||
private String enabled;
|
||||
|
||||
@Value("${xss.excludes}")
|
||||
private String excludes;
|
||||
|
||||
@Value("${xss.urlPatterns}")
|
||||
private String urlPatterns;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Bean
|
||||
public FilterRegistrationBean xssFilterRegistration()
|
||||
@@ -23,11 +34,12 @@ public class FilterConfig
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
registration.setDispatcherTypes(DispatcherType.REQUEST);
|
||||
registration.setFilter(new XssFilter());
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.addUrlPatterns(StringUtils.split(urlPatterns, ","));
|
||||
registration.setName("xssFilter");
|
||||
registration.setOrder(Integer.MAX_VALUE);
|
||||
Map<String, String> initParameters = Maps.newHashMap();
|
||||
initParameters.put("excludes", "/system/notice/*");
|
||||
initParameters.put("excludes", excludes);
|
||||
initParameters.put("enabled", enabled);
|
||||
registration.setInitParameters(initParameters);
|
||||
return registration;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public class RuoYiConfig
|
||||
private String copyrightYear;
|
||||
/** 上传路径 */
|
||||
private static String profile;
|
||||
/** 获取地址开关 */
|
||||
private static boolean addressEnabled;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
@@ -61,4 +63,14 @@ public class RuoYiConfig
|
||||
RuoYiConfig.profile = profile;
|
||||
}
|
||||
|
||||
public static boolean isAddressEnabled()
|
||||
{
|
||||
return addressEnabled;
|
||||
}
|
||||
|
||||
public void setAddressEnabled(boolean addressEnabled)
|
||||
{
|
||||
RuoYiConfig.addressEnabled = addressEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ public class ScheduleConfig
|
||||
prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
|
||||
prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
|
||||
|
||||
// sqlserver 启用
|
||||
//prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
||||
prop.put("org.quartz.jobStore.misfireThreshold", "12000");
|
||||
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
factory.setQuartzProperties(prop);
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
@@ -51,8 +46,8 @@ public class ShiroConfig
|
||||
private int validationInterval;
|
||||
|
||||
// 验证码开关
|
||||
@Value("${shiro.user.captchaEbabled}")
|
||||
private boolean captchaEbabled;
|
||||
@Value("${shiro.user.captchaEnabled}")
|
||||
private boolean captchaEnabled;
|
||||
|
||||
// 验证码类型
|
||||
@Value("${shiro.user.captchaType}")
|
||||
@@ -268,12 +263,7 @@ public class ShiroConfig
|
||||
shiroFilterFactoryBean.setFilters(filters);
|
||||
|
||||
// 所有请求需要认证
|
||||
filterChainDefinitionMap.put("/**", "user");
|
||||
// 系统请求记录当前会话
|
||||
filterChainDefinitionMap.put("/main", "onlineSession,syncOnlineSession");
|
||||
filterChainDefinitionMap.put("/system/**", "onlineSession,syncOnlineSession");
|
||||
filterChainDefinitionMap.put("/monitor/**", "onlineSession,syncOnlineSession");
|
||||
filterChainDefinitionMap.put("/tool/**", "onlineSession,syncOnlineSession");
|
||||
filterChainDefinitionMap.put("/**", "user,onlineSession,syncOnlineSession");
|
||||
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
|
||||
|
||||
return shiroFilterFactoryBean;
|
||||
@@ -307,7 +297,7 @@ public class ShiroConfig
|
||||
public CaptchaValidateFilter captchaValidateFilter()
|
||||
{
|
||||
CaptchaValidateFilter captchaValidateFilter = new CaptchaValidateFilter();
|
||||
captchaValidateFilter.setCaptchaEbabled(captchaEbabled);
|
||||
captchaValidateFilter.setCaptchaEnabled(captchaEnabled);
|
||||
captchaValidateFilter.setCaptchaType(captchaType);
|
||||
return captchaValidateFilter;
|
||||
}
|
||||
@@ -336,17 +326,6 @@ public class ShiroConfig
|
||||
return cookieRememberMeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启Shiro代理
|
||||
*/
|
||||
@Bean
|
||||
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator()
|
||||
{
|
||||
DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
|
||||
proxyCreator.setProxyTargetClass(true);
|
||||
return proxyCreator;
|
||||
}
|
||||
|
||||
/**
|
||||
* thymeleaf模板引擎和shiro框架的整合
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.ruoyi.framework.datascope;
|
||||
|
||||
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.user.domain.User;
|
||||
|
||||
/**
|
||||
* 数据范围处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DataScopeUtils
|
||||
{
|
||||
/**
|
||||
* 全部数据权限
|
||||
*/
|
||||
public static final String DATA_SCOPE_ALL = "1";
|
||||
|
||||
/**
|
||||
* 自定数据权限
|
||||
*/
|
||||
public static final String DATA_SCOPE_CUSTOM = "2";
|
||||
|
||||
/**
|
||||
* 数据范围过滤
|
||||
*
|
||||
* @return 标准连接条件对象
|
||||
*/
|
||||
public static String dataScopeFilter()
|
||||
{
|
||||
return dataScopeFilter("u");
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据范围过滤
|
||||
*
|
||||
* @param da 部门表别名
|
||||
* @return 标准连接条件对象
|
||||
*/
|
||||
public static String dataScopeFilter(String da)
|
||||
{
|
||||
User user = ShiroUtils.getUser();
|
||||
// 如果是超级管理员,则不过滤数据
|
||||
if (user.isAdmin())
|
||||
{
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
StringBuilder sqlString = new StringBuilder();
|
||||
|
||||
for (Role role : user.getRoles())
|
||||
{
|
||||
String dataScope = role.getDataScope();
|
||||
if (DATA_SCOPE_ALL.equals(dataScope))
|
||||
{
|
||||
sqlString = new StringBuilder();
|
||||
break;
|
||||
}
|
||||
else if (DATA_SCOPE_CUSTOM.equals(dataScope))
|
||||
{
|
||||
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", da, role.getRoleId()));
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(sqlString.toString()))
|
||||
{
|
||||
return " AND (" + sqlString.substring(4) + ")";
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.framework.datasource;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
|
||||
/**
|
||||
* 动态数据源
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DynamicDataSource extends AbstractRoutingDataSource
|
||||
{
|
||||
public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources)
|
||||
{
|
||||
super.setDefaultTargetDataSource(defaultTargetDataSource);
|
||||
super.setTargetDataSources(targetDataSources);
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey()
|
||||
{
|
||||
return DynamicDataSourceContextHolder.getDateSoureType();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ruoyi.framework.datasource;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 数据源切换处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DynamicDataSourceContextHolder
|
||||
{
|
||||
public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
|
||||
|
||||
/**
|
||||
* 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
|
||||
* 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
|
||||
*/
|
||||
private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 设置数据源的变量
|
||||
*/
|
||||
public static void setDateSoureType(String dsType)
|
||||
{
|
||||
log.info("切换到{}数据源", dsType);
|
||||
CONTEXT_HOLDER.set(dsType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得数据源的变量
|
||||
*/
|
||||
public static String getDateSoureType()
|
||||
{
|
||||
return CONTEXT_HOLDER.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空数据源变量
|
||||
*/
|
||||
public static void clearDateSoureType()
|
||||
{
|
||||
CONTEXT_HOLDER.remove();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.framework.manager;
|
||||
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 异步任务管理器
|
||||
*
|
||||
* @author liuhulu
|
||||
*/
|
||||
public class AsyncManager
|
||||
{
|
||||
/**
|
||||
* 操作延迟10毫秒
|
||||
*/
|
||||
private final int OPERATE_DELAY_TIME = 10;
|
||||
|
||||
/**
|
||||
* 异步操作任务调度线程池
|
||||
*/
|
||||
private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5);
|
||||
|
||||
/**
|
||||
* 单例模式
|
||||
*/
|
||||
private static AsyncManager me = new AsyncManager();
|
||||
|
||||
public static AsyncManager me()
|
||||
{
|
||||
return me;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行任务
|
||||
*
|
||||
* @param 任务task
|
||||
*/
|
||||
public void execute(TimerTask task)
|
||||
{
|
||||
executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.ruoyi.framework.manager.factory;
|
||||
|
||||
import java.util.TimerTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.AddressUtils;
|
||||
import com.ruoyi.common.utils.LogUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.project.monitor.logininfor.domain.Logininfor;
|
||||
import com.ruoyi.project.monitor.logininfor.service.LogininforServiceImpl;
|
||||
import com.ruoyi.project.monitor.online.domain.OnlineSession;
|
||||
import com.ruoyi.project.monitor.online.domain.UserOnline;
|
||||
import com.ruoyi.project.monitor.online.service.IUserOnlineService;
|
||||
import com.ruoyi.project.monitor.operlog.domain.OperLog;
|
||||
import com.ruoyi.project.monitor.operlog.service.IOperLogService;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
|
||||
/**
|
||||
* 异步工厂(产生任务用)
|
||||
*
|
||||
* @author liuhulu
|
||||
*
|
||||
*/
|
||||
public class AsyncFactory
|
||||
{
|
||||
private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user");
|
||||
|
||||
/**
|
||||
* 同步session到数据库
|
||||
*
|
||||
* @param session 在线用户会话
|
||||
* @return 任务task
|
||||
*/
|
||||
public static TimerTask syncSessionToDb(final OnlineSession session)
|
||||
{
|
||||
return new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UserOnline online = new UserOnline();
|
||||
online.setSessionId(String.valueOf(session.getId()));
|
||||
online.setDeptName(session.getDeptName());
|
||||
online.setLoginName(session.getLoginName());
|
||||
online.setStartTimestamp(session.getStartTimestamp());
|
||||
online.setLastAccessTime(session.getLastAccessTime());
|
||||
online.setExpireTime(session.getTimeout());
|
||||
online.setIpaddr(session.getHost());
|
||||
online.setLonginLocation(AddressUtils.getRealAddressByIP(session.getHost()));
|
||||
online.setBrowser(session.getBrowser());
|
||||
online.setOs(session.getOs());
|
||||
online.setStatus(session.getStatus());
|
||||
online.setSession(session);
|
||||
SpringUtils.getBean(IUserOnlineService.class).saveOnline(online);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @param operLog 操作日志信息
|
||||
* @return 任务task
|
||||
*/
|
||||
public static TimerTask recordOper(final OperLog operLog)
|
||||
{
|
||||
return new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// 远程查询操作地点
|
||||
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
|
||||
SpringUtils.getBean(IOperLogService.class).insertOperlog(operLog);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登陆信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param status 状态
|
||||
* @param message 消息
|
||||
* @param args 列表
|
||||
* @return 任务task
|
||||
*/
|
||||
public static TimerTask recordLogininfor(final String username, final String status, final String message, final Object... args)
|
||||
{
|
||||
final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
|
||||
final String ip = ShiroUtils.getIp();
|
||||
return new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(LogUtils.getBlock(ip));
|
||||
s.append(AddressUtils.getRealAddressByIP(ip));
|
||||
s.append(LogUtils.getBlock(username));
|
||||
s.append(LogUtils.getBlock(status));
|
||||
s.append(LogUtils.getBlock(message));
|
||||
// 打印信息到日志
|
||||
sys_user_logger.info(s.toString(), args);
|
||||
// 获取客户端操作系统
|
||||
String os = userAgent.getOperatingSystem().getName();
|
||||
// 获取客户端浏览器
|
||||
String browser = userAgent.getBrowser().getName();
|
||||
// 封装对象
|
||||
Logininfor logininfor = new Logininfor();
|
||||
logininfor.setLoginName(username);
|
||||
logininfor.setIpaddr(ip);
|
||||
logininfor.setLoginLocation(AddressUtils.getRealAddressByIP(ip));
|
||||
logininfor.setBrowser(browser);
|
||||
logininfor.setOs(os);
|
||||
logininfor.setMsg(message);
|
||||
// 日志状态
|
||||
if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status))
|
||||
{
|
||||
logininfor.setStatus(Constants.SUCCESS);
|
||||
}
|
||||
else if (Constants.LOGIN_FAIL.equals(status))
|
||||
{
|
||||
logininfor.setStatus(Constants.FAIL);
|
||||
}
|
||||
// 插入数据
|
||||
SpringUtils.getBean(LogininforServiceImpl.class).insertLogininfor(logininfor);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ruoyi.framework.shiro.realm;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
@@ -54,12 +57,27 @@ public class UserRealm extends AuthorizingRealm
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0)
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
User user = ShiroUtils.getUser();
|
||||
// 角色列表
|
||||
Set<String> roles = new HashSet<String>();
|
||||
// 功能列表
|
||||
Set<String> menus = new HashSet<String>();
|
||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
||||
// 角色加入AuthorizationInfo认证对象
|
||||
info.setRoles(roleService.selectRoleKeys(userId));
|
||||
// 权限加入AuthorizationInfo认证对象
|
||||
info.setStringPermissions(menuService.selectPermsByUserId(userId));
|
||||
// 管理员拥有所有权限
|
||||
if (user.isAdmin())
|
||||
{
|
||||
info.addRole("admin");
|
||||
info.addStringPermission("*:*:*");
|
||||
}
|
||||
else
|
||||
{
|
||||
roles = roleService.selectRoleKeys(user.getUserId());
|
||||
menus = menuService.selectPermsByUserId(user.getUserId());
|
||||
// 角色加入AuthorizationInfo认证对象
|
||||
info.setRoles(roles);
|
||||
// 权限加入AuthorizationInfo认证对象
|
||||
info.setStringPermissions(menus);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,15 @@ import com.ruoyi.common.constant.ShiroConstants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.exception.user.CaptchaException;
|
||||
import com.ruoyi.common.exception.user.UserBlockedException;
|
||||
import com.ruoyi.common.exception.user.UserDeleteException;
|
||||
import com.ruoyi.common.exception.user.UserNotExistsException;
|
||||
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.SystemLogUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
import com.ruoyi.project.system.user.domain.UserStatus;
|
||||
import com.ruoyi.project.system.user.service.IUserService;
|
||||
@@ -41,20 +43,20 @@ public class LoginService
|
||||
// 验证码校验
|
||||
if (!StringUtils.isEmpty(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA)))
|
||||
{
|
||||
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
|
||||
throw new CaptchaException();
|
||||
}
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
|
||||
{
|
||||
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null")));
|
||||
throw new UserNotExistsException();
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
||||
{
|
||||
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
|
||||
@@ -62,7 +64,7 @@ public class LoginService
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
|
||||
{
|
||||
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
|
||||
@@ -79,20 +81,27 @@ public class LoginService
|
||||
user = userService.selectUserByEmail(username);
|
||||
}
|
||||
|
||||
if (user == null || UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
if (user == null)
|
||||
{
|
||||
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists")));
|
||||
throw new UserNotExistsException();
|
||||
}
|
||||
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.delete")));
|
||||
throw new UserDeleteException();
|
||||
}
|
||||
|
||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.blocked", user.getRemark())));
|
||||
throw new UserBlockedException(user.getRemark());
|
||||
}
|
||||
|
||||
passwordService.validate(user, password);
|
||||
|
||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.blocked", user.getRemark()));
|
||||
throw new UserBlockedException(user.getRemark());
|
||||
}
|
||||
SystemLogUtils.log(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
recordLoginInfo(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import org.apache.shiro.crypto.hash.Md5Hash;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
|
||||
import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.SystemLogUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
|
||||
/**
|
||||
@@ -52,13 +52,13 @@ public class PasswordService
|
||||
}
|
||||
if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue())
|
||||
{
|
||||
SystemLogUtils.log(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount)));
|
||||
throw new UserPasswordRetryLimitExceedException(Integer.valueOf(maxRetryCount).intValue());
|
||||
}
|
||||
|
||||
if (!matches(user, password))
|
||||
{
|
||||
SystemLogUtils.log(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount, password));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount, password)));
|
||||
loginRecordCache.put(loginName, retryCount);
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
@@ -85,17 +85,7 @@ public class PasswordService
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
//System.out.println(new PasswordService().encryptPassword("admin", "admin123", "111111"));
|
||||
//System.out.println(new PasswordService().encryptPassword("ry", "admin123", "222222"));
|
||||
System.out.println(new PasswordService().encryptPassword("ly", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("ce", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("zs", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("ls", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("ww", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("zl", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("sq", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("zb", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("wj", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("ys", "admin123", "123456"));
|
||||
System.out.println(new PasswordService().encryptPassword("admin", "admin123", "111111"));
|
||||
System.out.println(new PasswordService().encryptPassword("ry", "admin123", "222222"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.project.monitor.online.domain.OnlineSession;
|
||||
import com.ruoyi.project.monitor.online.domain.UserOnline;
|
||||
import com.ruoyi.project.monitor.online.service.IUserOnlineService;
|
||||
@@ -95,7 +97,7 @@ public class OnlineSessionDAO extends EnterpriseCacheSessionDAO
|
||||
{
|
||||
onlineSession.resetAttributeChanged();
|
||||
}
|
||||
onlineService.saveOnline(UserOnline.fromOnlineSession(onlineSession));
|
||||
AsyncManager.me().execute(AsyncFactory.syncSessionToDb(onlineSession));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,9 @@ import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.SystemLogUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,7 @@ import com.ruoyi.project.system.user.domain.User;
|
||||
public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(LogoutFilter.class);
|
||||
|
||||
|
||||
/**
|
||||
* 退出后重定向的地址
|
||||
*/
|
||||
@@ -46,12 +47,12 @@ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
|
||||
String redirectUrl = getRedirectUrl(request, response, subject);
|
||||
try
|
||||
{
|
||||
User user = (User) ShiroUtils.getSubjct().getPrincipal();
|
||||
User user = ShiroUtils.getUser();
|
||||
if (StringUtils.isNotNull(user))
|
||||
{
|
||||
String loginName = user.getLoginName();
|
||||
// 记录用户退出日志
|
||||
SystemLogUtils.log(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success")));
|
||||
}
|
||||
// 退出登录
|
||||
subject.logout();
|
||||
@@ -64,7 +65,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;
|
||||
}
|
||||
|
||||
+5
-5
@@ -20,16 +20,16 @@ public class CaptchaValidateFilter extends AccessControlFilter
|
||||
/**
|
||||
* 是否开启验证码
|
||||
*/
|
||||
private boolean captchaEbabled = true;
|
||||
private boolean captchaEnabled = true;
|
||||
|
||||
/**
|
||||
* 验证码类型
|
||||
*/
|
||||
private String captchaType = "math";
|
||||
|
||||
public void setCaptchaEbabled(boolean captchaEbabled)
|
||||
public void setCaptchaEnabled(boolean captchaEnabled)
|
||||
{
|
||||
this.captchaEbabled = captchaEbabled;
|
||||
this.captchaEnabled = captchaEnabled;
|
||||
}
|
||||
|
||||
public void setCaptchaType(String captchaType)
|
||||
@@ -40,7 +40,7 @@ public class CaptchaValidateFilter extends AccessControlFilter
|
||||
@Override
|
||||
public boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception
|
||||
{
|
||||
request.setAttribute(ShiroConstants.CURRENT_EBABLED, captchaEbabled);
|
||||
request.setAttribute(ShiroConstants.CURRENT_ENABLED, captchaEnabled);
|
||||
request.setAttribute(ShiroConstants.CURRENT_TYPE, captchaType);
|
||||
return super.onPreHandle(request, response, mappedValue);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class CaptchaValidateFilter extends AccessControlFilter
|
||||
{
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
// 验证码禁用 或不是表单提交 允许访问
|
||||
if (captchaEbabled == false || !"post".equals(httpServletRequest.getMethod().toLowerCase()))
|
||||
if (captchaEnabled == false || !"post".equals(httpServletRequest.getMethod().toLowerCase()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import com.ruoyi.common.constant.ShiroConstants;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
|
||||
@@ -4,7 +4,6 @@ import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import org.apache.shiro.web.filter.PathMatchingFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.ruoyi.common.constant.ShiroConstants;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.project.monitor.online.domain.OnlineSession;
|
||||
|
||||
+1
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class BaseController
|
||||
protected TableDataInfo getDataTable(List<?> list)
|
||||
{
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(0);
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(new PageInfo(list).getTotal());
|
||||
return rspData;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* Entity基类
|
||||
@@ -99,6 +100,10 @@ public class BaseEntity implements Serializable
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
params = Maps.newHashMap();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
@@ -106,5 +111,4 @@ public class BaseEntity implements Serializable
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,8 @@ public class TableDataInfo implements Serializable
|
||||
private long total;
|
||||
/** 列表数据 */
|
||||
private List<?> rows;
|
||||
/** 消息状态码 */
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 表格数据对象
|
||||
@@ -55,4 +57,13 @@ public class TableDataInfo implements Serializable
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,10 +1,5 @@
|
||||
package com.ruoyi.project.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -14,6 +9,7 @@ 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;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
@@ -29,8 +25,6 @@ public class CommonController
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
InputStream inputStream = null;
|
||||
OutputStream os = null;
|
||||
try
|
||||
{
|
||||
String filePath = ResourceUtils.getURL("classpath:").getPath() + "static/file/" + fileName;
|
||||
@@ -38,36 +32,16 @@ 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 = new FileInputStream(file);
|
||||
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);
|
||||
}
|
||||
if (delete && file.exists())
|
||||
{
|
||||
file.delete();
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("close close fail ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -50,7 +50,8 @@ public class JobController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "定时任务", action = BusinessType.EXPORT)
|
||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:job:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(Job job) throws Exception
|
||||
@@ -67,7 +68,7 @@ public class JobController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "定时任务", action = BusinessType.DELETE)
|
||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
@@ -88,7 +89,7 @@ public class JobController extends BaseController
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.UPDATE)
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
@@ -100,7 +101,7 @@ public class JobController extends BaseController
|
||||
/**
|
||||
* 任务调度立即执行一次
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.UPDATE)
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/run")
|
||||
@ResponseBody
|
||||
@@ -121,7 +122,7 @@ public class JobController extends BaseController
|
||||
/**
|
||||
* 新增保存调度
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.INSERT)
|
||||
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("monitor:job:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
@@ -143,7 +144,7 @@ public class JobController extends BaseController
|
||||
/**
|
||||
* 修改保存调度
|
||||
*/
|
||||
@Log(title = "定时任务", action = BusinessType.UPDATE)
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -48,7 +48,8 @@ public class JobLogController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "调度日志", action = BusinessType.EXPORT)
|
||||
@Log(title = "调度日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:job:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(JobLog jobLog) throws Exception
|
||||
@@ -65,7 +66,7 @@ public class JobLogController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "调度日志", action = BusinessType.DELETE)
|
||||
@Log(title = "调度日志", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.ruoyi.project.monitor.job.util;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("getCronTrigger 异常:", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -89,11 +89,11 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("createScheduleJob 异常:", e);
|
||||
}
|
||||
catch (TaskException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("createScheduleJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,11 +129,11 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("SchedulerException 异常:", e);
|
||||
}
|
||||
catch (TaskException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("SchedulerException 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("run 异常:", e);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("pauseJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("resumeJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class ScheduleUtils
|
||||
}
|
||||
catch (SchedulerException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
log.error("deleteScheduleJob 异常:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -48,7 +48,8 @@ public class LogininforController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登陆日志", action = BusinessType.EXPORT)
|
||||
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(Logininfor logininfor) throws Exception
|
||||
@@ -66,7 +67,7 @@ public class LogininforController extends BaseController
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:remove")
|
||||
@Log(title = "登陆日志", action = BusinessType.DELETE)
|
||||
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
|
||||
@@ -9,10 +9,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
@@ -56,7 +55,7 @@ public class UserOnlineController extends BaseController
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:batchForceLogout")
|
||||
@Log(title = "在线用户", action = BusinessType.FORCE)
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/batchForceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids)
|
||||
@@ -85,7 +84,7 @@ public class UserOnlineController extends BaseController
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:forceLogout")
|
||||
@Log(title = "在线用户", action = BusinessType.FORCE)
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/forceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult forceLogout(String sessionId)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.ruoyi.project.monitor.online.domain;
|
||||
|
||||
import com.ruoyi.common.utils.AddressUtils;
|
||||
import java.util.Date;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
import com.ruoyi.project.monitor.online.domain.OnlineSession.OnlineStatus;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 当前在线会话 sys_user_online
|
||||
@@ -49,27 +48,6 @@ public class UserOnline extends BaseEntity
|
||||
/** 备份的当前用户会话 */
|
||||
private OnlineSession session;
|
||||
|
||||
/**
|
||||
* 设置session对象
|
||||
*/
|
||||
public static final UserOnline fromOnlineSession(OnlineSession session)
|
||||
{
|
||||
UserOnline online = new UserOnline();
|
||||
online.setSessionId(String.valueOf(session.getId()));
|
||||
online.setDeptName(session.getDeptName());
|
||||
online.setLoginName(session.getLoginName());
|
||||
online.setStartTimestamp(session.getStartTimestamp());
|
||||
online.setLastAccessTime(session.getLastAccessTime());
|
||||
online.setExpireTime(session.getTimeout());
|
||||
online.setIpaddr(session.getHost());
|
||||
online.setLonginLocation(AddressUtils.getRealAddressByIP(session.getHost()));
|
||||
online.setBrowser(session.getBrowser());
|
||||
online.setOs(session.getOs());
|
||||
online.setStatus(session.getStatus());
|
||||
online.setSession(session);
|
||||
return online;
|
||||
}
|
||||
|
||||
public String getSessionId()
|
||||
{
|
||||
return sessionId;
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.apache.shiro.session.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.project.monitor.online.domain.UserOnline;
|
||||
import com.ruoyi.project.monitor.online.mapper.UserOnlineMapper;
|
||||
@@ -46,7 +47,7 @@ public class UserOnlineServiceImpl implements IUserOnlineService
|
||||
public void deleteOnlineById(String sessionId)
|
||||
{
|
||||
UserOnline userOnline = selectOnlineById(sessionId);
|
||||
if (userOnline != null)
|
||||
if (StringUtils.isNotNull(userOnline))
|
||||
{
|
||||
userOnlineDao.deleteOnlineById(sessionId);
|
||||
}
|
||||
@@ -64,7 +65,7 @@ public class UserOnlineServiceImpl implements IUserOnlineService
|
||||
for (String sessionId : sessions)
|
||||
{
|
||||
UserOnline userOnline = selectOnlineById(sessionId);
|
||||
if (userOnline != null)
|
||||
if (StringUtils.isNotNull(userOnline))
|
||||
{
|
||||
userOnlineDao.deleteOnlineById(sessionId);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -50,7 +50,8 @@ public class OperlogController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", action = BusinessType.EXPORT)
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:operlog:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(OperLog operLog) throws Exception
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.project.monitor.operlog.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
@@ -22,17 +21,17 @@ public class OperLog extends BaseEntity
|
||||
@Excel(name = "操作模块")
|
||||
private String title;
|
||||
|
||||
/** 操作类型 */
|
||||
@Excel(name = "操作类型")
|
||||
private String action;
|
||||
/** 操作业务类型 */
|
||||
@Excel(name = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
/** 请求方法 */
|
||||
@Excel(name = "请求方法")
|
||||
private String method;
|
||||
|
||||
/** 来源渠道 */
|
||||
@Excel(name = "来源渠道")
|
||||
private String channel;
|
||||
/** 操作人类别 */
|
||||
@Excel(name = "操作类别")
|
||||
private Integer operatorType;
|
||||
|
||||
/** 操作人员 */
|
||||
@Excel(name = "操作人员")
|
||||
@@ -60,7 +59,7 @@ public class OperLog extends BaseEntity
|
||||
|
||||
/** 状态0正常 1异常 */
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
private Integer status;
|
||||
|
||||
/** 错误消息 */
|
||||
@Excel(name = "错误消息")
|
||||
@@ -90,14 +89,14 @@ public class OperLog extends BaseEntity
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getAction()
|
||||
public Integer getBusinessType()
|
||||
{
|
||||
return action;
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public void setAction(String action)
|
||||
public void setBusinessType(Integer businessType)
|
||||
{
|
||||
this.action = action;
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public String getMethod()
|
||||
@@ -110,14 +109,14 @@ public class OperLog extends BaseEntity
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getChannel()
|
||||
public Integer getOperatorType()
|
||||
{
|
||||
return channel;
|
||||
return operatorType;
|
||||
}
|
||||
|
||||
public void setChannel(String channel)
|
||||
public void setOperatorType(Integer operatorType)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.operatorType = operatorType;
|
||||
}
|
||||
|
||||
public String getOperName()
|
||||
@@ -180,12 +179,12 @@ public class OperLog extends BaseEntity
|
||||
this.operParam = operParam;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
@@ -213,10 +212,10 @@ public class OperLog extends BaseEntity
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "OperLog [operId=" + operId + ", title=" + title + ", action=" + action + ", method=" + method
|
||||
+ ", channel=" + channel + ", operName=" + operName + ", deptName=" + deptName + ", operUrl=" + operUrl
|
||||
+ ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + operParam + ", status="
|
||||
+ status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]";
|
||||
return "OperLog [operId=" + operId + ", title=" + title + ", businessType=" + businessType + ", method="
|
||||
+ method + ", operatorType=" + operatorType + ", operName=" + operName + ", deptName=" + deptName
|
||||
+ ", operUrl=" + operUrl + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam="
|
||||
+ operParam + ", status=" + status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -53,7 +53,8 @@ public class ConfigController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", action = BusinessType.EXPORT)
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:config:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(Config config) throws Exception
|
||||
@@ -83,7 +84,7 @@ public class ConfigController extends BaseController
|
||||
* 新增保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "参数管理", action = BusinessType.INSERT)
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Config config)
|
||||
@@ -97,7 +98,7 @@ public class ConfigController extends BaseController
|
||||
@GetMapping("/edit/{configId}")
|
||||
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||
{
|
||||
mmap.addAttribute("config", configService.selectConfigById(configId));
|
||||
mmap.put("config", configService.selectConfigById(configId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ public class ConfigController extends BaseController
|
||||
* 修改保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "参数管理", action = BusinessType.UPDATE)
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(Config config)
|
||||
@@ -117,7 +118,7 @@ public class ConfigController extends BaseController
|
||||
* 删除参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "参数管理", action = BusinessType.DELETE)
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
@@ -132,12 +133,7 @@ public class ConfigController extends BaseController
|
||||
@ResponseBody
|
||||
public String checkConfigKeyUnique(Config config)
|
||||
{
|
||||
String uniqueFlag = "0";
|
||||
if (config != null)
|
||||
{
|
||||
uniqueFlag = configService.checkConfigKeyUnique(config);
|
||||
}
|
||||
return uniqueFlag;
|
||||
return configService.checkConfigKeyUnique(config);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,4 +82,11 @@ public class Config extends BaseEntity
|
||||
this.configType = configType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Config [configId=" + configId + ", configName=" + configName + ", configKey=" + configKey
|
||||
+ ", configValue=" + configValue + ", configType=" + configType + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.project.system.dept.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -11,12 +12,14 @@ 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.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.system.dept.domain.Dept;
|
||||
import com.ruoyi.project.system.dept.service.IDeptService;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
@@ -61,7 +64,7 @@ public class DeptController extends BaseController
|
||||
/**
|
||||
* 新增保存部门
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.INSERT)
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dept:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
@@ -83,7 +86,7 @@ public class DeptController extends BaseController
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.UPDATE)
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dept:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
@@ -95,7 +98,7 @@ public class DeptController extends BaseController
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(title = "部门管理", action = BusinessType.DELETE)
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dept:remove")
|
||||
@PostMapping("/remove/{deptId}")
|
||||
@ResponseBody
|
||||
@@ -119,12 +122,7 @@ public class DeptController extends BaseController
|
||||
@ResponseBody
|
||||
public String checkDeptNameUnique(Dept dept)
|
||||
{
|
||||
String uniqueFlag = "0";
|
||||
if (dept != null)
|
||||
{
|
||||
uniqueFlag = deptService.checkDeptNameUnique(dept);
|
||||
}
|
||||
return uniqueFlag;
|
||||
return deptService.checkDeptNameUnique(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +131,7 @@ public class DeptController extends BaseController
|
||||
@GetMapping("/selectDeptTree/{deptId}")
|
||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("treeName", deptService.selectDeptById(deptId).getDeptName());
|
||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
@@ -147,4 +145,15 @@ public class DeptController extends BaseController
|
||||
List<Map<String, Object>> tree = deptService.selectDeptTree();
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载角色部门(数据权限)列表树
|
||||
*/
|
||||
@GetMapping("/roleDeptTreeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> deptTreeData(Role role)
|
||||
{
|
||||
List<Map<String, Object>> tree = deptService.roleDeptTreeData(role);
|
||||
return tree;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,22 +10,36 @@ import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
public class Dept extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 父部门ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private String orderNum;
|
||||
|
||||
/** 负责人 */
|
||||
private String leader;
|
||||
|
||||
/** 联系电话 */
|
||||
private String phone;
|
||||
/** 邮箱 */
|
||||
private String email;
|
||||
|
||||
/** 部门状态:0正常,1停用 */
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 父部门名称 */
|
||||
private String parentName;
|
||||
|
||||
@@ -49,6 +63,16 @@ public class Dept extends BaseEntity
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getAncestors()
|
||||
{
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
public void setAncestors(String ancestors)
|
||||
{
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
|
||||
public String getDeptName()
|
||||
{
|
||||
return deptName;
|
||||
@@ -109,6 +133,16 @@ public class Dept extends BaseEntity
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
@@ -122,9 +156,9 @@ public class Dept extends BaseEntity
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Dept [deptId=" + deptId + ", parentId=" + parentId + ", deptName=" + deptName + ", orderNum=" + orderNum
|
||||
+ ", leader=" + leader + ", phone=" + phone + ", email=" + email + ", status=" + status
|
||||
+ ", parentName=" + parentName + "]";
|
||||
return "Dept [deptId=" + deptId + ", parentId=" + parentId + ", ancestors=" + ancestors + ", deptName="
|
||||
+ deptName + ", orderNum=" + orderNum + ", leader=" + leader + ", phone=" + phone + ", email=" + email
|
||||
+ ", status=" + status + ", parentName=" + parentName + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.project.system.dept.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.project.system.dept.domain.Dept;
|
||||
|
||||
/**
|
||||
@@ -29,17 +30,11 @@ public interface DeptMapper
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptList(Dept dept);
|
||||
|
||||
/**
|
||||
* 查询部门所有数据
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptAll();
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
@@ -64,6 +59,14 @@ public interface DeptMapper
|
||||
*/
|
||||
public int updateDept(Dept dept);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param depts 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptChildren(@Param("depts") List<Dept> depts);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
@@ -76,7 +79,16 @@ public interface DeptMapper
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
* @param deptName 部门名称
|
||||
* @param parentId 父部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public Dept checkDeptNameUnique(String deptName);
|
||||
public Dept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 部门列表
|
||||
*/
|
||||
public List<String> selectRoleDeptTree(Long roleId);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||
import com.ruoyi.framework.datascope.DataScopeUtils;
|
||||
import com.ruoyi.project.system.dept.domain.Dept;
|
||||
import com.ruoyi.project.system.dept.mapper.DeptMapper;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
|
||||
/**
|
||||
* 部门管理 服务实现
|
||||
@@ -31,20 +33,10 @@ public class DeptServiceImpl implements IDeptService
|
||||
@Override
|
||||
public List<Dept> selectDeptList(Dept dept)
|
||||
{
|
||||
dept.getParams().put("dataScope", DataScopeUtils.dataScopeFilter("d"));
|
||||
return deptMapper.selectDeptList(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门所有数据
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Dept> selectDeptAll()
|
||||
{
|
||||
return deptMapper.selectDeptAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门管理树
|
||||
*
|
||||
@@ -54,8 +46,47 @@ public class DeptServiceImpl implements IDeptService
|
||||
public List<Map<String, Object>> selectDeptTree()
|
||||
{
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
List<Dept> deptList = deptMapper.selectDeptAll();
|
||||
List<Dept> deptList = selectDeptList(new Dept());
|
||||
trees = getTrees(deptList, false, null);
|
||||
return trees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门(数据权限)
|
||||
*
|
||||
* @param role 角色对象
|
||||
* @return 部门列表(数据权限)
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> roleDeptTreeData(Role role)
|
||||
{
|
||||
Long roleId = role.getRoleId();
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
List<Dept> deptList = selectDeptList(new Dept());
|
||||
if (StringUtils.isNotNull(roleId))
|
||||
{
|
||||
List<String> roleDeptList = deptMapper.selectRoleDeptTree(roleId);
|
||||
trees = getTrees(deptList, true, roleDeptList);
|
||||
}
|
||||
else
|
||||
{
|
||||
trees = getTrees(deptList, false, null);
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象转部门树
|
||||
*
|
||||
* @param menuList 部门列表
|
||||
* @param isCheck 是否需要选中
|
||||
* @param roleDeptList 角色已存在菜单列表
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getTrees(List<Dept> deptList, boolean isCheck, List<String> roleDeptList)
|
||||
{
|
||||
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
for (Dept dept : deptList)
|
||||
{
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
|
||||
@@ -65,6 +96,14 @@ public class DeptServiceImpl implements IDeptService
|
||||
deptMap.put("pId", dept.getParentId());
|
||||
deptMap.put("name", dept.getDeptName());
|
||||
deptMap.put("title", dept.getDeptName());
|
||||
if (isCheck)
|
||||
{
|
||||
deptMap.put("checked", roleDeptList.contains(dept.getDeptId() + dept.getDeptName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
deptMap.put("checked", false);
|
||||
}
|
||||
trees.add(deptMap);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +158,9 @@ public class DeptServiceImpl implements IDeptService
|
||||
@Override
|
||||
public int insertDept(Dept dept)
|
||||
{
|
||||
Dept info = deptMapper.selectDeptById(dept.getParentId());
|
||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return deptMapper.insertDept(dept);
|
||||
}
|
||||
|
||||
@@ -132,10 +173,35 @@ public class DeptServiceImpl implements IDeptService
|
||||
@Override
|
||||
public int updateDept(Dept dept)
|
||||
{
|
||||
Dept info = deptMapper.selectDeptById(dept.getParentId());
|
||||
String ancestors = info.getAncestors() + "," + dept.getParentId();
|
||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||
dept.setAncestors(ancestors);
|
||||
updateDeptChildren(dept.getDeptId(), ancestors);
|
||||
return deptMapper.updateDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @param ancestors 元素列表
|
||||
*/
|
||||
public void updateDeptChildren(Long deptId, String ancestors)
|
||||
{
|
||||
Dept dept = new Dept();
|
||||
dept.setParentId(deptId);
|
||||
List<Dept> childrens = deptMapper.selectDeptList(dept);
|
||||
for (Dept children : childrens)
|
||||
{
|
||||
children.setAncestors(ancestors + "," + dept.getParentId());
|
||||
}
|
||||
if (childrens.size() > 0)
|
||||
{
|
||||
deptMapper.updateDeptChildren(childrens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
@@ -158,7 +224,7 @@ public class DeptServiceImpl implements IDeptService
|
||||
public String checkDeptNameUnique(Dept dept)
|
||||
{
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName());
|
||||
Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.project.system.dept.domain.Dept;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
|
||||
/**
|
||||
* 部门管理 服务层
|
||||
@@ -15,17 +16,11 @@ public interface IDeptService
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptList(Dept dept);
|
||||
|
||||
/**
|
||||
* 查询部门所有数据
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<Dept> selectDeptAll();
|
||||
|
||||
/**
|
||||
* 查询部门管理树
|
||||
*
|
||||
@@ -33,6 +28,14 @@ public interface IDeptService
|
||||
*/
|
||||
public List<Map<String, Object>> selectDeptTree();
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单
|
||||
*
|
||||
* @param role 角色对象
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Map<String, Object>> roleDeptTreeData(Role role);
|
||||
|
||||
/**
|
||||
* 查询部门人数
|
||||
*
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -50,7 +50,8 @@ public class DictDataController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", action = BusinessType.EXPORT)
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(DictData dictData) throws Exception
|
||||
@@ -80,7 +81,7 @@ public class DictDataController extends BaseController
|
||||
/**
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", action = BusinessType.INSERT)
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
@@ -102,7 +103,7 @@ public class DictDataController extends BaseController
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", action = BusinessType.UPDATE)
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
@@ -111,7 +112,7 @@ public class DictDataController extends BaseController
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", action = BusinessType.DELETE)
|
||||
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -50,7 +50,8 @@ public class DictTypeController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", action = BusinessType.EXPORT)
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(DictType dictType) throws Exception
|
||||
@@ -79,7 +80,7 @@ public class DictTypeController extends BaseController
|
||||
/**
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", action = BusinessType.INSERT)
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
@@ -101,7 +102,7 @@ public class DictTypeController extends BaseController
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", action = BusinessType.UPDATE)
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
@@ -110,7 +111,7 @@ public class DictTypeController extends BaseController
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", action = BusinessType.DELETE)
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
@@ -145,11 +146,6 @@ public class DictTypeController extends BaseController
|
||||
@ResponseBody
|
||||
public String checkDictTypeUnique(DictType dictType)
|
||||
{
|
||||
String uniqueFlag = "0";
|
||||
if (dictType != null)
|
||||
{
|
||||
uniqueFlag = dictTypeService.checkDictTypeUnique(dictType);
|
||||
}
|
||||
return uniqueFlag;
|
||||
return dictTypeService.checkDictTypeUnique(dictType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -87,4 +85,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public class DictDataServiceImpl implements IDictDataService
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
@Override
|
||||
public String selectDictLabel(String dictType, String dictValue)
|
||||
{
|
||||
return dictDataMapper.selectDictLabel(dictType, dictValue);
|
||||
|
||||
@@ -117,6 +117,8 @@ public class DictTypeServiceImpl implements IDictTypeService
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -131,7 +133,7 @@ public class DictTypeServiceImpl implements IDictTypeService
|
||||
{
|
||||
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||
DictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||
if (StringUtils.isNotNull(dictType) && dictType.getDictId() != dictId)
|
||||
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
|
||||
{
|
||||
return UserConstants.DICT_TYPE_NOT_UNIQUE;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public interface IDictTypeService
|
||||
*
|
||||
* @param ids 需要删除的数据
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public int deleteDictTypeByIds(String ids) throws Exception;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.system.menu.domain.Menu;
|
||||
@@ -53,7 +53,7 @@ public class MenuController extends BaseController
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.DELETE)
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:menu:remove")
|
||||
@PostMapping("/remove/{menuId}")
|
||||
@ResponseBody
|
||||
@@ -94,7 +94,7 @@ public class MenuController extends BaseController
|
||||
/**
|
||||
* 新增保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.INSERT)
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:menu:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
@@ -116,7 +116,7 @@ public class MenuController extends BaseController
|
||||
/**
|
||||
* 修改保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", action = BusinessType.UPDATE)
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:menu:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
@@ -141,12 +141,7 @@ public class MenuController extends BaseController
|
||||
@ResponseBody
|
||||
public String checkMenuNameUnique(Menu menu)
|
||||
{
|
||||
String uniqueFlag = "0";
|
||||
if (menu != null)
|
||||
{
|
||||
uniqueFlag = menuService.checkMenuNameUnique(menu);
|
||||
}
|
||||
return uniqueFlag;
|
||||
return menuService.checkMenuNameUnique(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +172,7 @@ public class MenuController extends BaseController
|
||||
@GetMapping("/selectMenuTree/{menuId}")
|
||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("treeName", menuService.selectMenuById(menuId).getMenuName());
|
||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||
return prefix + "/tree";
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class Menu extends BaseEntity
|
||||
/** 类型:0目录,1菜单,2按钮 */
|
||||
private String menuType;
|
||||
/** 菜单状态:0显示,1隐藏 */
|
||||
private Integer visible;
|
||||
private String visible;
|
||||
/** 权限字符串 */
|
||||
private String perms;
|
||||
/** 菜单图标 */
|
||||
@@ -105,12 +105,12 @@ public class Menu extends BaseEntity
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public Integer getVisible()
|
||||
public String getVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(Integer visible)
|
||||
public void setVisible(String visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.project.system.menu.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.project.system.menu.domain.Menu;
|
||||
|
||||
/**
|
||||
@@ -11,6 +12,20 @@ import com.ruoyi.project.system.menu.domain.Menu;
|
||||
public interface MenuMapper
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询系统所有菜单(含按钮)
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuAll();
|
||||
|
||||
/**
|
||||
* 查询系统正常显示菜单(不含按钮)
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuNormalAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
@@ -34,21 +49,15 @@ public interface MenuMapper
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<String> selectMenuTree(Long roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuList(Menu menu);
|
||||
|
||||
/**
|
||||
* 查询系统所有菜单
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuAll();
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
@@ -64,7 +73,7 @@ public interface MenuMapper
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public Menu selectMenuById(Long menuId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询菜单数量
|
||||
*
|
||||
@@ -80,7 +89,7 @@ public interface MenuMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(Menu menu);
|
||||
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
@@ -88,13 +97,14 @@ public interface MenuMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(Menu menu);
|
||||
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
* @param menuName 菜单名称
|
||||
* @param parentId 父菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public Menu checkMenuNameUnique(String menuName);
|
||||
public Menu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.ruoyi.project.system.menu.service;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.project.system.menu.domain.Menu;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
|
||||
/**
|
||||
* 菜单 业务层
|
||||
@@ -18,14 +18,15 @@ public interface IMenuService
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param user 用户信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenusByUserId(Long userId);
|
||||
public List<Menu> selectMenusByUser(User user);
|
||||
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<Menu> selectMenuList(Menu menu);
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -19,6 +20,7 @@ import com.ruoyi.project.system.menu.domain.Menu;
|
||||
import com.ruoyi.project.system.menu.mapper.MenuMapper;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import com.ruoyi.project.system.role.mapper.RoleMenuMapper;
|
||||
import com.ruoyi.project.system.user.domain.User;
|
||||
|
||||
/**
|
||||
* 菜单 业务层处理
|
||||
@@ -37,15 +39,24 @@ public class MenuServiceImpl implements IMenuService
|
||||
private RoleMenuMapper roleMenuMapper;
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
* 根据用户查询菜单
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param userId 用户信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<Menu> selectMenusByUserId(Long userId)
|
||||
public List<Menu> selectMenusByUser(User user)
|
||||
{
|
||||
List<Menu> menus = menuMapper.selectMenusByUserId(userId);
|
||||
List<Menu> menus = new LinkedList<Menu>();
|
||||
// 管理员显示所有菜单信息
|
||||
if (user.isAdmin())
|
||||
{
|
||||
menus = menuMapper.selectMenuNormalAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
menus = menuMapper.selectMenusByUserId(user.getUserId());
|
||||
}
|
||||
return TreeUtils.getChildPerms(menus, 0);
|
||||
}
|
||||
|
||||
@@ -119,7 +130,6 @@ public class MenuServiceImpl implements IMenuService
|
||||
/**
|
||||
* 查询所有菜单
|
||||
*
|
||||
* @param role 角色对象
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
@@ -282,7 +292,7 @@ public class MenuServiceImpl implements IMenuService
|
||||
public String checkMenuNameUnique(Menu menu)
|
||||
{
|
||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||
Menu info = menuMapper.checkMenuNameUnique(menu.getMenuName());
|
||||
Menu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
|
||||
{
|
||||
return UserConstants.MENU_NAME_NOT_UNIQUE;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -65,7 +65,7 @@ public class NoticeController extends BaseController
|
||||
* 新增保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", action = BusinessType.INSERT)
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Notice notice)
|
||||
@@ -87,7 +87,7 @@ public class NoticeController extends BaseController
|
||||
* 修改保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:edit")
|
||||
@Log(title = "通知公告", action = BusinessType.UPDATE)
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(Notice notice)
|
||||
@@ -99,7 +99,7 @@ public class NoticeController extends BaseController
|
||||
* 删除公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:remove")
|
||||
@Log(title = "通知公告", action = BusinessType.DELETE)
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -50,7 +50,8 @@ public class PostController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", action = BusinessType.EXPORT)
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:post:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(Post post) throws Exception
|
||||
@@ -68,7 +69,7 @@ public class PostController extends BaseController
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:post:remove")
|
||||
@Log(title = "岗位管理", action = BusinessType.DELETE)
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
@@ -96,7 +97,7 @@ public class PostController extends BaseController
|
||||
* 新增保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:add")
|
||||
@Log(title = "岗位管理", action = BusinessType.INSERT)
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(Post post)
|
||||
@@ -118,7 +119,7 @@ public class PostController extends BaseController
|
||||
* 修改保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:edit")
|
||||
@Log(title = "岗位管理", action = BusinessType.UPDATE)
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(Post post)
|
||||
@@ -126,4 +127,24 @@ public class PostController extends BaseController
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*/
|
||||
@PostMapping("/checkPostNameUnique")
|
||||
@ResponseBody
|
||||
public String checkPostNameUnique(Post post)
|
||||
{
|
||||
return postService.checkPostNameUnique(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*/
|
||||
@PostMapping("/checkPostCodeUnique")
|
||||
@ResponseBody
|
||||
public String checkPostCodeUnique(Post post)
|
||||
{
|
||||
return postService.checkPostCodeUnique(post);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,4 +66,20 @@ public interface PostMapper
|
||||
*/
|
||||
public int insertPost(Post post);
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
* @param postName 岗位名称
|
||||
* @return 结果
|
||||
*/
|
||||
public Post checkPostNameUnique(String postName);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
* @param postCode 岗位编码
|
||||
* @return 结果
|
||||
*/
|
||||
public Post checkPostCodeUnique(String postCode);
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ public interface IPostService
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public int deletePostByIds(String ids) throws Exception;
|
||||
|
||||
@@ -71,4 +73,20 @@ public interface IPostService
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPostNameUnique(Post post);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPostCodeUnique(Post post);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ 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.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.post.domain.Post;
|
||||
import com.ruoyi.project.system.post.mapper.PostMapper;
|
||||
@@ -61,7 +63,7 @@ public class PostServiceImpl implements IPostService
|
||||
{
|
||||
for (Post userRole : userPosts)
|
||||
{
|
||||
if (post.getPostId() == userRole.getPostId())
|
||||
if (post.getPostId().longValue() == userRole.getPostId().longValue())
|
||||
{
|
||||
post.setFlag(true);
|
||||
break;
|
||||
@@ -142,4 +144,40 @@ public class PostServiceImpl implements IPostService
|
||||
return userPostMapper.countUserPostById(postId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位名称是否唯一
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostNameUnique(Post post)
|
||||
{
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
Post info = postMapper.checkPostNameUnique(post.getPostName());
|
||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
||||
{
|
||||
return UserConstants.POST_NAME_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.POST_NAME_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位编码是否唯一
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostCodeUnique(Post post)
|
||||
{
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
Post info = postMapper.checkPostCodeUnique(post.getPostCode());
|
||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
||||
{
|
||||
return UserConstants.POST_CODE_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.POST_CODE_UNIQUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
@@ -52,7 +52,8 @@ public class RoleController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", action = BusinessType.EXPORT)
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:role:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(Role role) throws Exception
|
||||
@@ -82,7 +83,7 @@ public class RoleController extends BaseController
|
||||
* 新增保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", action = BusinessType.INSERT)
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
@@ -106,7 +107,7 @@ public class RoleController extends BaseController
|
||||
* 修改保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", action = BusinessType.UPDATE)
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
@@ -115,8 +116,31 @@ public class RoleController extends BaseController
|
||||
return toAjax(roleService.updateRole(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据权限
|
||||
*/
|
||||
@GetMapping("/rule/{roleId}")
|
||||
public String rule(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/rule";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/rule")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult ruleSave(Role role)
|
||||
{
|
||||
return toAjax(roleService.updateRule(role));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:remove")
|
||||
@Log(title = "角色管理", action = BusinessType.DELETE)
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
@@ -138,12 +162,17 @@ public class RoleController extends BaseController
|
||||
@ResponseBody
|
||||
public String checkRoleNameUnique(Role role)
|
||||
{
|
||||
String uniqueFlag = "0";
|
||||
if (role != null)
|
||||
{
|
||||
uniqueFlag = roleService.checkRoleNameUnique(role);
|
||||
}
|
||||
return uniqueFlag;
|
||||
return roleService.checkRoleNameUnique(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色权限
|
||||
*/
|
||||
@PostMapping("/checkRoleKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleKeyUnique(Role role)
|
||||
{
|
||||
return roleService.checkRoleKeyUnique(role);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user