mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
Compare commits
371 Commits
Author | SHA1 | Date | |
---|---|---|---|
ebc6617a8e | |||
dbba894544 | |||
65eb873f9a | |||
52673152cc | |||
36fd16562e | |||
a8a4f2101d | |||
f46bd8b6ba | |||
a627de02c7 | |||
a94a0589dd | |||
81755a280d | |||
89d776acb5 | |||
daf660e66d | |||
e4020faff3 | |||
e11b727584 | |||
0a36a94b73 | |||
89e7cb19b9 | |||
fa2bdcd5ac | |||
ea71c9b214 | |||
c00e397405 | |||
a2a2640d29 | |||
7c4a104823 | |||
7892ec5a59 | |||
e5fd1f76db | |||
6502f21072 | |||
48fd65d7f8 | |||
1010ccca4d | |||
c21ff85b57 | |||
c3bb4d2a61 | |||
d2b7f8ef0f | |||
af25588b88 | |||
7546ef649c | |||
2a3bf1d994 | |||
664192da0b | |||
9fc3e220a7 | |||
64f6a69d9a | |||
16734b1d88 | |||
31106c91fb | |||
026a427103 | |||
7a4f36c00e | |||
1f3ef4ffe1 | |||
c364836a9d | |||
97a12075b1 | |||
bafb1372a7 | |||
b4f032fab4 | |||
d36d944b3a | |||
7af22453ba | |||
d0c4b5bc76 | |||
4f194aa101 | |||
ef4bfde4a8 | |||
65a1245a03 | |||
486e4f8dd3 | |||
4cfbd8a9d2 | |||
7ab51b8960 | |||
18cbd96280 | |||
2cdea69719 | |||
6c053b6266 | |||
20eea9914e | |||
6d3f4f5a04 | |||
20e782eb21 | |||
e30fa57ab4 | |||
ef0b07d5c4 | |||
b9b1ec8f41 | |||
019526fbe9 | |||
421593c0ba | |||
91ad85aec1 | |||
d1eacc1d1c | |||
e41dd8a0f1 | |||
5e1d4f215d | |||
9a7bb81cd0 | |||
321bb010cb | |||
e24a79f87b | |||
2dd0add3e7 | |||
ce279ca360 | |||
fcf606acde | |||
084907eeca | |||
f8487f581b | |||
40c9559d9e | |||
531e0ef918 | |||
2781655b0a | |||
64add90edd | |||
8de93d35ed | |||
eb844e3260 | |||
cedd2d1daf | |||
81d04fb31f | |||
caba6fb01e | |||
1c8d44b309 | |||
984098abce | |||
ead6da4760 | |||
2ab96587ef | |||
cb9c0e79eb | |||
96d2b2d6b8 | |||
b374ff4d6d | |||
149b136e0b | |||
5389663b72 | |||
f99e24bf82 | |||
a610c5c8c6 | |||
874cf18566 | |||
53cb0826bc | |||
6904f38ea2 | |||
223ff4ebff | |||
d2ec3e7d9a | |||
b00171366f | |||
4e817a1109 | |||
d185d4e4cc | |||
3b574875cb | |||
4d5048435c | |||
57df7f8dfe | |||
74b36fbd98 | |||
8ea56d3b22 | |||
019f585c83 | |||
c7c9bd6b08 | |||
b132f04f71 | |||
2f21f293c1 | |||
5b3c390e08 | |||
8a93371baa | |||
95dcae1a85 | |||
03e2ff587e | |||
1ea73a67ca | |||
1d32420a27 | |||
9aa8438ced | |||
0b35927b16 | |||
bbbe83b737 | |||
06f06ce390 | |||
cc4c52c998 | |||
bd09e5b11c | |||
181f62c15e | |||
a2c8b0d13e | |||
c4e17ff847 | |||
3ae5ec92a5 | |||
2fe919b6ce | |||
a8ab3ffd01 | |||
2c6e1f0db7 | |||
cd0aad10b0 | |||
da2cb61cae | |||
e4c691fd5f | |||
ea2e560bd9 | |||
25321984fa | |||
afbe1c98e6 | |||
d6e080d546 | |||
5c6f30a8a9 | |||
e8e8ae9fd7 | |||
3353ead5d3 | |||
160beb8e1c | |||
3f0d3ffb8a | |||
13c770b6be | |||
2eb55528ec | |||
839f631d6b | |||
8faae71157 | |||
b87e0fa124 | |||
bb205a5cdb | |||
7e3c9c1094 | |||
dbb2d8462b | |||
3bf96c6cd7 | |||
61375c4bbb | |||
2e4689d557 | |||
b6596d021b | |||
0628dc9b2f | |||
3117080be3 | |||
16d6e11e94 | |||
790aa0d24b | |||
d254340b9b | |||
42a3117e2a | |||
e47dcb10de | |||
8a7dcf8a80 | |||
0c30ffa11f | |||
0904bf6446 | |||
2173ed504d | |||
4583787759 | |||
17550a5f4b | |||
a4558c32b2 | |||
ef4fef3d56 | |||
3dbbc6a223 | |||
d3696f5223 | |||
b8a8b76c38 | |||
296e6171a1 | |||
2d7d137abd | |||
336adbd056 | |||
32bfe334c0 | |||
c1c4fb2ca4 | |||
6c9dc9ae51 | |||
f4b619d1d1 | |||
255c8a083e | |||
d0700172fa | |||
83ce927d16 | |||
809774d87c | |||
6f3f89a0d3 | |||
a870a1c6bc | |||
e04938666c | |||
c0eb3c53c1 | |||
b6443e0c01 | |||
83922c5737 | |||
78cd6f36ef | |||
eed4e09282 | |||
aaa15b403a | |||
82f1f5d0cf | |||
2b0452207e | |||
bc67d0b7b7 | |||
a8092ace32 | |||
12d76e4f20 | |||
c60130e534 | |||
3eeeb27d70 | |||
c2a179e9dd | |||
8b6f7b4e4c | |||
ce7097b498 | |||
60404a6564 | |||
519ea854d5 | |||
e66d0e4f74 | |||
9e0ec2b03c | |||
36e501b457 | |||
284f47e76c | |||
b47f8fd784 | |||
37a8addf52 | |||
a6fb88d74c | |||
bb43b2853d | |||
ba1585de34 | |||
6684812014 | |||
1419700c43 | |||
14f6249031 | |||
ea249c33fd | |||
1c0b410f55 | |||
1eaea5c81c | |||
64ec206ecb | |||
e7afea4cb7 | |||
6d6271d6c9 | |||
cbb0c98f98 | |||
aaf9f57459 | |||
2006e5e51e | |||
741a5b275b | |||
eb4376b649 | |||
b1e5ebab8f | |||
8bd6296721 | |||
ae5c68368b | |||
4fdb0f48ec | |||
c4207f640b | |||
f6e477b4f5 | |||
7ae47b50b8 | |||
0b14155a75 | |||
f1fed76273 | |||
48813161f6 | |||
a006904724 | |||
5477ce3c39 | |||
f38d7811e3 | |||
a09f1b8666 | |||
c7071752a7 | |||
29163a41c2 | |||
c0e4e27dcc | |||
3401f38edc | |||
85762f7c92 | |||
3f142dd0fa | |||
22b4f87232 | |||
ca5823fcdf | |||
49fc74be5d | |||
25f50d74c5 | |||
266f4d6806 | |||
a6a9814c06 | |||
5a8d3ddef0 | |||
99dcbe0207 | |||
75b22e9a23 | |||
c4f8c1b296 | |||
eecefdc4fa | |||
ded99502ae | |||
02b95f95a8 | |||
2a6d2d733e | |||
3434610349 | |||
bcac70b2ab | |||
369438a46d | |||
aed8969498 | |||
4a8781f4d9 | |||
bff9d0560d | |||
36f8eb71f3 | |||
f7982ede73 | |||
92804151a3 | |||
0f2caf1cb6 | |||
8a81f37d22 | |||
125547f08f | |||
30c89b33fe | |||
7479ff4b06 | |||
9801e9c29a | |||
821f40882f | |||
02ce9868a7 | |||
6f870e11ff | |||
a8f2ff4531 | |||
eaa3baab3c | |||
77bce8b1e8 | |||
6480282826 | |||
6197ad5090 | |||
b477e40d3c | |||
7c8eae3735 | |||
f8cc7ce328 | |||
1a5881b1d0 | |||
071c4c1412 | |||
03b31652a2 | |||
852bc4887a | |||
fa124aeb8b | |||
258335cc65 | |||
bdebca94b3 | |||
f85bad3388 | |||
e9b0289eff | |||
40984e201e | |||
76bf987203 | |||
3b42abef44 | |||
26f0737c60 | |||
ac94242875 | |||
54bfa627f0 | |||
36c058188a | |||
5306a45093 | |||
a292cccb63 | |||
5ccd9877b4 | |||
7108ec41b5 | |||
5188d56b4a | |||
8f7ed66544 | |||
c99b9262a8 | |||
2ccbaf9143 | |||
d54ab2733c | |||
2f18d0d709 | |||
41c75a808a | |||
1e55853036 | |||
931ed0eb00 | |||
9342bbef56 | |||
aaae404b2a | |||
f3a8b4625f | |||
4021020d3b | |||
2569e8c0a4 | |||
dcaeb18870 | |||
30fe14c0ff | |||
089b3d6e6d | |||
17b90f8381 | |||
f9c62fc23b | |||
900867df02 | |||
12ab8b03d9 | |||
50599487f8 | |||
2b53e9d86a | |||
23270c60bc | |||
2cb6709323 | |||
917bc03a43 | |||
c6963e1a96 | |||
d71e35893d | |||
efd277e7ed | |||
dbe3446b63 | |||
d3d3972bea | |||
5285735c7a | |||
b84e7013d2 | |||
9bc5414b44 | |||
6e28683411 | |||
b27a8afc3b | |||
ed7e8d0e5c | |||
662251e208 | |||
e314a5e333 | |||
a0c165c418 | |||
c604c2de98 | |||
d6107025fa | |||
a7ecfb68c1 | |||
188d27159d | |||
2af534eea4 | |||
db193a46e8 | |||
808bb9a958 | |||
eca8ea1eb6 | |||
d9681e1791 | |||
7f96363ecb | |||
04c340627d | |||
c1c6c1cf30 | |||
b47a38d9d8 | |||
5bb7b0dda5 | |||
61edd5588e | |||
e1c993c277 | |||
15abd4d053 | |||
a7376b36f8 | |||
d2b61762b7 | |||
a5e38f6f99 | |||
4988b585f8 | |||
b35f708c07 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -29,7 +29,6 @@ target/
|
|||||||
nbproject/private/
|
nbproject/private/
|
||||||
build/*
|
build/*
|
||||||
nbbuild/
|
nbbuild/
|
||||||
dist/
|
|
||||||
nbdist/
|
nbdist/
|
||||||
.nb-gradle/
|
.nb-gradle/
|
||||||
|
|
||||||
|
154
README.md
154
README.md
@ -4,39 +4,48 @@
|
|||||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
|
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
|
||||||
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
|
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
|
||||||
<br>
|
<br>
|
||||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
|
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
|
[]()
|
||||||
|
|
||||||
RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期与 RuoYi-Vue 同步
|
> RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架)
|
||||||
|
|
||||||
集成 Lock4j dynamic-datasource OSS存储 等分布式场景解决方案
|
> 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/系统演示?sort_id=4836388)
|
||||||
|
|
||||||
集成 Mybatis-Plus Lombok Hutool 等便捷开发工具 适配重写相关业务 便于开发
|
| 功能介绍 | 使用技术 | 文档地址 | 特性注意事项 |
|
||||||
|
|---|---|---|---|
|
||||||
* 前端开发框架 Vue、Element UI
|
| 当前框架 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | 重写RuoYi-Vue全方位升级(不兼容原框架) |
|
||||||
* 后端开发框架 Spring Boot、Redis
|
| satoken分支 | RuoYi-Vue-Plus-satoken | [satoken分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/satoken/) | 使用satoken重构权限鉴权(公测 可尝试上生产) |
|
||||||
* 容器框架 Undertow 基于 Netty 的高性能容器
|
| 单体分支 | RuoYi-Vue-Plus-fast | [fast分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) | 单体应用结构 |
|
||||||
* 权限认证框架 Spring Security、Jwt,支持多终端认证系统
|
| 原框架 | RuoYi-Vue | [RuoYi-Vue官网](http://ruoyi.vip/) | 定期同步需要的功能 |
|
||||||
* 关系数据库 MySQL 适配 8.X
|
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
|
||||||
* 缓存数据库 Redis 适配 6.X
|
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
|
||||||
* 数据库框架 Mybatis-Plus 快速 CRUD 增加开发效率 插件化支持各类需求
|
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 Netty 的高性能容器 |
|
||||||
* 数据库框架 多数据源框架 dynamic-datasource 支持主从与多种类数据库异构
|
| 权限认证框架 | Spring Security、Jwt | [SpringSecurity官网](https://spring.io/projects/spring-security#learn) | 支持多终端认证系统 |
|
||||||
* 数据库框架 Redis客户端 采用 Redisson 性能更强
|
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
|
||||||
* 数据库框架 性能分析插件 p6spy 更强劲的 SQL 分析
|
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 4.X |
|
||||||
* 序列化框架 统一使用 jackson 高效可靠
|
| 数据库框架 | Mybatis-Plus | [Mybatis-Plus文档](https://baomidou.com/guide/) | 快速 CRUD 增加开发效率 |
|
||||||
* 网络框架 Feign、OkHttp3 接口化管理 HTTP 请求
|
| 数据库框架 | p6spy | [p6spy官网](https://p6spy.readthedocs.io/) | 更强劲的 SQL 分析 |
|
||||||
* 分布式锁 Lock4j 注解锁、工具锁 多种多样
|
| 多数据源框架 | dynamic-datasource | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content) | 支持主从与多种类数据库异构 |
|
||||||
* 文件存储 OSS 对象存储模块 支持(Minio、七牛、阿里、腾讯)
|
| 序列化框架 | Jackson | [Jackson官网](https://github.com/FasterXML/jackson) | 统一使用 jackson 高效可靠 |
|
||||||
* 监控框架 spring-boot-admin 全方位服务监控
|
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
|
||||||
* 校验框架 validation 增强接口安全性 严谨性
|
| 分布式限流 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 全局、请求IP、集群ID 多种限流 |
|
||||||
* Excel框架 Alibaba EasyExcel 性能优异 扩展性强
|
| 分布式锁 | Lock4j | [Lock4j官网](https://gitee.com/baomidou/lock4j) | 注解锁、工具锁 多种多样 |
|
||||||
* 文档框架 knife4j 美化接口文档
|
| 分布式幂等 | Redisson | [Lock4j文档](https://gitee.com/baomidou/lock4j) | 拦截重复提交 |
|
||||||
* 工具类框架 Hutool、Lombok 减少代码冗余 增加安全性
|
| 分布式日志 | TLog | [TLog文档](https://yomahub.com/tlog/docs) | 支持跟踪链路日志记录、性能分析、链路排查 |
|
||||||
* 代码生成器 一键生成前后端代码
|
| 分布式任务调度 | Xxl-Job | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/) | 高性能 高可靠 易扩展 |
|
||||||
* 部署方式 Docker 容器编排 一键部署业务集群
|
| 文件存储 | Minio | [Minio文档](https://docs.min.io/) | 本地存储 |
|
||||||
* 国际化 Spring 标准国际化方解决方案
|
| 文件存储 | 七牛、阿里、腾讯 | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储 |
|
||||||
|
| 监控框架 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 |
|
||||||
|
| 校验框架 | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 |
|
||||||
|
| Excel框架 | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 |
|
||||||
|
| 文档框架 | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 |
|
||||||
|
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
|
||||||
|
| 代码生成器 | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 |
|
||||||
|
| 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
|
||||||
|
| 国际化 | SpringMessage | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc) | Spring标准国际化方案 |
|
||||||
|
|
||||||
## 参考文档
|
## 参考文档
|
||||||
|
|
||||||
@ -53,54 +62,20 @@ RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期
|
|||||||
|
|
||||||
## 软件架构图
|
## 软件架构图
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 贡献代码
|
## 贡献代码
|
||||||
|
|
||||||
欢迎各路英雄豪杰 `PR` 代码 请提交到 `dev` 开发分支 统一测试发版
|
欢迎各路英雄豪杰 `PR` 代码 请提交到 `dev` 开发分支 统一测试发版
|
||||||
|
|
||||||
框架定位为 `通用后台管理系统(分布式集群强化)` 原则上不接受业务 `PR`
|
框架定位为 `通用后台管理系统(分布式集群强化)` 原则上不接受业务 `PR`
|
||||||
|
|
||||||
## 修改RuoYi功能
|
|
||||||
### 依赖改动
|
|
||||||
|
|
||||||
* ORM框架 使用 Mybatis-Plus 简化CRUD (不支持主子表)
|
|
||||||
* Bean简化 使用 Lombok 简化 get set toString 等等
|
|
||||||
* 容器改动 Tomcat 改为 并发性能更好的 undertow
|
|
||||||
* 移除 pagehelper 改为 Mybatis-Plus 分页
|
|
||||||
* 集成 p6spy 更强劲的 SQL 分析
|
|
||||||
* 升级 swagger 为 knife4j
|
|
||||||
* 集成 Hutool 5.X 并重写RuoYi部分功能
|
|
||||||
* 集成 Feign 接口化管理 Http 请求(如三方请求 支付,短信,推送等)
|
|
||||||
* 移除 自带服务监控 改为 spring-boot-admin 全方位监控
|
|
||||||
* 增加 demo 模块示例(给不会增加模块的小伙伴做参考)
|
|
||||||
* 增加 redisson 高性能 Redis 客户端
|
|
||||||
* 移除 fastjson 统一使用 jackson 序列化
|
|
||||||
* 集成 dynamic-datasource 多数据源(默认支持MySQL,其他种类需自行适配)
|
|
||||||
* 集成 Lock4j 实现分布式 注解锁、工具锁 多种多样
|
|
||||||
* 增加 Docker 容器编排 打包插件与部署脚本
|
|
||||||
* 移除 通用上传下载 改为 OSS对象存储 支持(Minio、七牛、阿里、腾讯)
|
|
||||||
* 移除 RuoYi自带 Excel 工具 改为 EasyExcel 工具
|
|
||||||
|
|
||||||
### 代码改动
|
|
||||||
|
|
||||||
* 所有原生功能使用 Mybatis-Plus 与 Lombok 重写
|
|
||||||
* 增加 IServicePlus 与 BaseMapperPlus 可自定义通用方法
|
|
||||||
* 代码生成模板 改为适配 Mybatis-Plus 的代码
|
|
||||||
* 代码生成模板 根据 Alibaba 代码规约 拆分出 VO、BO 等领域对象
|
|
||||||
* 代码生成模板 增加 文档注解 与 校验注解 简化通用操作
|
|
||||||
* 项目修改为 maven多环境配置
|
|
||||||
* 项目配置修改为 application.yml 统一管理
|
|
||||||
* 数据权限修改为 适配支持单表、多表
|
|
||||||
* 使用 redisson 实现 spring-cache 整合
|
|
||||||
* 增加 mybatis-plus 二级缓存 redis 存储
|
|
||||||
|
|
||||||
### 其他
|
### 其他
|
||||||
|
|
||||||
* 同步升级 RuoYi-Vue
|
* 同步升级 RuoYi-Vue
|
||||||
* GitHub 地址 [RuoYi-Vue-Plus-github](https://github.com/JavaLionLi/RuoYi-Vue-Plus)
|
* GitHub 地址 [RuoYi-Vue-Plus-github](https://github.com/JavaLionLi/RuoYi-Vue-Plus)
|
||||||
* 单模块 fast 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/)
|
* 单模块 fast 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/)
|
||||||
* Oracle 模块 oracle 分支 [RuoYi-Vue-Plus-oracle](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/oracle/)
|
* satoken 分支 [RuoYi-Vue-Plus-satoken](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/satoken/)
|
||||||
|
* 用户扩展项目 [扩展项目列表](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4478302&doc_id=1469725)
|
||||||
|
|
||||||
## 加群与捐献
|
## 加群与捐献
|
||||||
>[加群与捐献](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/加群与捐献?sort_id=4104598)
|
>[加群与捐献](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/加群与捐献?sort_id=4104598)
|
||||||
@ -111,26 +86,29 @@ RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期
|
|||||||
<img src="https://images.gitee.com/uploads/images/2021/0525/101654_451e4523_1766278.jpeg" width="300px" height="450px" />
|
<img src="https://images.gitee.com/uploads/images/2021/0525/101654_451e4523_1766278.jpeg" width="300px" height="450px" />
|
||||||
<img src="https://images.gitee.com/uploads/images/2021/0525/101713_3d18b119_1766278.jpeg" width="300px" height="450px" />
|
<img src="https://images.gitee.com/uploads/images/2021/0525/101713_3d18b119_1766278.jpeg" width="300px" height="450px" />
|
||||||
|
|
||||||
## 内置功能
|
## 业务功能
|
||||||
|
|
||||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
| 功能 | 介绍 |
|
||||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
|
|---|---|
|
||||||
3. 岗位管理:配置系统用户所属担任职务。
|
| 用户管理 | 用户是系统操作者,该功能主要完成系统用户配置。 |
|
||||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
|
| 部门管理 | 配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 |
|
||||||
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
|
| 岗位管理 | 配置系统用户所属担任职务。 |
|
||||||
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
|
| 菜单管理 | 配置系统菜单,操作权限,按钮权限标识等。 |
|
||||||
7. 参数管理:对系统动态配置常用参数。
|
| 角色管理 | 角色菜单权限分配、设置角色按机构进行数据范围权限划分。 |
|
||||||
8. 通知公告:系统通知公告信息发布维护。
|
| 字典管理 | 对系统中经常使用的一些较为固定的数据进行维护。 |
|
||||||
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
| 参数管理 | 对系统动态配置常用参数。 |
|
||||||
10. 登录日志:系统登录日志记录查询包含登录异常。
|
| 通知公告 | 系统通知公告信息发布维护。 |
|
||||||
11. 在线用户:当前系统中活跃用户状态监控。
|
| 操作日志 | 系统正常操作日志记录和查询;系统异常信息日志记录和查询。 |
|
||||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
| 登录日志 | 系统登录日志记录查询包含登录异常。 |
|
||||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
| 文件管理 | 系统文件上传、下载等管理。 |
|
||||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
| 定时任务 | 在线(添加、修改、删除)任务调度包含执行结果日志。 |
|
||||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
| 代码生成 | 前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 |
|
||||||
16. 缓存监控:对系统的缓存信息查询,命令统计等。
|
| 系统接口 | 根据业务代码自动生成相关的api接口文档。 |
|
||||||
17. 在线构建器:拖动表单元素生成相应的HTML代码。
|
| 服务监控 | 监视集群系统CPU、内存、磁盘、堆栈、在线日志、Spring相关配置等。 |
|
||||||
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
| 缓存监控 | 对系统的缓存信息查询,命令统计等。 |
|
||||||
|
| 在线构建器 | 拖动表单元素生成相应的HTML代码。 |
|
||||||
|
| 连接池监视 | 监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 |
|
||||||
|
| 使用案例 | 系统的一些功能案例 |
|
||||||
|
|
||||||
## 演示图例
|
## 演示图例
|
||||||
|
|
||||||
@ -172,11 +150,3 @@ RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
## 在线体验
|
|
||||||
|
|
||||||
- admin/admin123
|
|
||||||
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
|
|
||||||
|
|
||||||
演示地址:http://vue.ruoyi.vip
|
|
||||||
文档地址:http://doc.ruoyi.vip
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
# redis 密码
|
|
||||||
# requirepass 123456
|
|
171
pom.xml
171
pom.xml
@ -6,47 +6,52 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.4.0</version>
|
||||||
|
|
||||||
<name>RuoYi-Vue-Plus</name>
|
<name>RuoYi-Vue-Plus</name>
|
||||||
<url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
|
<url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
|
||||||
<description>RuoYi-Vue-Plus后台管理系统</description>
|
<description>RuoYi-Vue-Plus后台管理系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi-vue-plus.version>3.1.0</ruoyi-vue-plus.version>
|
<ruoyi-vue-plus.version>3.4.0</ruoyi-vue-plus.version>
|
||||||
<spring-boot.version>2.5.4</spring-boot.version>
|
<spring-boot.version>2.5.7</spring-boot.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
|
||||||
<druid.version>1.2.6</druid.version>
|
<druid.version>1.2.8</druid.version>
|
||||||
<knife4j.version>3.0.3</knife4j.version>
|
<knife4j.version>3.0.3</knife4j.version>
|
||||||
|
<swagger-annotations.version>1.5.22</swagger-annotations.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<easyexcel.version>2.2.10</easyexcel.version>
|
<easyexcel.version>2.2.11</easyexcel.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<mybatis-plus.version>3.4.3.3</mybatis-plus.version>
|
<mybatis-plus.version>3.4.3.4</mybatis-plus.version>
|
||||||
<p6spy.version>3.9.1</p6spy.version>
|
<p6spy.version>3.9.1</p6spy.version>
|
||||||
<hutool.version>5.7.11</hutool.version>
|
<hutool.version>5.7.16</hutool.version>
|
||||||
<feign.version>3.0.3</feign.version>
|
<okhttp.version>4.9.2</okhttp.version>
|
||||||
<feign-okhttp.version>11.6</feign-okhttp.version>
|
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
|
||||||
<okhttp.version>4.9.1</okhttp.version>
|
<redisson.version>3.16.4</redisson.version>
|
||||||
<spring-boot-admin.version>2.5.1</spring-boot-admin.version>
|
|
||||||
<redisson.version>3.16.2</redisson.version>
|
|
||||||
<lock4j.version>2.2.1</lock4j.version>
|
<lock4j.version>2.2.1</lock4j.version>
|
||||||
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
||||||
|
<tlog.version>1.3.4</tlog.version>
|
||||||
|
<xxl-job.version>2.3.0</xxl-job.version>
|
||||||
|
|
||||||
|
<!-- jdk11 缺失依赖 jaxb-->
|
||||||
|
<jaxb.version>3.0.1</jaxb.version>
|
||||||
|
|
||||||
<!-- OSS 配置 -->
|
<!-- OSS 配置 -->
|
||||||
<qiniu.version>7.8.0</qiniu.version>
|
<qiniu.version>7.8.0</qiniu.version>
|
||||||
<aliyun.oss.version>3.13.1</aliyun.oss.version>
|
<aliyun.oss.version>3.13.1</aliyun.oss.version>
|
||||||
<qcloud.cos.version>5.6.51</qcloud.cos.version>
|
<qcloud.cos.version>5.6.58</qcloud.cos.version>
|
||||||
<minio.version>8.3.0</minio.version>
|
<minio.version>8.3.3</minio.version>
|
||||||
|
|
||||||
<!-- docker 配置 -->
|
<!-- docker 配置 -->
|
||||||
<docker.registry.url>localhost</docker.registry.url>
|
<docker.registry.url>localhost</docker.registry.url>
|
||||||
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
||||||
<docker.namespace>ruoyi</docker.namespace>
|
<docker.namespace>ruoyi</docker.namespace>
|
||||||
<docker.plugin.version>1.2.2</docker.plugin.version>
|
<docker.plugin.version>1.2.2</docker.plugin.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
@ -73,6 +78,18 @@
|
|||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
<version>${knife4j.version}</version>
|
<version>${knife4j.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- excel工具 -->
|
<!-- excel工具 -->
|
||||||
@ -86,12 +103,22 @@
|
|||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
<version>${easyexcel.version}</version>
|
<version>${easyexcel.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- velocity代码生成使用模板 -->
|
<!-- velocity代码生成使用模板 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
<artifactId>velocity</artifactId>
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
<version>${velocity.version}</version>
|
<version>${velocity.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -102,6 +129,13 @@
|
|||||||
<version>${jwt.version}</version>
|
<version>${jwt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- jdk11 缺失依赖 jaxb-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<version>${jaxb.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- dynamic-datasource 多数据源-->
|
<!-- dynamic-datasource 多数据源-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
@ -132,18 +166,6 @@
|
|||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-okhttp</artifactId>
|
|
||||||
<version>${feign-okhttp.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
@ -172,10 +194,46 @@
|
|||||||
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
<version>${lock4j.version}</version>
|
<version>${lock4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 定时任务-->
|
|
||||||
|
<!-- xxl-job-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job-core</artifactId>
|
||||||
|
<version>${xxl-job.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>tlog-spring-boot-configuration</artifactId>
|
||||||
|
<version>${tlog.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>tlog-webroot</artifactId>
|
||||||
|
<version>${tlog.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
<groupId>org.javassist</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>tlog-xxl-job</artifactId>
|
||||||
|
<version>${tlog.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-quartz</artifactId>
|
<artifactId>ruoyi-job</artifactId>
|
||||||
<version>${ruoyi-vue-plus.version}</version>
|
<version>${ruoyi-vue-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -207,7 +265,7 @@
|
|||||||
<version>${ruoyi-vue-plus.version}</version>
|
<version>${ruoyi-vue-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- demo模块 -->
|
<!-- OSS对象存储模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-oss</artifactId>
|
<artifactId>ruoyi-oss</artifactId>
|
||||||
@ -228,7 +286,7 @@
|
|||||||
<module>ruoyi-admin</module>
|
<module>ruoyi-admin</module>
|
||||||
<module>ruoyi-framework</module>
|
<module>ruoyi-framework</module>
|
||||||
<module>ruoyi-system</module>
|
<module>ruoyi-system</module>
|
||||||
<module>ruoyi-quartz</module>
|
<module>ruoyi-job</module>
|
||||||
<module>ruoyi-generator</module>
|
<module>ruoyi-generator</module>
|
||||||
<module>ruoyi-common</module>
|
<module>ruoyi-common</module>
|
||||||
<module>ruoyi-demo</module>
|
<module>ruoyi-demo</module>
|
||||||
@ -237,11 +295,6 @@
|
|||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -297,6 +350,7 @@
|
|||||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
<profiles.active>local</profiles.active>
|
<profiles.active>local</profiles.active>
|
||||||
<logging.level>debug</logging.level>
|
<logging.level>debug</logging.level>
|
||||||
|
<knife4j.production>false</knife4j.production>
|
||||||
<endpoints.include>'*'</endpoints.include>
|
<endpoints.include>'*'</endpoints.include>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
@ -306,6 +360,7 @@
|
|||||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
<profiles.active>dev</profiles.active>
|
<profiles.active>dev</profiles.active>
|
||||||
<logging.level>debug</logging.level>
|
<logging.level>debug</logging.level>
|
||||||
|
<knife4j.production>false</knife4j.production>
|
||||||
<endpoints.include>'*'</endpoints.include>
|
<endpoints.include>'*'</endpoints.include>
|
||||||
</properties>
|
</properties>
|
||||||
<activation>
|
<activation>
|
||||||
@ -318,48 +373,10 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<profiles.active>prod</profiles.active>
|
<profiles.active>prod</profiles.active>
|
||||||
<logging.level>warn</logging.level>
|
<logging.level>warn</logging.level>
|
||||||
<endpoints.include>health,info</endpoints.include>
|
<knife4j.production>true</knife4j.production>
|
||||||
|
<endpoints.include>health, info, logfile</endpoints.include>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
<!-- jdk多版本配置 -->
|
|
||||||
<profile>
|
|
||||||
<id>jdk8</id>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
<jdk>1.8</jdk>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>jdk11</id>
|
|
||||||
<activation>
|
|
||||||
<jdk>11</jdk>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
|
||||||
<java.version>11</java.version>
|
|
||||||
<jaxb.version>3.0.1</jaxb.version>
|
|
||||||
</properties>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<!-- jdk11 缺失依赖 jaxb-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-impl</artifactId>
|
|
||||||
<version>${jaxb.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<!--jaxb-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-impl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -4,6 +4,7 @@ MAINTAINER Lion Li
|
|||||||
|
|
||||||
RUN mkdir -p /ruoyi/server
|
RUN mkdir -p /ruoyi/server
|
||||||
RUN mkdir -p /ruoyi/server/logs
|
RUN mkdir -p /ruoyi/server/logs
|
||||||
|
RUN mkdir -p /ruoyi/server/temp
|
||||||
|
|
||||||
WORKDIR /ruoyi/server
|
WORKDIR /ruoyi/server
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.1.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -36,10 +36,14 @@
|
|||||||
<artifactId>ruoyi-framework</artifactId>
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 定时任务-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-quartz</artifactId>
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-job</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -82,7 +86,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
<warName>${project.artifactId}</warName>
|
<warName>${project.artifactId}</warName>
|
||||||
|
@ -2,6 +2,7 @@ package com.ruoyi;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动程序
|
* 启动程序
|
||||||
@ -10,12 +11,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication {
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args) {
|
||||||
{
|
|
||||||
System.setProperty("spring.devtools.restart.enabled", "false");
|
System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
SpringApplication.run(RuoYiApplication.class, args);
|
SpringApplication application = new SpringApplication(RuoYiApplication.class);
|
||||||
|
application.setApplicationStartup(new BufferingApplicationStartup(2048));
|
||||||
|
application.run(args);
|
||||||
System.out.println("(♥◠‿◠)ノ゙ RuoYi-Vue-Plus启动成功 ლ(´ڡ`ლ)゙");
|
System.out.println("(♥◠‿◠)ノ゙ RuoYi-Vue-Plus启动成功 ლ(´ڡ`ლ)゙");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
public class RuoYiServletInitializer extends SpringBootServletInitializer {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
{
|
|
||||||
return application.sources(RuoYiApplication.class);
|
return application.sources(RuoYiApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ import com.ruoyi.common.utils.reflect.ReflectUtils;
|
|||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.framework.config.properties.CaptchaProperties;
|
import com.ruoyi.framework.config.properties.CaptchaProperties;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -24,22 +27,22 @@ import java.util.concurrent.TimeUnit;
|
|||||||
/**
|
/**
|
||||||
* 验证码操作处理
|
* 验证码操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Api(value = "验证码操作处理", tags = {"验证码管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
public class CaptchaController {
|
public class CaptchaController {
|
||||||
|
|
||||||
@Autowired
|
private final CaptchaProperties captchaProperties;
|
||||||
private CaptchaProperties captchaProperties;
|
private final ISysConfigService configService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysConfigService configService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成验证码
|
* 生成验证码
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("生成验证码")
|
||||||
@GetMapping("/captchaImage")
|
@GetMapping("/captchaImage")
|
||||||
public AjaxResult getCode() {
|
public AjaxResult<Map<String, Object>> getCode() {
|
||||||
Map<String, Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
boolean captchaOnOff = configService.selectCaptchaOnOff();
|
boolean captchaOnOff = configService.selectCaptchaOnOff();
|
||||||
ajax.put("captchaOnOff", captchaOnOff);
|
ajax.put("captchaOnOff", captchaOnOff);
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.connection.RedisServerCommands;
|
||||||
import org.springframework.data.redis.core.RedisCallback;
|
import org.springframework.data.redis.core.RedisCallback;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -15,28 +19,30 @@ import java.util.*;
|
|||||||
/**
|
/**
|
||||||
* 缓存监控
|
* 缓存监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Api(value = "缓存监控", tags = {"缓存监控管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/cache")
|
@RequestMapping("/monitor/cache")
|
||||||
public class CacheController
|
public class CacheController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate<String, String> redisTemplate;
|
|
||||||
|
|
||||||
|
private final RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
@ApiOperation("获取缓存监控详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public AjaxResult getInfo() throws Exception
|
public AjaxResult<Map<String, Object>> getInfo() throws Exception {
|
||||||
{
|
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info);
|
||||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
|
||||||
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize);
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>(3);
|
Map<String, Object> result = new HashMap<>(3);
|
||||||
result.put("info", info);
|
result.put("info", info);
|
||||||
result.put("dbSize", dbSize);
|
result.put("dbSize", dbSize);
|
||||||
|
|
||||||
List<Map<String, String>> pieList = new ArrayList<>();
|
List<Map<String, String>> pieList = new ArrayList<>();
|
||||||
|
if (commandStats != null) {
|
||||||
commandStats.stringPropertyNames().forEach(key -> {
|
commandStats.stringPropertyNames().forEach(key -> {
|
||||||
Map<String, String> data = new HashMap<>(2);
|
Map<String, String> data = new HashMap<>(2);
|
||||||
String property = commandStats.getProperty(key);
|
String property = commandStats.getProperty(key);
|
||||||
@ -44,6 +50,7 @@ public class CacheController
|
|||||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||||
pieList.add(data);
|
pieList.add(data);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
result.put("commandStats", pieList);
|
result.put("commandStats", pieList);
|
||||||
return AjaxResult.success(result);
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,12 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.service.ISysLogininforService;
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -18,44 +22,46 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "系统访问记录", tags = {"系统访问记录管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/logininfor")
|
@RequestMapping("/monitor/logininfor")
|
||||||
public class SysLogininforController extends BaseController
|
public class SysLogininforController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysLogininforService logininforService;
|
|
||||||
|
|
||||||
|
private final ISysLogininforService logininforService;
|
||||||
|
|
||||||
|
@ApiOperation("查询系统访问记录列表")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysLogininfor logininfor)
|
public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor) {
|
||||||
{
|
|
||||||
return logininforService.selectPageLogininforList(logininfor);
|
return logininforService.selectPageLogininforList(logininfor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出系统访问记录列表")
|
||||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysLogininfor logininfor, HttpServletResponse response)
|
public void export(SysLogininfor logininfor, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response);
|
ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除系统访问记录")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{infoIds}")
|
@DeleteMapping("/{infoIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
public AjaxResult<Void> remove(@PathVariable Long[] infoIds) {
|
||||||
{
|
|
||||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("清空系统访问记录")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/clean")
|
@DeleteMapping("/clean")
|
||||||
public AjaxResult clean()
|
public AjaxResult<Void> clean() {
|
||||||
{
|
|
||||||
logininforService.cleanLogininfor();
|
logininforService.cleanLogininfor();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,12 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -18,44 +22,46 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "操作日志记录", tags = {"操作日志记录管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/operlog")
|
@RequestMapping("/monitor/operlog")
|
||||||
public class SysOperlogController extends BaseController
|
public class SysOperlogController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysOperLogService operLogService;
|
|
||||||
|
|
||||||
|
private final ISysOperLogService operLogService;
|
||||||
|
|
||||||
|
@ApiOperation("查询操作日志记录列表")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysOperLog operLog)
|
public TableDataInfo<SysOperLog> list(SysOperLog operLog) {
|
||||||
{
|
|
||||||
return operLogService.selectPageOperLogList(operLog);
|
return operLogService.selectPageOperLogList(operLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出操作日志记录列表")
|
||||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysOperLog operLog, HttpServletResponse response)
|
public void export(SysOperLog operLog, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response);
|
ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除操作日志记录")
|
||||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
@DeleteMapping("/{operIds}")
|
@DeleteMapping("/{operIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
public AjaxResult<Void> remove(@PathVariable Long[] operIds) {
|
||||||
{
|
|
||||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("清空操作日志记录")
|
||||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
@DeleteMapping("/clean")
|
@DeleteMapping("/clean")
|
||||||
public AjaxResult clean()
|
public AjaxResult<Void> clean() {
|
||||||
{
|
|
||||||
operLogService.cleanOperLog();
|
operLogService.cleanOperLog();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ import com.ruoyi.common.utils.RedisUtils;
|
|||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysUserOnline;
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -24,47 +27,37 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 在线用户监控
|
* 在线用户监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Api(value = "在线用户监控", tags = {"在线用户监控管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/online")
|
@RequestMapping("/monitor/online")
|
||||||
public class SysUserOnlineController extends BaseController
|
public class SysUserOnlineController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysUserOnlineService userOnlineService;
|
|
||||||
|
|
||||||
|
private final ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
|
@ApiOperation("在线用户列表")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(String ipaddr, String userName)
|
public TableDataInfo<SysUserOnline> list(String ipaddr, String userName) {
|
||||||
{
|
|
||||||
Collection<String> keys = RedisUtils.keys(Constants.LOGIN_TOKEN_KEY + "*");
|
Collection<String> keys = RedisUtils.keys(Constants.LOGIN_TOKEN_KEY + "*");
|
||||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||||
for (String key : keys)
|
for (String key : keys) {
|
||||||
{
|
|
||||||
LoginUser user = RedisUtils.getCacheObject(key);
|
LoginUser user = RedisUtils.getCacheObject(key);
|
||||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
|
||||||
{
|
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) {
|
||||||
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||||
}
|
}
|
||||||
}
|
} else if (StringUtils.isNotEmpty(ipaddr)) {
|
||||||
else if (StringUtils.isNotEmpty(ipaddr))
|
if (StringUtils.equals(ipaddr, user.getIpaddr())) {
|
||||||
{
|
|
||||||
if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||||
}
|
}
|
||||||
}
|
} else if (StringUtils.isNotEmpty(userName)) {
|
||||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
if (StringUtils.equals(userName, user.getUsername())) {
|
||||||
{
|
|
||||||
if (StringUtils.equals(userName, user.getUsername()))
|
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,11 +69,11 @@ public class SysUserOnlineController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 强退用户
|
* 强退用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("强退用户")
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
@DeleteMapping("/{tokenId}")
|
@DeleteMapping("/{tokenId}")
|
||||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
public AjaxResult<Void> forceLogout(@PathVariable String tokenId) {
|
||||||
{
|
|
||||||
RedisUtils.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
|
RedisUtils.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
@ -10,6 +9,10 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -21,30 +24,32 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 参数配置 信息操作处理
|
* 参数配置 信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "参数配置控制器", tags = {"参数配置管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/config")
|
@RequestMapping("/system/config")
|
||||||
public class SysConfigController extends BaseController
|
public class SysConfigController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
private final ISysConfigService configService;
|
||||||
private ISysConfigService configService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取参数配置列表
|
* 获取参数配置列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取参数配置列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysConfig config)
|
public TableDataInfo<SysConfig> list(SysConfig config) {
|
||||||
{
|
|
||||||
return configService.selectPageConfigList(config);
|
return configService.selectPageConfigList(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出参数配置列表")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysConfig config, HttpServletResponse response)
|
public void export(SysConfig config, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response);
|
ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response);
|
||||||
}
|
}
|
||||||
@ -52,63 +57,58 @@ public class SysConfigController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 根据参数编号获取详细信息
|
* 根据参数编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据参数编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||||
@GetMapping(value = "/{configId}")
|
@GetMapping(value = "/{configId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long configId)
|
public AjaxResult<SysConfig> getInfo(@ApiParam("参数ID") @PathVariable Long configId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(configService.selectConfigById(configId));
|
return AjaxResult.success(configService.selectConfigById(configId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据参数键名查询参数值
|
* 根据参数键名查询参数值
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据参数键名查询参数值")
|
||||||
@GetMapping(value = "/configKey/{configKey}")
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
public AjaxResult<Void> getConfigKey(@ApiParam("参数Key") @PathVariable String configKey) {
|
||||||
{
|
|
||||||
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增参数配置
|
* 新增参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增参数配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@RepeatSubmit
|
public AjaxResult<Void> add(@Validated @RequestBody SysConfig config) {
|
||||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||||
{
|
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setCreateBy(getUsername());
|
|
||||||
return toAjax(configService.insertConfig(config));
|
return toAjax(configService.insertConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改参数配置
|
* 修改参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改参数配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysConfig config) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setUpdateBy(getUsername());
|
|
||||||
return toAjax(configService.updateConfig(config));
|
return toAjax(configService.updateConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除参数配置
|
* 删除参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除参数配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{configIds}")
|
@DeleteMapping("/{configIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
public AjaxResult<Void> remove(@ApiParam("参数ID串") @PathVariable Long[] configIds) {
|
||||||
{
|
|
||||||
configService.deleteConfigByIds(configIds);
|
configService.deleteConfigByIds(configIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
@ -116,11 +116,11 @@ public class SysConfigController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 刷新参数缓存
|
* 刷新参数缓存
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("刷新参数缓存")
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/refreshCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult refreshCache()
|
public AjaxResult<Void> refreshCache() {
|
||||||
{
|
|
||||||
configService.resetConfigCache();
|
configService.resetConfigCache();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
@ -9,35 +10,40 @@ import com.ruoyi.common.core.domain.entity.SysDept;
|
|||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "部门控制器", tags = {"部门管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/dept")
|
@RequestMapping("/system/dept")
|
||||||
public class SysDeptController extends BaseController
|
public class SysDeptController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
private final ISysDeptService deptService;
|
||||||
private ISysDeptService deptService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门列表
|
* 获取部门列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取部门列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(SysDept dept)
|
public AjaxResult<List<SysDept>> list(SysDept dept) {
|
||||||
{
|
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
return AjaxResult.success(depts);
|
return AjaxResult.success(depts);
|
||||||
}
|
}
|
||||||
@ -45,31 +51,23 @@ public class SysDeptController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询部门列表(排除节点)
|
* 查询部门列表(排除节点)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询部门列表(排除节点)")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
@GetMapping("/list/exclude/{deptId}")
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
public AjaxResult<List<SysDept>> excludeChild(@ApiParam("部门ID") @PathVariable(value = "deptId", required = false) Long deptId) {
|
||||||
{
|
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
Iterator<SysDept> it = depts.iterator();
|
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
||||||
while (it.hasNext())
|
|| ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||||
{
|
|
||||||
SysDept d = (SysDept) it.next();
|
|
||||||
if (d.getDeptId().intValue() == deptId
|
|
||||||
|| ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
|
||||||
{
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return AjaxResult.success(depts);
|
return AjaxResult.success(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门编号获取详细信息
|
* 根据部门编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据部门编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||||
@GetMapping(value = "/{deptId}")
|
@GetMapping(value = "/{deptId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
public AjaxResult<SysDept> getInfo(@ApiParam("部门ID") @PathVariable Long deptId) {
|
||||||
{
|
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||||
}
|
}
|
||||||
@ -77,9 +75,9 @@ public class SysDeptController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取部门下拉树列表
|
* 获取部门下拉树列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取部门下拉树列表")
|
||||||
@GetMapping("/treeselect")
|
@GetMapping("/treeselect")
|
||||||
public AjaxResult treeselect(SysDept dept)
|
public AjaxResult<List<Tree<Long>>> treeselect(SysDept dept) {
|
||||||
{
|
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
||||||
}
|
}
|
||||||
@ -87,11 +85,11 @@ public class SysDeptController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 加载对应角色部门列表树
|
* 加载对应角色部门列表树
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("加载对应角色部门列表树")
|
||||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
||||||
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
public AjaxResult<Map<String, Object>> roleDeptTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) {
|
||||||
{
|
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
Map<String,Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
||||||
return AjaxResult.success(ajax);
|
return AjaxResult.success(ajax);
|
||||||
@ -100,58 +98,48 @@ public class SysDeptController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增部门
|
* 新增部门
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增部门")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
public AjaxResult<Void> add(@Validated @RequestBody SysDept dept) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
dept.setCreateBy(getUsername());
|
|
||||||
return toAjax(deptService.insertDept(dept));
|
return toAjax(deptService.insertDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改部门
|
* 修改部门
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改部门")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysDept dept) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
} else if (dept.getParentId().equals(dept.getDeptId())) {
|
||||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
}
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) {
|
||||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
|
||||||
{
|
|
||||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||||
}
|
}
|
||||||
dept.setUpdateBy(getUsername());
|
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门
|
* 删除部门
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除部门")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deptId}")
|
@DeleteMapping("/{deptId}")
|
||||||
public AjaxResult remove(@PathVariable Long deptId)
|
public AjaxResult<Void> remove(@ApiParam("部门ID串") @PathVariable Long deptId) {
|
||||||
{
|
if (deptService.hasChildByDeptId(deptId)) {
|
||||||
if (deptService.hasChildByDeptId(deptId))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("存在下级部门,不允许删除");
|
return AjaxResult.error("存在下级部门,不允许删除");
|
||||||
}
|
}
|
||||||
if (deptService.checkDeptExistUser(deptId))
|
if (deptService.checkDeptExistUser(deptId)) {
|
||||||
{
|
|
||||||
return AjaxResult.error("部门存在用户,不允许删除");
|
return AjaxResult.error("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
@ -10,6 +10,10 @@ import com.ruoyi.common.utils.StringUtils;
|
|||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
import com.ruoyi.system.service.ISysDictTypeService;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -22,30 +26,30 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/dict/data")
|
@RequestMapping("/system/dict/data")
|
||||||
public class SysDictDataController extends BaseController
|
public class SysDictDataController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysDictDataService dictDataService;
|
|
||||||
|
|
||||||
@Autowired
|
private final ISysDictDataService dictDataService;
|
||||||
private ISysDictTypeService dictTypeService;
|
private final ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@ApiOperation("查询字典数据列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysDictData dictData)
|
public TableDataInfo<SysDictData> list(SysDictData dictData) {
|
||||||
{
|
|
||||||
return dictDataService.selectPageDictDataList(dictData);
|
return dictDataService.selectPageDictDataList(dictData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出字典数据列表")
|
||||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysDictData dictData, HttpServletResponse response)
|
public void export(SysDictData dictData, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response);
|
ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response);
|
||||||
}
|
}
|
||||||
@ -53,23 +57,22 @@ public class SysDictDataController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询字典数据详细
|
* 查询字典数据详细
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询字典数据详细")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
@GetMapping(value = "/{dictCode}")
|
@GetMapping(value = "/{dictCode}")
|
||||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
public AjaxResult<SysDictData> getInfo(@ApiParam("字典code") @PathVariable Long dictCode) {
|
||||||
{
|
|
||||||
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型查询字典数据信息
|
* 根据字典类型查询字典数据信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据字典类型查询字典数据信息")
|
||||||
@GetMapping(value = "/type/{dictType}")
|
@GetMapping(value = "/type/{dictType}")
|
||||||
public AjaxResult dictType(@PathVariable String dictType)
|
public AjaxResult<List<SysDictData>> dictType(@ApiParam("字典类型") @PathVariable String dictType) {
|
||||||
{
|
|
||||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
if (StringUtils.isNull(data))
|
if (StringUtils.isNull(data)) {
|
||||||
{
|
data = new ArrayList<>();
|
||||||
data = new ArrayList<SysDictData>();
|
|
||||||
}
|
}
|
||||||
return AjaxResult.success(data);
|
return AjaxResult.success(data);
|
||||||
}
|
}
|
||||||
@ -77,35 +80,33 @@ public class SysDictDataController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增字典类型")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
public AjaxResult<Void> add(@Validated @RequestBody SysDictData dict) {
|
||||||
{
|
|
||||||
dict.setCreateBy(getUsername());
|
|
||||||
return toAjax(dictDataService.insertDictData(dict));
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存字典类型
|
* 修改保存字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改保存字典类型")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysDictData dict) {
|
||||||
{
|
|
||||||
dict.setUpdateBy(getUsername());
|
|
||||||
return toAjax(dictDataService.updateDictData(dict));
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除字典类型
|
* 删除字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除字典类型")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{dictCodes}")
|
@DeleteMapping("/{dictCodes}")
|
||||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
public AjaxResult<Void> remove(@ApiParam("字典code串") @PathVariable Long[] dictCodes) {
|
||||||
{
|
|
||||||
dictDataService.deleteDictDataByIds(dictCodes);
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.service.ISysDictTypeService;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -20,27 +24,29 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/dict/type")
|
@RequestMapping("/system/dict/type")
|
||||||
public class SysDictTypeController extends BaseController
|
public class SysDictTypeController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysDictTypeService dictTypeService;
|
|
||||||
|
|
||||||
|
private final ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@ApiOperation("查询字典类型列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysDictType dictType)
|
public TableDataInfo<SysDictType> list(SysDictType dictType) {
|
||||||
{
|
|
||||||
return dictTypeService.selectPageDictTypeList(dictType);
|
return dictTypeService.selectPageDictTypeList(dictType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出字典类型列表")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysDictType dictType, HttpServletResponse response)
|
public void export(SysDictType dictType, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response);
|
ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response);
|
||||||
}
|
}
|
||||||
@ -48,53 +54,49 @@ public class SysDictTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询字典类型详细
|
* 查询字典类型详细
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询字典类型详细")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
@GetMapping(value = "/{dictId}")
|
@GetMapping(value = "/{dictId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
public AjaxResult<SysDictType> getInfo(@ApiParam("字典ID") @PathVariable Long dictId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增字典类型")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
public AjaxResult<Void> add(@Validated @RequestBody SysDictType dict) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setCreateBy(getUsername());
|
|
||||||
return toAjax(dictTypeService.insertDictType(dict));
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改字典类型
|
* 修改字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改字典类型")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysDictType dict) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setUpdateBy(getUsername());
|
|
||||||
return toAjax(dictTypeService.updateDictType(dict));
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除字典类型
|
* 删除字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除字典类型")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{dictIds}")
|
@DeleteMapping("/{dictIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
public AjaxResult<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) {
|
||||||
{
|
|
||||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
@ -102,11 +104,11 @@ public class SysDictTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 刷新字典缓存
|
* 刷新字典缓存
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("刷新字典缓存")
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/refreshCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult refreshCache()
|
public AjaxResult<Void> refreshCache() {
|
||||||
{
|
|
||||||
dictTypeService.resetDictCache();
|
dictTypeService.resetDictCache();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
@ -114,9 +116,9 @@ public class SysDictTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取字典选择框列表
|
* 获取字典选择框列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取字典选择框列表")
|
||||||
@GetMapping("/optionselect")
|
@GetMapping("/optionselect")
|
||||||
public AjaxResult optionselect()
|
public AjaxResult<List<SysDictType>> optionselect() {
|
||||||
{
|
|
||||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||||
return AjaxResult.success(dictTypes);
|
return AjaxResult.success(dictTypes);
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,35 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Api(value = "首页控制器", tags = {"首页管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
public class SysIndexController
|
public class SysIndexController {
|
||||||
{
|
|
||||||
/** 系统基础配置 */
|
/**
|
||||||
@Autowired
|
* 系统基础配置
|
||||||
private RuoYiConfig ruoyiConfig;
|
*/
|
||||||
|
private final RuoYiConfig ruoyiConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 访问首页,提示语
|
* 访问首页,提示语
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/")
|
@ApiOperation("访问首页,提示语")
|
||||||
public String index()
|
@GetMapping("/")
|
||||||
{
|
public String index() {
|
||||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,16 @@ import com.ruoyi.common.core.domain.entity.SysMenu;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginBody;
|
import com.ruoyi.common.core.domain.model.LoginBody;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.framework.web.service.SysLoginService;
|
import com.ruoyi.system.domain.vo.RouterVo;
|
||||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.service.SysLoginService;
|
||||||
|
import com.ruoyi.system.service.SysPermissionService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -23,19 +29,18 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* 登录验证
|
* 登录验证
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "登录验证控制器", tags = {"登录验证管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
public class SysLoginController
|
public class SysLoginController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private SysLoginService loginService;
|
|
||||||
|
|
||||||
@Autowired
|
private final SysLoginService loginService;
|
||||||
private ISysMenuService menuService;
|
private final ISysMenuService menuService;
|
||||||
|
private final ISysUserService userService;
|
||||||
@Autowired
|
private final SysPermissionService permissionService;
|
||||||
private SysPermissionService permissionService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录方法
|
* 登录方法
|
||||||
@ -43,10 +48,10 @@ public class SysLoginController
|
|||||||
* @param loginBody 登录信息
|
* @param loginBody 登录信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("登录方法")
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
public AjaxResult<Map<String, Object>> login(@RequestBody LoginBody loginBody) {
|
||||||
{
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
Map<String,Object> ajax = new HashMap<>();
|
|
||||||
// 生成令牌
|
// 生成令牌
|
||||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||||
loginBody.getUuid());
|
loginBody.getUuid());
|
||||||
@ -59,15 +64,15 @@ public class SysLoginController
|
|||||||
*
|
*
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取用户信息")
|
||||||
@GetMapping("getInfo")
|
@GetMapping("getInfo")
|
||||||
public AjaxResult getInfo()
|
public AjaxResult<Map<String, Object>> getInfo() {
|
||||||
{
|
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
||||||
// 角色集合
|
// 角色集合
|
||||||
Set<String> roles = permissionService.getRolePermission(user);
|
Set<String> roles = permissionService.getRolePermission(user);
|
||||||
// 权限集合
|
// 权限集合
|
||||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||||
Map<String,Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
@ -79,9 +84,9 @@ public class SysLoginController
|
|||||||
*
|
*
|
||||||
* @return 路由信息
|
* @return 路由信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取路由信息")
|
||||||
@GetMapping("getRouters")
|
@GetMapping("getRouters")
|
||||||
public AjaxResult getRouters()
|
public AjaxResult<List<RouterVo>> getRouters() {
|
||||||
{
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||||
return AjaxResult.success(menuService.buildMenus(menus));
|
return AjaxResult.success(menuService.buildMenus(menus));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
@ -8,6 +9,10 @@ import com.ruoyi.common.core.domain.entity.SysMenu;
|
|||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -20,22 +25,24 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* 菜单信息
|
* 菜单信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "菜单信息控制器", tags = {"菜单信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/menu")
|
@RequestMapping("/system/menu")
|
||||||
public class SysMenuController extends BaseController
|
public class SysMenuController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
private final ISysMenuService menuService;
|
||||||
private ISysMenuService menuService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取菜单列表
|
* 获取菜单列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取菜单列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(SysMenu menu)
|
public AjaxResult<List<SysMenu>> list(SysMenu menu) {
|
||||||
{
|
|
||||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
return AjaxResult.success(menus);
|
return AjaxResult.success(menus);
|
||||||
}
|
}
|
||||||
@ -43,19 +50,19 @@ public class SysMenuController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 根据菜单编号获取详细信息
|
* 根据菜单编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据菜单编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||||
@GetMapping(value = "/{menuId}")
|
@GetMapping(value = "/{menuId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
public AjaxResult<SysMenu> getInfo(@ApiParam("菜单ID") @PathVariable Long menuId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(menuService.selectMenuById(menuId));
|
return AjaxResult.success(menuService.selectMenuById(menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取菜单下拉树列表
|
* 获取菜单下拉树列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取菜单下拉树列表")
|
||||||
@GetMapping("/treeselect")
|
@GetMapping("/treeselect")
|
||||||
public AjaxResult treeselect(SysMenu menu)
|
public AjaxResult<List<Tree<Long>>> treeselect(SysMenu menu) {
|
||||||
{
|
|
||||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||||
}
|
}
|
||||||
@ -63,11 +70,11 @@ public class SysMenuController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 加载对应角色菜单列表树
|
* 加载对应角色菜单列表树
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("加载对应角色菜单列表树")
|
||||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
public AjaxResult<Map<String, Object>> roleMenuTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) {
|
||||||
{
|
|
||||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||||
Map<String,Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||||
return AjaxResult.success(ajax);
|
return AjaxResult.success(ajax);
|
||||||
@ -76,61 +83,49 @@ public class SysMenuController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增菜单
|
* 新增菜单
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增菜单")
|
||||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
public AjaxResult<Void> add(@Validated @RequestBody SysMenu menu) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
menu.setCreateBy(getUsername());
|
|
||||||
return toAjax(menuService.insertMenu(menu));
|
return toAjax(menuService.insertMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改菜单
|
* 修改菜单
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改菜单")
|
||||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysMenu menu) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
} else if (menu.getMenuId().equals(menu.getParentId())) {
|
||||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
}
|
}
|
||||||
menu.setUpdateBy(getUsername());
|
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除菜单
|
* 删除菜单
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除菜单")
|
||||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{menuId}")
|
@DeleteMapping("/{menuId}")
|
||||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
public AjaxResult<Void> remove(@ApiParam("菜单ID") @PathVariable("menuId") Long menuId) {
|
||||||
{
|
if (menuService.hasChildByMenuId(menuId)) {
|
||||||
if (menuService.hasChildByMenuId(menuId))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("存在子菜单,不允许删除");
|
return AjaxResult.error("存在子菜单,不允许删除");
|
||||||
}
|
}
|
||||||
if (menuService.checkMenuExistRole(menuId))
|
if (menuService.checkMenuExistRole(menuId)) {
|
||||||
{
|
|
||||||
return AjaxResult.error("菜单已分配,不允许删除");
|
return AjaxResult.error("菜单已分配,不允许删除");
|
||||||
}
|
}
|
||||||
return toAjax(menuService.deleteMenuById(menuId));
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
@ -19,71 +7,79 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "公告信息控制器", tags = {"公告信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/notice")
|
@RequestMapping("/system/notice")
|
||||||
public class SysNoticeController extends BaseController
|
public class SysNoticeController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
private final ISysNoticeService noticeService;
|
||||||
private ISysNoticeService noticeService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通知公告列表
|
* 获取通知公告列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取通知公告列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysNotice notice)
|
public TableDataInfo<SysNotice> list(SysNotice notice) {
|
||||||
{
|
|
||||||
return noticeService.selectPageNoticeList(notice);
|
return noticeService.selectPageNoticeList(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据通知公告编号获取详细信息
|
* 根据通知公告编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据通知公告编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||||
@GetMapping(value = "/{noticeId}")
|
@GetMapping(value = "/{noticeId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
public AjaxResult<SysNotice> getInfo(@ApiParam("公告ID") @PathVariable Long noticeId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
|
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增通知公告
|
* 新增通知公告
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增通知公告")
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
public AjaxResult<Void> add(@Validated @RequestBody SysNotice notice) {
|
||||||
{
|
|
||||||
notice.setCreateBy(getUsername());
|
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改通知公告
|
* 修改通知公告
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改通知公告")
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysNotice notice) {
|
||||||
{
|
|
||||||
notice.setUpdateBy(getUsername());
|
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除通知公告
|
* 删除通知公告
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除通知公告")
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{noticeIds}")
|
@DeleteMapping("/{noticeIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
public AjaxResult<Void> remove(@ApiParam("公告ID串") @PathVariable Long[] noticeIds) {
|
||||||
{
|
|
||||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.ruoyi.system.domain.vo.SysOssConfigVo;
|
|||||||
import com.ruoyi.system.service.ISysOssConfigService;
|
import com.ruoyi.system.service.ISysOssConfigService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -25,14 +26,14 @@ import javax.validation.constraints.NotNull;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 云存储配置Controller
|
* 对象存储配置Controller
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @author 孤舟烟雨
|
* @author 孤舟烟雨
|
||||||
* @date 2021-08-13
|
* @date 2021-08-13
|
||||||
*/
|
*/
|
||||||
@Validated
|
@Validated
|
||||||
@Api(value = "云存储配置控制器", tags = {"云存储配置管理"})
|
@Api(value = "对象存储配置控制器", tags = {"对象存储配置管理"})
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/oss/config")
|
@RequestMapping("/system/oss/config")
|
||||||
@ -41,9 +42,9 @@ public class SysOssConfigController extends BaseController {
|
|||||||
private final ISysOssConfigService iSysOssConfigService;
|
private final ISysOssConfigService iSysOssConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询云存储配置列表
|
* 查询对象存储配置列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询云存储配置列表")
|
@ApiOperation("查询对象存储配置列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:list')")
|
@PreAuthorize("@ss.hasPermi('system:oss:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo) {
|
public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo) {
|
||||||
@ -51,22 +52,23 @@ public class SysOssConfigController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取云存储配置详细信息
|
* 获取对象存储配置详细信息
|
||||||
*/
|
*/
|
||||||
@ApiOperation("获取云存储配置详细信息")
|
@ApiOperation("获取对象存储配置详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:query')")
|
@PreAuthorize("@ss.hasPermi('system:oss:query')")
|
||||||
@GetMapping("/{ossConfigId}")
|
@GetMapping("/{ossConfigId}")
|
||||||
public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
public AjaxResult<SysOssConfigVo> getInfo(@ApiParam("OSS配置ID")
|
||||||
|
@NotNull(message = "主键不能为空")
|
||||||
@PathVariable("ossConfigId") Integer ossConfigId) {
|
@PathVariable("ossConfigId") Integer ossConfigId) {
|
||||||
return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId));
|
return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增云存储配置
|
* 新增对象存储配置
|
||||||
*/
|
*/
|
||||||
@ApiOperation("新增云存储配置")
|
@ApiOperation("新增对象存储配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:add')")
|
@PreAuthorize("@ss.hasPermi('system:oss:add')")
|
||||||
@Log(title = "云存储配置", businessType = BusinessType.INSERT)
|
@Log(title = "对象存储配置", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) {
|
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) {
|
||||||
@ -74,11 +76,11 @@ public class SysOssConfigController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改云存储配置
|
* 修改对象存储配置
|
||||||
*/
|
*/
|
||||||
@ApiOperation("修改云存储配置")
|
@ApiOperation("修改对象存储配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:edit')")
|
@PreAuthorize("@ss.hasPermi('system:oss:edit')")
|
||||||
@Log(title = "云存储配置", businessType = BusinessType.UPDATE)
|
@Log(title = "对象存储配置", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) {
|
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) {
|
||||||
@ -86,13 +88,14 @@ public class SysOssConfigController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除云存储配置
|
* 删除对象存储配置
|
||||||
*/
|
*/
|
||||||
@ApiOperation("删除云存储配置")
|
@ApiOperation("删除对象存储配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
|
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
|
||||||
@Log(title = "云存储配置", businessType = BusinessType.DELETE)
|
@Log(title = "对象存储配置", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ossConfigIds}")
|
@DeleteMapping("/{ossConfigIds}")
|
||||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
public AjaxResult<Void> remove(@ApiParam("OSS配置ID串")
|
||||||
|
@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] ossConfigIds) {
|
@PathVariable Long[] ossConfigIds) {
|
||||||
return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0);
|
return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0);
|
||||||
}
|
}
|
||||||
@ -100,10 +103,11 @@ public class SysOssConfigController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 状态修改
|
* 状态修改
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("状态修改")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:edit')")
|
@PreAuthorize("@ss.hasPermi('system:oss:edit')")
|
||||||
@Log(title = "云存储状态修改", businessType = BusinessType.UPDATE)
|
@Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult changeStatus(@RequestBody SysOssConfigBo bo) {
|
public AjaxResult<Void> changeStatus(@RequestBody SysOssConfigBo bo) {
|
||||||
return toAjax(iSysOssConfigService.updateOssConfigStatus(bo));
|
return toAjax(iSysOssConfigService.updateOssConfigStatus(bo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.ruoyi.web.controller.system;
|
|||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.http.HttpException;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
@ -15,17 +16,14 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.JsonUtils;
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
import com.ruoyi.oss.constant.CloudConstant;
|
import com.ruoyi.oss.constant.OssConstant;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.system.domain.SysOss;
|
import com.ruoyi.system.domain.SysOss;
|
||||||
import com.ruoyi.system.domain.bo.SysOssBo;
|
import com.ruoyi.system.domain.bo.SysOssBo;
|
||||||
import com.ruoyi.system.domain.vo.SysOssVo;
|
import com.ruoyi.system.domain.vo.SysOssVo;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysOssService;
|
import com.ruoyi.system.service.ISysOssService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@ -36,9 +34,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -49,7 +46,7 @@ import java.util.Map;
|
|||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
@Validated
|
@Validated
|
||||||
@Api(value = "OSS云存储控制器", tags = {"OSS云存储管理"})
|
@Api(value = "OSS对象存储控制器", tags = {"OSS对象存储管理"})
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/oss")
|
@RequestMapping("/system/oss")
|
||||||
@ -59,9 +56,9 @@ public class SysOssController extends BaseController {
|
|||||||
private final ISysConfigService iSysConfigService;
|
private final ISysConfigService iSysConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询OSS云存储列表
|
* 查询OSS对象存储列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询OSS云存储列表")
|
@ApiOperation("查询OSS对象存储列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:list')")
|
@PreAuthorize("@ss.hasPermi('system:oss:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) {
|
public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) {
|
||||||
@ -69,14 +66,14 @@ public class SysOssController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传OSS云存储
|
* 上传OSS对象存储
|
||||||
*/
|
*/
|
||||||
@ApiOperation("上传OSS云存储")
|
@ApiOperation("上传OSS对象存储")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
|
@ApiImplicitParam(name = "file", value = "文件", dataTypeClass = File.class, required = true),
|
||||||
})
|
})
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:upload')")
|
@PreAuthorize("@ss.hasPermi('system:oss:upload')")
|
||||||
@Log(title = "OSS云存储", businessType = BusinessType.INSERT)
|
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
|
public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
|
||||||
@ -90,31 +87,39 @@ public class SysOssController extends BaseController {
|
|||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("下载OSS云存储")
|
@ApiOperation("下载OSS对象存储")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:download')")
|
@PreAuthorize("@ss.hasPermi('system:oss:download')")
|
||||||
@GetMapping("/download/{ossId}")
|
@GetMapping("/download/{ossId}")
|
||||||
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
public void download(@ApiParam("OSS对象ID") @PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
||||||
SysOss sysOss = iSysOssService.getById(ossId);
|
SysOss sysOss = iSysOssService.getById(ossId);
|
||||||
if (ObjectUtil.isNull(sysOss)) {
|
if (ObjectUtil.isNull(sysOss)) {
|
||||||
throw new ServiceException("文件数据不存在!");
|
throw new ServiceException("文件数据不存在!");
|
||||||
}
|
}
|
||||||
response.reset();
|
response.reset();
|
||||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName());
|
||||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
|
||||||
FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(sysOss.getOriginalName(), StandardCharsets.UTF_8.toString()));
|
|
||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
||||||
long data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false);
|
long data;
|
||||||
|
try {
|
||||||
|
data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false);
|
||||||
|
} catch (HttpException e) {
|
||||||
|
if (e.getMessage().contains("403")) {
|
||||||
|
throw new ServiceException("无读取权限, 请在对应的OSS开启'公有读'权限!");
|
||||||
|
} else {
|
||||||
|
throw new ServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
response.setContentLength(Convert.toInt(data));
|
response.setContentLength(Convert.toInt(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除OSS云存储
|
* 删除OSS对象存储
|
||||||
*/
|
*/
|
||||||
@ApiOperation("删除OSS云存储")
|
@ApiOperation("删除OSS对象存储")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
|
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
|
||||||
@Log(title = "OSS云存储" , businessType = BusinessType.DELETE)
|
@Log(title = "OSS对象存储", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ossIds}")
|
@DeleteMapping("/{ossIds}")
|
||||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
public AjaxResult<Void> remove(@ApiParam("OSS对象ID串")
|
||||||
|
@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] ossIds) {
|
@PathVariable Long[] ossIds) {
|
||||||
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
|
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
|
||||||
}
|
}
|
||||||
@ -124,12 +129,12 @@ public class SysOssController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("变更图片列表预览状态")
|
@ApiOperation("变更图片列表预览状态")
|
||||||
@PreAuthorize("@ss.hasPermi('system:oss:edit')")
|
@PreAuthorize("@ss.hasPermi('system:oss:edit')")
|
||||||
@Log(title = "OSS云存储" , businessType = BusinessType.UPDATE)
|
@Log(title = "OSS对象存储", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/changePreviewListResource")
|
@PutMapping("/changePreviewListResource")
|
||||||
public AjaxResult<Void> changePreviewListResource(@RequestBody String body) {
|
public AjaxResult<Void> changePreviewListResource(@RequestBody String body) {
|
||||||
Map<String, Boolean> map = JsonUtils.parseMap(body);
|
Map<String, Boolean> map = JsonUtils.parseMap(body);
|
||||||
SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
|
SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
|
||||||
.eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY));
|
.eq(SysConfig::getConfigKey, OssConstant.PEREVIEW_LIST_RESOURCE_KEY));
|
||||||
config.setConfigValue(map.get("previewListResource").toString());
|
config.setConfigValue(map.get("previewListResource").toString());
|
||||||
return toAjax(iSysConfigService.updateConfig(config));
|
return toAjax(iSysConfigService.updateConfig(config));
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -20,30 +24,32 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "岗位信息控制器", tags = {"岗位信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/post")
|
@RequestMapping("/system/post")
|
||||||
public class SysPostController extends BaseController
|
public class SysPostController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
private final ISysPostService postService;
|
||||||
private ISysPostService postService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取岗位列表
|
* 获取岗位列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取岗位列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysPost post)
|
public TableDataInfo<SysPost> list(SysPost post) {
|
||||||
{
|
|
||||||
return postService.selectPagePostList(post);
|
return postService.selectPagePostList(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出岗位列表")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysPost post, HttpServletResponse response)
|
public void export(SysPost post, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response);
|
ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response);
|
||||||
}
|
}
|
||||||
@ -51,70 +57,62 @@ public class SysPostController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 根据岗位编号获取详细信息
|
* 根据岗位编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据岗位编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||||
@GetMapping(value = "/{postId}")
|
@GetMapping(value = "/{postId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long postId)
|
public AjaxResult<SysPost> getInfo(@ApiParam("岗位ID") @PathVariable Long postId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(postService.selectPostById(postId));
|
return AjaxResult.success(postService.selectPostById(postId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增岗位
|
* 新增岗位
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增岗位")
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
public AjaxResult<Void> add(@Validated @RequestBody SysPost post) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setCreateBy(getUsername());
|
|
||||||
return toAjax(postService.insertPost(post));
|
return toAjax(postService.insertPost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改岗位
|
* 修改岗位
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改岗位")
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysPost post) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setUpdateBy(getUsername());
|
|
||||||
return toAjax(postService.updatePost(post));
|
return toAjax(postService.updatePost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除岗位
|
* 删除岗位
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除岗位")
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{postIds}")
|
@DeleteMapping("/{postIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
public AjaxResult<Void> remove(@ApiParam("岗位ID串") @PathVariable Long[] postIds) {
|
||||||
{
|
|
||||||
return toAjax(postService.deletePostByIds(postIds));
|
return toAjax(postService.deletePostByIds(postIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取岗位选择框列表
|
* 获取岗位选择框列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取岗位选择框列表")
|
||||||
@GetMapping("/optionselect")
|
@GetMapping("/optionselect")
|
||||||
public AjaxResult optionselect()
|
public AjaxResult<List<SysPost>> optionselect() {
|
||||||
{
|
|
||||||
List<SysPost> posts = postService.selectPostAll();
|
List<SysPost> posts = postService.selectPostAll();
|
||||||
return AjaxResult.success(posts);
|
return AjaxResult.success(posts);
|
||||||
}
|
}
|
||||||
|
@ -6,48 +6,49 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.core.service.TokenService;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.service.TokenService;
|
|
||||||
import com.ruoyi.system.domain.SysOss;
|
import com.ruoyi.system.domain.SysOss;
|
||||||
import com.ruoyi.system.service.ISysOssService;
|
import com.ruoyi.system.service.ISysOssService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息 业务处理
|
* 个人信息 业务处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "个人信息控制器", tags = {"个人信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/user/profile")
|
@RequestMapping("/system/user/profile")
|
||||||
public class SysProfileController extends BaseController
|
public class SysProfileController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService userService;
|
|
||||||
|
|
||||||
@Autowired
|
private final ISysUserService userService;
|
||||||
private TokenService tokenService;
|
private final TokenService tokenService;
|
||||||
|
private final ISysOssService iSysOssService;
|
||||||
@Autowired
|
|
||||||
private ISysOssService iSysOssService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息
|
* 个人信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("个人信息")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public AjaxResult profile()
|
public AjaxResult<Map<String, Object>> profile() {
|
||||||
{
|
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
SysUser user = loginUser.getUser();
|
SysUser user = userService.selectUserById(loginUser.getUserId());
|
||||||
Map<String,Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||||
@ -57,32 +58,24 @@ public class SysProfileController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改用户")
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
public AjaxResult<Void> updateProfile(@RequestBody SysUser user) {
|
||||||
{
|
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
{
|
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(user.getEmail())
|
if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||||
{
|
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
SysUser sysUser = loginUser.getUser();
|
SysUser sysUser = userService.selectUserById(loginUser.getUserId());
|
||||||
user.setUserId(sysUser.getUserId());
|
user.setUserId(sysUser.getUserId());
|
||||||
|
user.setUserName(null);
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
if (userService.updateUserProfile(user) > 0)
|
if (userService.updateUserProfile(user) > 0) {
|
||||||
{
|
|
||||||
// 更新缓存用户信息
|
|
||||||
sysUser.setNickName(user.getNickName());
|
|
||||||
sysUser.setPhonenumber(user.getPhonenumber());
|
|
||||||
sysUser.setEmail(user.getEmail());
|
|
||||||
sysUser.setSex(user.getSex());
|
|
||||||
tokenService.setLoginUser(loginUser);
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
||||||
@ -91,25 +84,26 @@ public class SysProfileController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("重置密码")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "oldPassword", value = "旧密码", paramType = "query", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "newPassword", value = "新密码", paramType = "query", dataTypeClass = String.class)
|
||||||
|
})
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/updatePwd")
|
@PutMapping("/updatePwd")
|
||||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
public AjaxResult<Void> updatePwd(String oldPassword, String newPassword) {
|
||||||
{
|
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
String userName = loginUser.getUsername();
|
String userName = loginUser.getUsername();
|
||||||
String password = loginUser.getPassword();
|
String password = loginUser.getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||||
{
|
|
||||||
return AjaxResult.error("修改密码失败,旧密码错误");
|
return AjaxResult.error("修改密码失败,旧密码错误");
|
||||||
}
|
}
|
||||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
if (SecurityUtils.matchesPassword(newPassword, password)) {
|
||||||
{
|
|
||||||
return AjaxResult.error("新密码不能与旧密码相同");
|
return AjaxResult.error("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) {
|
||||||
{
|
|
||||||
// 更新缓存用户密码
|
// 更新缓存用户密码
|
||||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
loginUser.setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
@ -119,25 +113,23 @@ public class SysProfileController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 头像上传
|
* 头像上传
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("头像上传")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "avatarfile", value = "用户头像", dataTypeClass = File.class, required = true),
|
||||||
|
})
|
||||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/avatar")
|
@PostMapping("/avatar")
|
||||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
|
public AjaxResult<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile file) {
|
||||||
{
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty()) {
|
||||||
{
|
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
SysOss oss = iSysOssService.upload(file);
|
SysOss oss = iSysOssService.upload(file);
|
||||||
String avatar = oss.getUrl();
|
String avatar = oss.getUrl();
|
||||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
|
||||||
{
|
|
||||||
Map<String,Object> ajax = new HashMap<>();
|
|
||||||
ajax.put("imgUrl", avatar);
|
ajax.put("imgUrl", avatar);
|
||||||
// 更新缓存用户头像
|
|
||||||
loginUser.getUser().setAvatar(avatar);
|
|
||||||
tokenService.setLoginUser(loginUser);
|
|
||||||
return AjaxResult.success(ajax);
|
return AjaxResult.success(ajax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return AjaxResult.error("上传图片异常,请联系管理员");
|
return AjaxResult.error("上传图片异常,请联系管理员", ajax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,13 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.service.SysRegisterService;
|
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import com.ruoyi.system.service.SysRegisterService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -14,22 +18,21 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
/**
|
/**
|
||||||
* 注册验证
|
* 注册验证
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "注册验证控制器", tags = {"注册验证管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
public class SysRegisterController extends BaseController
|
public class SysRegisterController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private SysRegisterService registerService;
|
|
||||||
|
|
||||||
@Autowired
|
private final SysRegisterService registerService;
|
||||||
private ISysConfigService configService;
|
private final ISysConfigService configService;
|
||||||
|
|
||||||
|
@ApiOperation("用户注册")
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public AjaxResult register(@RequestBody RegisterBody user)
|
public AjaxResult<Void> register(@RequestBody RegisterBody user) {
|
||||||
{
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
|
||||||
{
|
|
||||||
return error("当前系统没有开启注册功能!");
|
return error("当前系统没有开启注册功能!");
|
||||||
}
|
}
|
||||||
String msg = registerService.register(user);
|
String msg = registerService.register(user);
|
||||||
|
@ -8,14 +8,16 @@ import com.ruoyi.common.core.domain.entity.SysRole;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.service.TokenService;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
|
||||||
import com.ruoyi.framework.web.service.TokenService;
|
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.service.SysPermissionService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -27,36 +29,32 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "角色信息控制器", tags = {"角色信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/role")
|
@RequestMapping("/system/role")
|
||||||
public class SysRoleController extends BaseController
|
public class SysRoleController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysRoleService roleService;
|
|
||||||
|
|
||||||
@Autowired
|
private final ISysRoleService roleService;
|
||||||
private TokenService tokenService;
|
private final TokenService tokenService;
|
||||||
|
private final ISysUserService userService;
|
||||||
@Autowired
|
private final SysPermissionService permissionService;
|
||||||
private SysPermissionService permissionService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService userService;
|
|
||||||
|
|
||||||
|
@ApiOperation("查询角色信息列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysRole role)
|
public TableDataInfo<SysRole> list(SysRole role) {
|
||||||
{
|
|
||||||
return roleService.selectPageRoleList(role);
|
return roleService.selectPageRoleList(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出角色信息列表")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysRole role, HttpServletResponse response)
|
public void export(SysRole role, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response);
|
ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response);
|
||||||
}
|
}
|
||||||
@ -64,10 +62,10 @@ public class SysRoleController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 根据角色编号获取详细信息
|
* 根据角色编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据角色编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
@GetMapping(value = "/{roleId}")
|
@GetMapping(value = "/{roleId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
public AjaxResult<SysRole> getInfo(@ApiParam("角色ID") @PathVariable Long roleId) {
|
||||||
{
|
|
||||||
roleService.checkRoleDataScope(roleId);
|
roleService.checkRoleDataScope(roleId);
|
||||||
return AjaxResult.success(roleService.selectRoleById(roleId));
|
return AjaxResult.success(roleService.selectRoleById(roleId));
|
||||||
}
|
}
|
||||||
@ -75,20 +73,16 @@ public class SysRoleController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增角色
|
* 新增角色
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增角色")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
public AjaxResult<Void> add(@Validated @RequestBody SysRole role) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setCreateBy(getUsername());
|
|
||||||
return toAjax(roleService.insertRole(role));
|
return toAjax(roleService.insertRole(role));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -96,30 +90,24 @@ public class SysRoleController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改保存角色
|
* 修改保存角色
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改保存角色")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
{
|
|
||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setUpdateBy(getUsername());
|
|
||||||
|
|
||||||
if (roleService.updateRole(role) > 0)
|
if (roleService.updateRole(role) > 0) {
|
||||||
{
|
|
||||||
// 更新缓存用户权限
|
// 更新缓存用户权限
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
SysUser sysUser = userService.selectUserById(loginUser.getUserId());
|
||||||
{
|
if (StringUtils.isNotNull(sysUser) && !sysUser.isAdmin()) {
|
||||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
loginUser.setPermissions(permissionService.getMenuPermission(sysUser));
|
||||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
@ -130,11 +118,11 @@ public class SysRoleController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改保存数据权限
|
* 修改保存数据权限
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改保存数据权限")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/dataScope")
|
@PutMapping("/dataScope")
|
||||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
public AjaxResult<Void> dataScope(@RequestBody SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
return toAjax(roleService.authDataScope(role));
|
return toAjax(roleService.authDataScope(role));
|
||||||
}
|
}
|
||||||
@ -142,87 +130,94 @@ public class SysRoleController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 状态修改
|
* 状态修改
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("状态修改")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
public AjaxResult<Void> changeStatus(@RequestBody SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
role.setUpdateBy(getUsername());
|
|
||||||
return toAjax(roleService.updateRoleStatus(role));
|
return toAjax(roleService.updateRoleStatus(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除角色
|
* 删除角色
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除角色")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{roleIds}")
|
@DeleteMapping("/{roleIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
public AjaxResult<Void> remove(@ApiParam("岗位ID串") @PathVariable Long[] roleIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取角色选择框列表
|
* 获取角色选择框列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取角色选择框列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
@GetMapping("/optionselect")
|
@GetMapping("/optionselect")
|
||||||
public AjaxResult optionselect()
|
public AjaxResult<List<SysRole>> optionselect() {
|
||||||
{
|
|
||||||
return AjaxResult.success(roleService.selectRoleAll());
|
return AjaxResult.success(roleService.selectRoleAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询已分配用户角色列表
|
* 查询已分配用户角色列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询已分配用户角色列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
@GetMapping("/authUser/allocatedList")
|
@GetMapping("/authUser/allocatedList")
|
||||||
public TableDataInfo allocatedList(SysUser user)
|
public TableDataInfo<SysUser> allocatedList(SysUser user) {
|
||||||
{
|
|
||||||
return userService.selectAllocatedList(user);
|
return userService.selectAllocatedList(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询未分配用户角色列表
|
* 查询未分配用户角色列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询未分配用户角色列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
@GetMapping("/authUser/unallocatedList")
|
@GetMapping("/authUser/unallocatedList")
|
||||||
public TableDataInfo unallocatedList(SysUser user)
|
public TableDataInfo<SysUser> unallocatedList(SysUser user) {
|
||||||
{
|
|
||||||
return userService.selectUnallocatedList(user);
|
return userService.selectUnallocatedList(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消授权用户
|
* 取消授权用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("取消授权用户")
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authUser/cancel")
|
@PutMapping("/authUser/cancel")
|
||||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
public AjaxResult<Void> cancelAuthUser(@RequestBody SysUserRole userRole) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteAuthUser(userRole));
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量取消授权用户
|
* 批量取消授权用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("批量取消授权用户")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "userIds", value = "用户ID串", paramType = "query", dataTypeClass = String.class)
|
||||||
|
})
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authUser/cancelAll")
|
@PutMapping("/authUser/cancelAll")
|
||||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
public AjaxResult<Void> cancelAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量选择用户授权
|
* 批量选择用户授权
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("批量选择用户授权")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "userIds", value = "用户ID串", paramType = "query", dataTypeClass = String.class)
|
||||||
|
})
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authUser/selectAll")
|
@PutMapping("/authUser/selectAll")
|
||||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
public AjaxResult<Void> selectAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,18 @@ import com.ruoyi.common.core.domain.entity.SysRole;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.excel.ExcelResult;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.vo.SysUserExportVo;
|
import com.ruoyi.system.domain.vo.SysUserExportVo;
|
||||||
import com.ruoyi.system.domain.vo.SysUserImportVo;
|
import com.ruoyi.system.domain.vo.SysUserImportVo;
|
||||||
|
import com.ruoyi.system.listener.SysUserImportListener;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -36,36 +40,34 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "用户信息控制器", tags = {"用户信息管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/user")
|
@RequestMapping("/system/user")
|
||||||
public class SysUserController extends BaseController
|
public class SysUserController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService userService;
|
|
||||||
|
|
||||||
@Autowired
|
private final ISysUserService userService;
|
||||||
private ISysRoleService roleService;
|
private final ISysRoleService roleService;
|
||||||
|
private final ISysPostService postService;
|
||||||
@Autowired
|
|
||||||
private ISysPostService postService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户列表
|
* 获取用户列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取用户列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysUser user)
|
public TableDataInfo<SysUser> list(SysUser user) {
|
||||||
{
|
|
||||||
return userService.selectPageUserList(user);
|
return userService.selectPageUserList(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出用户列表")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysUser user, HttpServletResponse response)
|
public void export(SysUser user, HttpServletResponse response) {
|
||||||
{
|
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class);
|
List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class);
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
@ -79,38 +81,37 @@ public class SysUserController extends BaseController
|
|||||||
ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response);
|
ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导入用户列表")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "file", value = "导入文件", dataType = "java.io.File", required = true),
|
||||||
|
})
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
{
|
ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport));
|
||||||
List<SysUserImportVo> userListVo = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class);
|
return AjaxResult.success(result.getAnalysis());
|
||||||
List<SysUser> userList = BeanUtil.copyToList(userListVo, SysUser.class);
|
|
||||||
String operName = getUsername();
|
|
||||||
String message = userService.importUser(userList, updateSupport, operName);
|
|
||||||
return AjaxResult.success(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/importTemplate")
|
@ApiOperation("下载导入模板")
|
||||||
public void importTemplate(HttpServletResponse response)
|
@PostMapping("/importTemplate")
|
||||||
{
|
public void importTemplate(HttpServletResponse response) {
|
||||||
ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response);
|
ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户编号获取详细信息
|
* 根据用户编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据用户编号获取详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
@GetMapping(value = { "/", "/{userId}" })
|
@GetMapping(value = {"/", "/{userId}"})
|
||||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
public AjaxResult<Map<String, Object>> getInfo(@ApiParam("用户ID") @PathVariable(value = "userId", required = false) Long userId) {
|
||||||
{
|
|
||||||
userService.checkUserDataScope(userId);
|
userService.checkUserDataScope(userId);
|
||||||
Map<String, Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
List<SysRole> roles = roleService.selectRoleAll();
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
ajax.put("posts", postService.selectPostAll());
|
ajax.put("posts", postService.selectPostAll());
|
||||||
if (StringUtils.isNotNull(userId))
|
if (StringUtils.isNotNull(userId)) {
|
||||||
{
|
|
||||||
ajax.put("user", userService.selectUserById(userId));
|
ajax.put("user", userService.selectUserById(userId));
|
||||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||||
ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
|
ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
|
||||||
@ -121,26 +122,20 @@ public class SysUserController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("新增用户")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
public AjaxResult<Void> add(@Validated @RequestBody SysUser user) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setCreateBy(getUsername());
|
|
||||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
return toAjax(userService.insertUser(user));
|
return toAjax(userService.insertUser(user));
|
||||||
}
|
}
|
||||||
@ -148,36 +143,31 @@ public class SysUserController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("修改用户")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
public AjaxResult<Void> edit(@Validated @RequestBody SysUser user) {
|
||||||
{
|
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
{
|
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setUpdateBy(getUsername());
|
|
||||||
return toAjax(userService.updateUser(user));
|
return toAjax(userService.updateUser(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除用户")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{userIds}")
|
@DeleteMapping("/{userIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
public AjaxResult<Void> remove(@ApiParam("角色ID串") @PathVariable Long[] userIds) {
|
||||||
{
|
if (ArrayUtil.contains(userIds, getUserId())) {
|
||||||
if (ArrayUtil.contains(userIds, getUserId()))
|
|
||||||
{
|
|
||||||
return error("当前用户不能删除");
|
return error("当前用户不能删除");
|
||||||
}
|
}
|
||||||
return toAjax(userService.deleteUserByIds(userIds));
|
return toAjax(userService.deleteUserByIds(userIds));
|
||||||
@ -186,37 +176,35 @@ public class SysUserController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("重置密码")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/resetPwd")
|
@PutMapping("/resetPwd")
|
||||||
public AjaxResult resetPwd(@RequestBody SysUser user)
|
public AjaxResult<Void> resetPwd(@RequestBody SysUser user) {
|
||||||
{
|
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
user.setUpdateBy(getUsername());
|
|
||||||
return toAjax(userService.resetPwd(user));
|
return toAjax(userService.resetPwd(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态修改
|
* 状态修改
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("状态修改")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
public AjaxResult<Void> changeStatus(@RequestBody SysUser user) {
|
||||||
{
|
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
user.setUpdateBy(getUsername());
|
|
||||||
return toAjax(userService.updateUserStatus(user));
|
return toAjax(userService.updateUserStatus(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户编号获取授权角色
|
* 根据用户编号获取授权角色
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据用户编号获取授权角色")
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
@GetMapping("/authRole/{userId}")
|
@GetMapping("/authRole/{userId}")
|
||||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
public AjaxResult<Map<String, Object>> authRole(@ApiParam("用户ID") @PathVariable("userId") Long userId) {
|
||||||
{
|
|
||||||
SysUser user = userService.selectUserById(userId);
|
SysUser user = userService.selectUserById(userId);
|
||||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
Map<String, Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
@ -228,11 +216,15 @@ public class SysUserController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 用户授权角色
|
* 用户授权角色
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("用户授权角色")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户Id", paramType = "query", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "roleIds", value = "角色ID串", paramType = "query", dataTypeClass = String.class)
|
||||||
|
})
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authRole")
|
@PutMapping("/authRole")
|
||||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
public AjaxResult<Void> insertAuthRole(Long userId, Long[] roleIds) {
|
||||||
{
|
|
||||||
userService.insertUserAuth(userId, roleIds);
|
userService.insertUserAuth(userId, roleIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,43 @@
|
|||||||
# 数据源配置
|
--- # 监控配置
|
||||||
|
spring:
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
# Spring Boot Admin Client 客户端的相关配置
|
||||||
|
client:
|
||||||
|
# 增加客户端开关
|
||||||
|
enabled: true
|
||||||
|
# 设置 Spring Boot Admin Server 地址
|
||||||
|
url: http://localhost:9090/admin
|
||||||
|
instance:
|
||||||
|
prefer-ip: true # 注册实例时,优先使用 IP
|
||||||
|
username: ruoyi
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
--- # xxl-job 配置
|
||||||
|
xxl:
|
||||||
|
job:
|
||||||
|
# 执行器开关
|
||||||
|
enabled: true
|
||||||
|
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
||||||
|
admin-addresses: http://localhost:9100/xxl-job-admin
|
||||||
|
# 执行器通讯TOKEN:非空时启用
|
||||||
|
access-token: xxl-job
|
||||||
|
# 执行器配置
|
||||||
|
executor:
|
||||||
|
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
|
||||||
|
appname: xxl-job-executor
|
||||||
|
# 执行器端口号 执行器从9101开始往后写
|
||||||
|
port: 9101
|
||||||
|
# 执行器注册:默认IP:PORT
|
||||||
|
address:
|
||||||
|
# 执行器IP:默认自动获取IP
|
||||||
|
ip:
|
||||||
|
# 执行器运行日志文件存储磁盘路径
|
||||||
|
logpath: ./logs/xxl-job
|
||||||
|
# 执行器日志文件保存天数:大于3生效
|
||||||
|
logretentiondays: 30
|
||||||
|
|
||||||
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
@ -38,7 +77,7 @@ spring:
|
|||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
maxEvictableIdleTimeMillis: 900000
|
maxEvictableIdleTimeMillis: 900000
|
||||||
# 配置检测连接是否有效
|
# 配置检测连接是否有效
|
||||||
validationQuery: SELECT 1
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
testWhileIdle: true
|
testWhileIdle: true
|
||||||
testOnBorrow: false
|
testOnBorrow: false
|
||||||
testOnReturn: false
|
testOnReturn: false
|
||||||
@ -70,7 +109,7 @@ spring:
|
|||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
|
||||||
--- # redis 配置
|
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
@ -117,18 +156,3 @@ redisson:
|
|||||||
subscriptionsPerConnection: 5
|
subscriptionsPerConnection: 5
|
||||||
# DNS监测时间间隔,单位:毫秒
|
# DNS监测时间间隔,单位:毫秒
|
||||||
dnsMonitoringInterval: 5000
|
dnsMonitoringInterval: 5000
|
||||||
|
|
||||||
--- # 监控配置
|
|
||||||
spring:
|
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
# Spring Boot Admin Client 客户端的相关配置
|
|
||||||
client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
url: http://localhost:9090/admin
|
|
||||||
instance:
|
|
||||||
prefer-ip: true # 注册实例时,优先使用 IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
||||||
|
@ -1,4 +1,50 @@
|
|||||||
# 数据源配置
|
--- # 配置临时路径存储
|
||||||
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# 临时文件存储位置 避免临时文件被系统清理报错
|
||||||
|
location: /ruoyi/server/temp
|
||||||
|
|
||||||
|
--- # 监控配置
|
||||||
|
spring:
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
# Spring Boot Admin Client 客户端的相关配置
|
||||||
|
client:
|
||||||
|
# 增加客户端开关
|
||||||
|
enabled: true
|
||||||
|
# 设置 Spring Boot Admin Server 地址
|
||||||
|
url: http://172.30.0.90:9090/admin
|
||||||
|
instance:
|
||||||
|
prefer-ip: true # 注册实例时,优先使用 IP
|
||||||
|
username: ruoyi
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
--- # xxl-job 配置
|
||||||
|
xxl:
|
||||||
|
job:
|
||||||
|
# 执行器开关
|
||||||
|
enabled: true
|
||||||
|
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
||||||
|
admin-addresses: http://172.30.0.92:9100/xxl-job-admin
|
||||||
|
# 执行器通讯TOKEN:非空时启用
|
||||||
|
access-token: xxl-job
|
||||||
|
# 执行器配置
|
||||||
|
executor:
|
||||||
|
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
|
||||||
|
appname: xxl-job-executor
|
||||||
|
# 执行器端口号 执行器从9101开始往后写
|
||||||
|
port: 9101
|
||||||
|
# 执行器注册:默认IP:PORT
|
||||||
|
address:
|
||||||
|
# 执行器IP:默认自动获取IP
|
||||||
|
ip:
|
||||||
|
# 执行器运行日志文件存储磁盘路径
|
||||||
|
logpath: ./logs/xxl-job
|
||||||
|
# 执行器日志文件保存天数:大于3生效
|
||||||
|
logretentiondays: 30
|
||||||
|
|
||||||
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
@ -38,7 +84,7 @@ spring:
|
|||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
maxEvictableIdleTimeMillis: 900000
|
maxEvictableIdleTimeMillis: 900000
|
||||||
# 配置检测连接是否有效
|
# 配置检测连接是否有效
|
||||||
validationQuery: SELECT 1
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
testWhileIdle: true
|
testWhileIdle: true
|
||||||
testOnBorrow: false
|
testOnBorrow: false
|
||||||
testOnReturn: false
|
testOnReturn: false
|
||||||
@ -70,7 +116,7 @@ spring:
|
|||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
|
||||||
--- # redis 配置
|
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
@ -117,18 +163,3 @@ redisson:
|
|||||||
subscriptionsPerConnection: 5
|
subscriptionsPerConnection: 5
|
||||||
# DNS监测时间间隔,单位:毫秒
|
# DNS监测时间间隔,单位:毫秒
|
||||||
dnsMonitoringInterval: 5000
|
dnsMonitoringInterval: 5000
|
||||||
|
|
||||||
--- # 监控配置
|
|
||||||
spring:
|
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
# Spring Boot Admin Client 客户端的相关配置
|
|
||||||
client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
url: http://172.30.0.90:9090/admin
|
|
||||||
instance:
|
|
||||||
prefer-ip: true # 注册实例时,优先使用 IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
||||||
|
@ -10,6 +10,8 @@ ruoyi:
|
|||||||
demoEnabled: true
|
demoEnabled: true
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
addressEnabled: true
|
addressEnabled: true
|
||||||
|
# 缓存懒加载
|
||||||
|
cacheLazy: true
|
||||||
|
|
||||||
captcha:
|
captcha:
|
||||||
# 页面 <参数设置> 可开启关闭 验证码校验
|
# 页面 <参数设置> 可开启关闭 验证码校验
|
||||||
@ -43,14 +45,6 @@ server:
|
|||||||
io: 8
|
io: 8
|
||||||
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
|
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
|
||||||
worker: 256
|
worker: 256
|
||||||
# # tomcat 配置
|
|
||||||
# tomcat:
|
|
||||||
# # tomcat的URI编码
|
|
||||||
# uri-encoding: UTF-8
|
|
||||||
# # tomcat最大线程数,默认为200
|
|
||||||
# max-threads: 500
|
|
||||||
# # Tomcat启动初始化的线程数,默认值25
|
|
||||||
# min-spare-threads: 30
|
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
@ -59,6 +53,10 @@ logging:
|
|||||||
org.springframework: warn
|
org.springframework: warn
|
||||||
config: classpath:logback.xml
|
config: classpath:logback.xml
|
||||||
|
|
||||||
|
# tlog 全局访问性能拦截
|
||||||
|
tlog:
|
||||||
|
enable-invoke-time-print: true
|
||||||
|
|
||||||
# Spring配置
|
# Spring配置
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
@ -106,10 +104,32 @@ token:
|
|||||||
# 令牌有效期(默认30分钟)
|
# 令牌有效期(默认30分钟)
|
||||||
expireTime: 30
|
expireTime: 30
|
||||||
|
|
||||||
|
# security配置
|
||||||
|
security:
|
||||||
|
# 登出路径
|
||||||
|
logout-url: /logout
|
||||||
|
# 匿名路径
|
||||||
|
anonymous:
|
||||||
|
- /login
|
||||||
|
- /register
|
||||||
|
- /captchaImage
|
||||||
|
# swagger 文档配置
|
||||||
|
- /doc.html
|
||||||
|
- /swagger-resources/**
|
||||||
|
- /webjars/**
|
||||||
|
- /*/api-docs
|
||||||
|
# druid 监控配置
|
||||||
|
- /druid/**
|
||||||
|
# actuator 监控配置
|
||||||
|
- /actuator
|
||||||
|
- /actuator/**
|
||||||
|
# 用户放行
|
||||||
|
permit-all:
|
||||||
|
|
||||||
# 重复提交
|
# 重复提交
|
||||||
repeat-submit:
|
repeat-submit:
|
||||||
# 全局间隔时间(毫秒)
|
# 全局间隔时间(毫秒)
|
||||||
intervalTime: 1000
|
interval: 5000
|
||||||
|
|
||||||
# MyBatisPlus配置
|
# MyBatisPlus配置
|
||||||
# https://baomidou.com/config/
|
# https://baomidou.com/config/
|
||||||
@ -121,43 +141,24 @@ mybatis-plus:
|
|||||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 实体扫描,多个package用逗号或者分号分隔
|
# 实体扫描,多个package用逗号或者分号分隔
|
||||||
typeAliasesPackage: com.ruoyi.**.domain
|
typeAliasesPackage: com.ruoyi.**.domain
|
||||||
# 针对 typeAliasesPackage,如果配置了该属性,则仅仅会扫描路径下以该类作为父类的域对象
|
|
||||||
#typeAliasesSuperType: Class<?>
|
|
||||||
# 如果配置了该属性,SqlSessionFactoryBean 会把该包下面的类注册为对应的 TypeHandler
|
|
||||||
#typeHandlersPackage: null
|
|
||||||
# 如果配置了该属性,会将路径下的枚举类进行注入,让实体类字段能够简单快捷的使用枚举属性
|
|
||||||
#typeEnumsPackage: null
|
|
||||||
# 启动时是否检查 MyBatis XML 文件的存在,默认不检查
|
# 启动时是否检查 MyBatis XML 文件的存在,默认不检查
|
||||||
checkConfigLocation: false
|
checkConfigLocation: false
|
||||||
# 通过该属性可指定 MyBatis 的执行器,MyBatis 的执行器总共有三种:
|
# 通过该属性可指定 MyBatis 的执行器,MyBatis 的执行器总共有三种:
|
||||||
# SIMPLE:该执行器类型不做特殊的事情,为每个语句的执行创建一个新的预处理语句(PreparedStatement)
|
# SIMPLE:每个语句创建新的预处理器 REUSE:会复用预处理器 BATCH:批量执行所有的更新
|
||||||
# REUSE:该执行器类型会复用预处理语句(PreparedStatement)
|
|
||||||
# BATCH:该执行器类型会批量执行所有的更新语句
|
|
||||||
executorType: SIMPLE
|
executorType: SIMPLE
|
||||||
configuration:
|
configuration:
|
||||||
# 自动驼峰命名规则(camel case)映射
|
# 自动驼峰命名规则(camel case)映射
|
||||||
# 如果您的数据库命名符合规则无需使用 @TableField 注解指定数据库字段名
|
|
||||||
mapUnderscoreToCamelCase: true
|
mapUnderscoreToCamelCase: true
|
||||||
# 默认枚举处理类,如果配置了该属性,枚举将统一使用指定处理器进行处理
|
|
||||||
# org.apache.ibatis.type.EnumTypeHandler : 存储枚举的名称
|
|
||||||
# org.apache.ibatis.type.EnumOrdinalTypeHandler : 存储枚举的索引
|
|
||||||
# com.baomidou.mybatisplus.extension.handlers.MybatisEnumTypeHandler : 枚举类需要实现IEnum接口或字段标记@EnumValue注解.
|
|
||||||
defaultEnumTypeHandler: org.apache.ibatis.type.EnumTypeHandler
|
|
||||||
# 当设置为 true 的时候,懒加载的对象可能被任何懒属性全部加载,否则,每个属性都按需加载。需要和 lazyLoadingEnabled 一起使用。
|
# 当设置为 true 的时候,懒加载的对象可能被任何懒属性全部加载,否则,每个属性都按需加载。需要和 lazyLoadingEnabled 一起使用。
|
||||||
aggressiveLazyLoading: true
|
aggressiveLazyLoading: true
|
||||||
# MyBatis 自动映射策略
|
# MyBatis 自动映射策略
|
||||||
# NONE:不启用自动映射
|
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
|
||||||
# PARTIAL:只对非嵌套的 resultMap 进行自动映射
|
|
||||||
# FULL:对所有的 resultMap 都进行自动映射
|
|
||||||
autoMappingBehavior: PARTIAL
|
autoMappingBehavior: PARTIAL
|
||||||
# MyBatis 自动映射时未知列或未知属性处理策
|
# MyBatis 自动映射时未知列或未知属性处理策
|
||||||
# NONE:不做任何处理 (默认值)
|
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||||
# WARNING:以日志的形式打印相关警告信息
|
|
||||||
# FAILING:当作映射失败处理,并抛出异常和详细信息
|
|
||||||
autoMappingUnknownColumnBehavior: NONE
|
autoMappingUnknownColumnBehavior: NONE
|
||||||
# Mybatis一级缓存,默认为 SESSION
|
# Mybatis一级缓存,默认为 SESSION
|
||||||
# SESSION session级别缓存,同一个session相同查询语句不会再次查询数据库
|
# SESSION session级别缓存 STATEMENT 关闭一级缓存
|
||||||
# STATEMENT 关闭一级缓存
|
|
||||||
localCacheScope: SESSION
|
localCacheScope: SESSION
|
||||||
# 开启Mybatis二级缓存,默认为 true
|
# 开启Mybatis二级缓存,默认为 true
|
||||||
cacheEnabled: false
|
cacheEnabled: false
|
||||||
@ -172,32 +173,18 @@ mybatis-plus:
|
|||||||
enableSqlRunner: false
|
enableSqlRunner: false
|
||||||
dbConfig:
|
dbConfig:
|
||||||
# 主键类型
|
# 主键类型
|
||||||
# AUTO 数据库ID自增
|
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
|
||||||
# NONE 空
|
|
||||||
# INPUT 用户输入ID
|
|
||||||
# ASSIGN_ID 全局唯一ID
|
|
||||||
# ASSIGN_UUID 全局唯一ID UUID
|
|
||||||
idType: AUTO
|
idType: AUTO
|
||||||
# 表名前缀
|
|
||||||
tablePrefix: null
|
|
||||||
# 字段 format,例: %s,(对主键无效)
|
|
||||||
columnFormat: null
|
|
||||||
# 表名是否使用驼峰转下划线命名,只对表名生效
|
# 表名是否使用驼峰转下划线命名,只对表名生效
|
||||||
tableUnderline: true
|
tableUnderline: true
|
||||||
# 大写命名,对表名和字段名均生效
|
# 大写命名,对表名和字段名均生效
|
||||||
capitalMode: false
|
capitalMode: false
|
||||||
# 全局的entity的逻辑删除字段属性名
|
|
||||||
logicDeleteField: null
|
|
||||||
# 逻辑已删除值
|
# 逻辑已删除值
|
||||||
logicDeleteValue: 2
|
logicDeleteValue: 2
|
||||||
# 逻辑未删除值
|
# 逻辑未删除值
|
||||||
logicNotDeleteValue: 0
|
logicNotDeleteValue: 0
|
||||||
# 字段验证策略之 insert,在 insert 的时候的字段验证策略
|
# 字段验证策略之 insert,在 insert 的时候的字段验证策略
|
||||||
# IGNORED 忽略判断
|
# IGNORED 忽略 NOT_NULL 非NULL NOT_EMPTY 非空 DEFAULT 默认 NEVER 不加入 SQL
|
||||||
# NOT_NULL 非NULL判断
|
|
||||||
# NOT_EMPTY 非空判断(只对字符串类型字段,其他类型字段依然为非NULL判断)
|
|
||||||
# DEFAULT 默认的,一般只用于注解里
|
|
||||||
# NEVER 不加入 SQL
|
|
||||||
insertStrategy: NOT_NULL
|
insertStrategy: NOT_NULL
|
||||||
# 字段验证策略之 update,在 update 的时候的字段验证策略
|
# 字段验证策略之 update,在 update 的时候的字段验证策略
|
||||||
updateStrategy: NOT_NULL
|
updateStrategy: NOT_NULL
|
||||||
@ -221,6 +208,29 @@ swagger:
|
|||||||
name: Lion Li
|
name: Lion Li
|
||||||
email: crazylionli@163.com
|
email: crazylionli@163.com
|
||||||
url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus
|
url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus
|
||||||
|
groups:
|
||||||
|
- name: 1.演示案例
|
||||||
|
basePackage: com.ruoyi.demo
|
||||||
|
- name: 2.系统模块
|
||||||
|
basePackage: com.ruoyi.web
|
||||||
|
- name: 3.代码生成模块
|
||||||
|
basePackage: com.ruoyi.generator
|
||||||
|
|
||||||
|
knife4j:
|
||||||
|
# 是否开启Knife4j增强模式
|
||||||
|
enable: true
|
||||||
|
# 是否开启生产环境保护策略
|
||||||
|
production: @knife4j.production@
|
||||||
|
# 前端Ui的个性化配置属性
|
||||||
|
setting:
|
||||||
|
# 默认语言
|
||||||
|
language: zh-CN
|
||||||
|
# 是否显示Footer
|
||||||
|
enableFooter: false
|
||||||
|
# 是否开启动态参数调试功能
|
||||||
|
enableDynamicParameter: true
|
||||||
|
# 是否在每个Debug调试栏后显示刷新变量按钮
|
||||||
|
enableReloadCacheParameter: true
|
||||||
|
|
||||||
# 防止XSS攻击
|
# 防止XSS攻击
|
||||||
xss:
|
xss:
|
||||||
@ -244,28 +254,12 @@ thread-pool:
|
|||||||
# 线程池维护线程所允许的空闲时间
|
# 线程池维护线程所允许的空闲时间
|
||||||
keepAliveSeconds: 300
|
keepAliveSeconds: 300
|
||||||
# 线程池对拒绝任务(无线程可用)的处理策略
|
# 线程池对拒绝任务(无线程可用)的处理策略
|
||||||
# CALLER_RUNS_POLICY 等待
|
# CALLER_RUNS_POLICY 调用方执行
|
||||||
# DISCARD_OLDEST_POLICY 放弃最旧的
|
# DISCARD_OLDEST_POLICY 放弃最旧的
|
||||||
# DISCARD_POLICY 丢弃
|
# DISCARD_POLICY 丢弃
|
||||||
# ABORT_POLICY 中止
|
# ABORT_POLICY 中止
|
||||||
rejectedExecutionHandler: CALLER_RUNS_POLICY
|
rejectedExecutionHandler: CALLER_RUNS_POLICY
|
||||||
|
|
||||||
# feign 相关配置
|
|
||||||
feign:
|
|
||||||
# 不支持多包, 如有需要可在注解配置 或 提升扫包等级
|
|
||||||
# 例如 com.**.**.feign
|
|
||||||
package: com.ruoyi.**.feign
|
|
||||||
# 开启压缩
|
|
||||||
compression:
|
|
||||||
request:
|
|
||||||
enabled: true
|
|
||||||
response:
|
|
||||||
enabled: true
|
|
||||||
okhttp:
|
|
||||||
enabled: true
|
|
||||||
circuitbreaker:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
--- # redisson 缓存配置
|
--- # redisson 缓存配置
|
||||||
redisson:
|
redisson:
|
||||||
cacheGroup:
|
cacheGroup:
|
||||||
@ -301,34 +295,3 @@ management:
|
|||||||
endpoint:
|
endpoint:
|
||||||
logfile:
|
logfile:
|
||||||
external-file: ./logs/sys-console.log
|
external-file: ./logs/sys-console.log
|
||||||
|
|
||||||
--- # 定时任务配置
|
|
||||||
spring:
|
|
||||||
quartz:
|
|
||||||
scheduler-name: RuoyiScheduler
|
|
||||||
startup-delay: 1s
|
|
||||||
overwrite-existing-jobs: true
|
|
||||||
auto-startup: true
|
|
||||||
job-store-type: jdbc
|
|
||||||
properties:
|
|
||||||
org:
|
|
||||||
quartz:
|
|
||||||
# Scheduler 相关配置
|
|
||||||
scheduler:
|
|
||||||
instanceName: RuoyiScheduler
|
|
||||||
instanceId: AUTO
|
|
||||||
# 线程池相关配置
|
|
||||||
threadPool:
|
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
|
||||||
threadCount: 20
|
|
||||||
threadPriority: 5
|
|
||||||
# JobStore 集群配置
|
|
||||||
jobStore:
|
|
||||||
class: org.quartz.impl.jdbcjobstore.JobStoreTX
|
|
||||||
isClustered: true
|
|
||||||
clusterCheckinInterval: 15000
|
|
||||||
txIsolationLevelSerializable: true
|
|
||||||
misfireThreshold: 60000
|
|
||||||
tablePrefix: QRTZ_
|
|
||||||
# sqlserver 启用
|
|
||||||
# selectWithLockSQL: SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?
|
|
||||||
|
@ -10,12 +10,9 @@ user.password.delete=对不起,您的账号已被删除
|
|||||||
user.blocked=用户已封禁,请联系管理员
|
user.blocked=用户已封禁,请联系管理员
|
||||||
role.blocked=角色已封禁,请联系管理员
|
role.blocked=角色已封禁,请联系管理员
|
||||||
user.logout.success=退出成功
|
user.logout.success=退出成功
|
||||||
|
|
||||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||||
|
|
||||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||||
user.password.not.valid=* 5-50个字符
|
user.password.not.valid=* 5-50个字符
|
||||||
|
|
||||||
user.email.not.valid=邮箱格式错误
|
user.email.not.valid=邮箱格式错误
|
||||||
user.mobile.phone.number.not.valid=手机号格式错误
|
user.mobile.phone.number.not.valid=手机号格式错误
|
||||||
user.login.success=登录成功
|
user.login.success=登录成功
|
||||||
@ -23,11 +20,9 @@ user.register.success=注册成功
|
|||||||
user.notfound=请重新登录
|
user.notfound=请重新登录
|
||||||
user.forcelogout=管理员强制退出,请重新登录
|
user.forcelogout=管理员强制退出,请重新登录
|
||||||
user.unknown.error=未知错误,请重新登录
|
user.unknown.error=未知错误,请重新登录
|
||||||
|
|
||||||
##文件上传消息
|
##文件上传消息
|
||||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||||
|
|
||||||
##权限
|
##权限
|
||||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
@ -1,33 +1,32 @@
|
|||||||
#错误消息
|
#错误消息
|
||||||
not.null=
|
not.null=* Required fill in
|
||||||
user.jcaptcha.error=
|
user.jcaptcha.error=Captcha error
|
||||||
user.jcaptcha.expire=
|
user.jcaptcha.expire=Captcha invalid
|
||||||
user.not.exists=
|
user.not.exists=User does not exist/Password error
|
||||||
user.password.not.match=
|
user.password.not.match=User does not exist/Password error
|
||||||
user.password.retry.limit.count=
|
user.password.retry.limit.count=Password input error {0} times
|
||||||
user.password.retry.limit.exceed=
|
user.password.retry.limit.exceed=Password input error {0} times, account locked for 10 minutes
|
||||||
user.password.delete=
|
user.password.delete=Sorry, your account has been deleted
|
||||||
user.blocked=
|
user.blocked=User disabled,please contact administrators
|
||||||
role.blocked=
|
role.blocked=Role disabled,please contact administrators
|
||||||
user.logout.success=
|
user.logout.success=Exit successful
|
||||||
length.not.valid=
|
length.not.valid=The length must be between {min} and {max} characters
|
||||||
user.username.not.valid=
|
user.username.not.valid=* 2 to 20 chinese characters, letters, numbers or underscores, and must start with a non number
|
||||||
user.password.not.valid=
|
user.password.not.valid=* 5-50 characters
|
||||||
user.email.not.valid=
|
user.email.not.valid=Mailbox format error
|
||||||
user.mobile.phone.number.not.valid=
|
user.mobile.phone.number.not.valid=Phone number format error
|
||||||
user.login.success=
|
user.login.success=Login successful
|
||||||
user.register.success=register success
|
user.register.success=Register successful
|
||||||
user.notfound=
|
user.notfound=Please login again
|
||||||
user.unknown.error=
|
user.forcelogout=The administrator is forced to exit,please login again
|
||||||
|
user.unknown.error=Unknown error, please login again
|
||||||
##文件上传消息
|
##文件上传消息
|
||||||
upload.exceed.maxSize=
|
upload.exceed.maxSize=The uploaded file size exceeds the limit file size!<br/>the maximum allowed file size is:{0}MB!
|
||||||
upload.filename.exceed.length=
|
upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters
|
||||||
|
|
||||||
##权限
|
##权限
|
||||||
no.permission=
|
no.permission=You do not have permission to the data,please contact your administrator to add permissions [{0}]
|
||||||
no.create.permission=
|
no.create.permission=You do not have permission to create data,please contact your administrator to add permissions [{0}]
|
||||||
no.update.permission=
|
no.update.permission=You do not have permission to modify data,please contact your administrator to add permissions [{0}]
|
||||||
no.delete.permission=
|
no.delete.permission=You do not have permission to delete data,please contact your administrator to add permissions [{0}]
|
||||||
no.export.permission=
|
no.export.permission=You do not have permission to export data,please contact your administrator to add permissions [{0}]
|
||||||
no.view.permission=
|
no.view.permission=You do not have permission to view data,please contact your administrator to add permissions [{0}]
|
||||||
|
@ -10,12 +10,9 @@ user.password.delete=对不起,您的账号已被删除
|
|||||||
user.blocked=用户已封禁,请联系管理员
|
user.blocked=用户已封禁,请联系管理员
|
||||||
role.blocked=角色已封禁,请联系管理员
|
role.blocked=角色已封禁,请联系管理员
|
||||||
user.logout.success=退出成功
|
user.logout.success=退出成功
|
||||||
|
|
||||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||||
|
|
||||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||||
user.password.not.valid=* 5-50个字符
|
user.password.not.valid=* 5-50个字符
|
||||||
|
|
||||||
user.email.not.valid=邮箱格式错误
|
user.email.not.valid=邮箱格式错误
|
||||||
user.mobile.phone.number.not.valid=手机号格式错误
|
user.mobile.phone.number.not.valid=手机号格式错误
|
||||||
user.login.success=登录成功
|
user.login.success=登录成功
|
||||||
@ -23,11 +20,9 @@ user.register.success=注册成功
|
|||||||
user.notfound=请重新登录
|
user.notfound=请重新登录
|
||||||
user.forcelogout=管理员强制退出,请重新登录
|
user.forcelogout=管理员强制退出,请重新登录
|
||||||
user.unknown.error=未知错误,请重新登录
|
user.unknown.error=未知错误,请重新登录
|
||||||
|
|
||||||
##文件上传消息
|
##文件上传消息
|
||||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||||
|
|
||||||
##权限
|
##权限
|
||||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${console.log.pattern}</pattern>
|
<pattern>${console.log.pattern}</pattern>
|
||||||
<charset>utf-8</charset>
|
<charset>utf-8</charset>
|
||||||
</encoder>
|
</encoder>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<!-- 日志最大 1天 -->
|
<!-- 日志最大 1天 -->
|
||||||
<maxHistory>1</maxHistory>
|
<maxHistory>1</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
<charset>utf-8</charset>
|
<charset>utf-8</charset>
|
||||||
</encoder>
|
</encoder>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
@ -64,7 +64,7 @@
|
|||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
@ -77,20 +77,6 @@
|
|||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 用户访问日志输出 -->
|
|
||||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/sys-user.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 按天回滚 daily -->
|
|
||||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
<!-- 系统模块日志级别控制 -->
|
||||||
<logger name="com.ruoyi" level="info" />
|
<logger name="com.ruoyi" level="info" />
|
||||||
<!-- Spring日志级别控制 -->
|
<!-- Spring日志级别控制 -->
|
||||||
@ -107,8 +93,4 @@
|
|||||||
<appender-ref ref="file_console" />
|
<appender-ref ref="file_console" />
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
<!--系统用户操作日志-->
|
|
||||||
<logger name="sys-user" level="info">
|
|
||||||
<appender-ref ref="sys-user"/>
|
|
||||||
</logger>
|
|
||||||
</configuration>
|
</configuration>
|
@ -22,5 +22,3 @@ outagedetection=true
|
|||||||
outagedetectioninterval=2
|
outagedetectioninterval=2
|
||||||
# 是否过滤 Log
|
# 是否过滤 Log
|
||||||
filter=true
|
filter=true
|
||||||
# 过滤 Log 时所排除的表名列表,以逗号分隔
|
|
||||||
exclude=QRTZ_
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.1.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
<!-- 自定义验证注解 -->
|
<!-- 自定义验证注解 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--常用工具类 -->
|
<!--常用工具类 -->
|
||||||
@ -70,22 +70,16 @@
|
|||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--Token生成与解析-->
|
<!-- Token生成与解析-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt</artifactId>
|
<artifactId>jjwt</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- redis 缓存操作 -->
|
<!-- jdk11 缺失依赖 jaxb-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>jaxb-impl</artifactId>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- pool 对象池 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-pool2</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- servlet包 -->
|
<!-- servlet包 -->
|
||||||
@ -111,16 +105,6 @@
|
|||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-okhttp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
@ -131,6 +115,11 @@
|
|||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
@ -147,22 +136,21 @@
|
|||||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- dynamic-datasource 多数据源-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- sql性能分析插件 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>p6spy</groupId>
|
|
||||||
<artifactId>p6spy</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>tlog-spring-boot-configuration</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>tlog-webroot</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package com.ruoyi.common.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据权限过滤注解
|
* 数据权限过滤注解
|
||||||
@ -14,20 +10,19 @@ import java.lang.annotation.Target;
|
|||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface DataScope
|
public @interface DataScope {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 部门表的别名
|
* 部门表的别名
|
||||||
*/
|
*/
|
||||||
public String deptAlias() default "";
|
String deptAlias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户表的别名
|
* 用户表的别名
|
||||||
*/
|
*/
|
||||||
public String userAlias() default "";
|
String userAlias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否过滤用户权限
|
* 是否过滤用户权限
|
||||||
*/
|
*/
|
||||||
public boolean isUser() default false;
|
boolean isUser() default false;
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,23 @@
|
|||||||
package com.ruoyi.common.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import com.ruoyi.common.enums.DataSourceType;
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义多数据源切换注解
|
* 自定义多数据源切换注解
|
||||||
*
|
* <p>
|
||||||
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
@Inherited
|
@Inherited
|
||||||
public @interface DataSource
|
public @interface DataSource {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 切换数据源名称
|
* 切换数据源名称
|
||||||
*/
|
*/
|
||||||
public DataSourceType value() default DataSourceType.MASTER;
|
DataSourceType value() default DataSourceType.MASTER;
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
package com.ruoyi.common.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.OperatorType;
|
import com.ruoyi.common.enums.OperatorType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义操作日志记录注解
|
* 自定义操作日志记录注解
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface Log
|
public @interface Log {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 模块
|
* 模块
|
||||||
*/
|
*/
|
||||||
public String title() default "";
|
String title() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能
|
* 功能
|
||||||
*/
|
*/
|
||||||
public BusinessType businessType() default BusinessType.OTHER;
|
BusinessType businessType() default BusinessType.OTHER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作人类别
|
* 操作人类别
|
||||||
*/
|
*/
|
||||||
public OperatorType operatorType() default OperatorType.MANAGE;
|
OperatorType operatorType() default OperatorType.MANAGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否保存请求的参数
|
* 是否保存请求的参数
|
||||||
*/
|
*/
|
||||||
public boolean isSaveRequestData() default true;
|
boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存响应的参数
|
||||||
|
*/
|
||||||
|
boolean isSaveResponseData() default true;
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,36 @@
|
|||||||
package com.ruoyi.common.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.enums.LimitType;
|
import com.ruoyi.common.enums.LimitType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流注解
|
* 限流注解
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface RateLimiter
|
public @interface RateLimiter {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 限流key
|
* 限流key
|
||||||
*/
|
*/
|
||||||
public String key() default Constants.RATE_LIMIT_KEY;
|
String key() default Constants.RATE_LIMIT_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流时间,单位秒
|
* 限流时间,单位秒
|
||||||
*/
|
*/
|
||||||
public int time() default 60;
|
int time() default 60;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流次数
|
* 限流次数
|
||||||
*/
|
*/
|
||||||
public int count() default 100;
|
int count() default 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流类型
|
* 限流类型
|
||||||
*/
|
*/
|
||||||
public LimitType limitType() default LimitType.DEFAULT;
|
LimitType limitType() default LimitType.DEFAULT;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
package com.ruoyi.common.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,10 +15,15 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public @interface RepeatSubmit {
|
public @interface RepeatSubmit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认使用全局配置
|
* 间隔时间(ms),小于此时间视为重复提交
|
||||||
*/
|
*/
|
||||||
int intervalTime() default 0;
|
int interval() default 5000;
|
||||||
|
|
||||||
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
|
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
String message() default "不允许重复提交,请稍候再试";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.ruoyi.common.config;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -10,34 +9,47 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* 读取项目相关配置
|
* 读取项目相关配置
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "ruoyi")
|
@ConfigurationProperties(prefix = "ruoyi")
|
||||||
public class RuoYiConfig
|
public class RuoYiConfig {
|
||||||
{
|
|
||||||
/** 项目名称 */
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 版本 */
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
/** 版权年份 */
|
/**
|
||||||
|
* 版权年份
|
||||||
|
*/
|
||||||
private String copyrightYear;
|
private String copyrightYear;
|
||||||
|
|
||||||
/** 实例演示开关 */
|
/**
|
||||||
|
* 实例演示开关
|
||||||
|
*/
|
||||||
private boolean demoEnabled;
|
private boolean demoEnabled;
|
||||||
|
|
||||||
/** 获取地址开关 */
|
/**
|
||||||
|
* 缓存懒加载
|
||||||
|
*/
|
||||||
|
private boolean cacheLazy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取地址开关
|
||||||
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private static boolean addressEnabled;
|
private static boolean addressEnabled;
|
||||||
|
|
||||||
public void setAddressEnabled(boolean addressEnabled)
|
public void setAddressEnabled(boolean addressEnabled) {
|
||||||
{
|
|
||||||
RuoYiConfig.addressEnabled = addressEnabled;
|
RuoYiConfig.addressEnabled = addressEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ import io.jsonwebtoken.Claims;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Constants
|
public class Constants {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* UTF-8 字符集
|
* UTF-8 字符集
|
||||||
*/
|
*/
|
||||||
@ -134,13 +133,4 @@ public class Constants
|
|||||||
*/
|
*/
|
||||||
public static final String SYS_DICT_KEY = "sys_dict:";
|
public static final String SYS_DICT_KEY = "sys_dict:";
|
||||||
|
|
||||||
/**
|
|
||||||
* RMI 远程方法调用
|
|
||||||
*/
|
|
||||||
public static final String LOOKUP_RMI = "rmi://";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LDAP 远程方法调用
|
|
||||||
*/
|
|
||||||
public static final String LOOKUP_LDAP = "ldap://";
|
|
||||||
}
|
}
|
||||||
|
@ -5,110 +5,184 @@ package com.ruoyi.common.constant;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class GenConstants
|
public class GenConstants {
|
||||||
{
|
/**
|
||||||
/** 单表(增删改查) */
|
* 单表(增删改查)
|
||||||
|
*/
|
||||||
public static final String TPL_CRUD = "crud";
|
public static final String TPL_CRUD = "crud";
|
||||||
|
|
||||||
/** 树表(增删改查) */
|
/**
|
||||||
|
* 树表(增删改查)
|
||||||
|
*/
|
||||||
public static final String TPL_TREE = "tree";
|
public static final String TPL_TREE = "tree";
|
||||||
|
|
||||||
/** 主子表(增删改查) */
|
/**
|
||||||
|
* 主子表(增删改查)
|
||||||
|
*/
|
||||||
public static final String TPL_SUB = "sub";
|
public static final String TPL_SUB = "sub";
|
||||||
|
|
||||||
/** 树编码字段 */
|
/**
|
||||||
|
* 树编码字段
|
||||||
|
*/
|
||||||
public static final String TREE_CODE = "treeCode";
|
public static final String TREE_CODE = "treeCode";
|
||||||
|
|
||||||
/** 树父编码字段 */
|
/**
|
||||||
|
* 树父编码字段
|
||||||
|
*/
|
||||||
public static final String TREE_PARENT_CODE = "treeParentCode";
|
public static final String TREE_PARENT_CODE = "treeParentCode";
|
||||||
|
|
||||||
/** 树名称字段 */
|
/**
|
||||||
|
* 树名称字段
|
||||||
|
*/
|
||||||
public static final String TREE_NAME = "treeName";
|
public static final String TREE_NAME = "treeName";
|
||||||
|
|
||||||
/** 上级菜单ID字段 */
|
/**
|
||||||
|
* 上级菜单ID字段
|
||||||
|
*/
|
||||||
public static final String PARENT_MENU_ID = "parentMenuId";
|
public static final String PARENT_MENU_ID = "parentMenuId";
|
||||||
|
|
||||||
/** 上级菜单名称字段 */
|
/**
|
||||||
|
* 上级菜单名称字段
|
||||||
|
*/
|
||||||
public static final String PARENT_MENU_NAME = "parentMenuName";
|
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||||
|
|
||||||
/** 数据库字符串类型 */
|
/**
|
||||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
* 数据库字符串类型
|
||||||
|
*/
|
||||||
|
public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
|
||||||
|
|
||||||
/** 数据库文本类型 */
|
/**
|
||||||
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
|
* 数据库文本类型
|
||||||
|
*/
|
||||||
|
public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
|
||||||
|
|
||||||
/** 数据库时间类型 */
|
/**
|
||||||
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
* 数据库时间类型
|
||||||
|
*/
|
||||||
|
public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
|
||||||
|
|
||||||
/** 数据库数字类型 */
|
/**
|
||||||
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
* 数据库数字类型
|
||||||
"bit", "bigint", "float", "double", "decimal" };
|
*/
|
||||||
|
public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
|
||||||
|
"bit", "bigint", "float", "double", "decimal"};
|
||||||
|
|
||||||
/** 页面不需要编辑字段 */
|
/**
|
||||||
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
|
* BO对象 不需要添加字段
|
||||||
|
*/
|
||||||
|
public static final String[] COLUMNNAME_NOT_ADD = {"create_by", "create_time", "del_flag", "update_by",
|
||||||
|
"update_time", "version"};
|
||||||
|
|
||||||
/** 页面不需要显示的列表字段 */
|
/**
|
||||||
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
|
* BO对象 不需要编辑字段
|
||||||
"update_time" };
|
*/
|
||||||
|
public static final String[] COLUMNNAME_NOT_EDIT = {"create_by", "create_time", "del_flag", "update_by",
|
||||||
|
"update_time", "version"};
|
||||||
|
|
||||||
/** 页面不需要查询字段 */
|
/**
|
||||||
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
|
* VO对象 不需要返回字段
|
||||||
"update_time", "remark" };
|
*/
|
||||||
|
public static final String[] COLUMNNAME_NOT_LIST = {"create_by", "create_time", "del_flag", "update_by",
|
||||||
|
"update_time", "version"};
|
||||||
|
|
||||||
/** Entity基类字段 */
|
/**
|
||||||
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
|
* BO对象 不需要查询字段
|
||||||
|
*/
|
||||||
|
public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
|
||||||
|
"update_time", "remark", "version"};
|
||||||
|
|
||||||
/** Tree基类字段 */
|
/**
|
||||||
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
|
* Entity基类字段
|
||||||
|
*/
|
||||||
|
public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime"};
|
||||||
|
|
||||||
/** 文本框 */
|
/**
|
||||||
|
* Tree基类字段
|
||||||
|
*/
|
||||||
|
public static final String[] TREE_ENTITY = {"parentName", "parentId", "children"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本框
|
||||||
|
*/
|
||||||
public static final String HTML_INPUT = "input";
|
public static final String HTML_INPUT = "input";
|
||||||
|
|
||||||
/** 文本域 */
|
/**
|
||||||
|
* 文本域
|
||||||
|
*/
|
||||||
public static final String HTML_TEXTAREA = "textarea";
|
public static final String HTML_TEXTAREA = "textarea";
|
||||||
|
|
||||||
/** 下拉框 */
|
/**
|
||||||
|
* 下拉框
|
||||||
|
*/
|
||||||
public static final String HTML_SELECT = "select";
|
public static final String HTML_SELECT = "select";
|
||||||
|
|
||||||
/** 单选框 */
|
/**
|
||||||
|
* 单选框
|
||||||
|
*/
|
||||||
public static final String HTML_RADIO = "radio";
|
public static final String HTML_RADIO = "radio";
|
||||||
|
|
||||||
/** 复选框 */
|
/**
|
||||||
|
* 复选框
|
||||||
|
*/
|
||||||
public static final String HTML_CHECKBOX = "checkbox";
|
public static final String HTML_CHECKBOX = "checkbox";
|
||||||
|
|
||||||
/** 日期控件 */
|
/**
|
||||||
|
* 日期控件
|
||||||
|
*/
|
||||||
public static final String HTML_DATETIME = "datetime";
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
/** 图片上传控件 */
|
/**
|
||||||
|
* 图片上传控件
|
||||||
|
*/
|
||||||
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||||
|
|
||||||
/** 文件上传控件 */
|
/**
|
||||||
|
* 文件上传控件
|
||||||
|
*/
|
||||||
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||||
|
|
||||||
/** 富文本控件 */
|
/**
|
||||||
|
* 富文本控件
|
||||||
|
*/
|
||||||
public static final String HTML_EDITOR = "editor";
|
public static final String HTML_EDITOR = "editor";
|
||||||
|
|
||||||
/** 字符串类型 */
|
/**
|
||||||
|
* 字符串类型
|
||||||
|
*/
|
||||||
public static final String TYPE_STRING = "String";
|
public static final String TYPE_STRING = "String";
|
||||||
|
|
||||||
/** 整型 */
|
/**
|
||||||
|
* 整型
|
||||||
|
*/
|
||||||
public static final String TYPE_INTEGER = "Integer";
|
public static final String TYPE_INTEGER = "Integer";
|
||||||
|
|
||||||
/** 长整型 */
|
/**
|
||||||
|
* 长整型
|
||||||
|
*/
|
||||||
public static final String TYPE_LONG = "Long";
|
public static final String TYPE_LONG = "Long";
|
||||||
|
|
||||||
/** 浮点型 */
|
/**
|
||||||
|
* 浮点型
|
||||||
|
*/
|
||||||
public static final String TYPE_DOUBLE = "Double";
|
public static final String TYPE_DOUBLE = "Double";
|
||||||
|
|
||||||
/** 高精度计算类型 */
|
/**
|
||||||
|
* 高精度计算类型
|
||||||
|
*/
|
||||||
public static final String TYPE_BIGDECIMAL = "BigDecimal";
|
public static final String TYPE_BIGDECIMAL = "BigDecimal";
|
||||||
|
|
||||||
/** 时间类型 */
|
/**
|
||||||
|
* 时间类型
|
||||||
|
*/
|
||||||
public static final String TYPE_DATE = "Date";
|
public static final String TYPE_DATE = "Date";
|
||||||
|
|
||||||
/** 模糊查询 */
|
/**
|
||||||
|
* 模糊查询
|
||||||
|
*/
|
||||||
public static final String QUERY_LIKE = "LIKE";
|
public static final String QUERY_LIKE = "LIKE";
|
||||||
|
|
||||||
/** 需要 */
|
/**
|
||||||
|
* 需要
|
||||||
|
*/
|
||||||
public static final String REQUIRE = "1";
|
public static final String REQUIRE = "1";
|
||||||
}
|
}
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
package com.ruoyi.common.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 任务调度通用常量
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class ScheduleConstants
|
|
||||||
{
|
|
||||||
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
|
||||||
|
|
||||||
/** 执行目标key */
|
|
||||||
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
|
||||||
|
|
||||||
/** 默认 */
|
|
||||||
public static final String MISFIRE_DEFAULT = "0";
|
|
||||||
|
|
||||||
/** 立即触发执行 */
|
|
||||||
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
|
||||||
|
|
||||||
/** 触发一次执行 */
|
|
||||||
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
|
||||||
|
|
||||||
/** 不触发立即执行 */
|
|
||||||
public static final String MISFIRE_DO_NOTHING = "3";
|
|
||||||
|
|
||||||
public enum Status
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 正常
|
|
||||||
*/
|
|
||||||
NORMAL("0"),
|
|
||||||
/**
|
|
||||||
* 暂停
|
|
||||||
*/
|
|
||||||
PAUSE("1");
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
private Status(String value)
|
|
||||||
{
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue()
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,62 +5,96 @@ package com.ruoyi.common.constant;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserConstants
|
public class UserConstants {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 平台内系统用户的唯一标志
|
* 平台内系统用户的唯一标志
|
||||||
*/
|
*/
|
||||||
public static final String SYS_USER = "SYS_USER";
|
public static final String SYS_USER = "SYS_USER";
|
||||||
|
|
||||||
/** 正常状态 */
|
/**
|
||||||
|
* 正常状态
|
||||||
|
*/
|
||||||
public static final String NORMAL = "0";
|
public static final String NORMAL = "0";
|
||||||
|
|
||||||
/** 异常状态 */
|
/**
|
||||||
|
* 异常状态
|
||||||
|
*/
|
||||||
public static final String EXCEPTION = "1";
|
public static final String EXCEPTION = "1";
|
||||||
|
|
||||||
/** 用户封禁状态 */
|
/**
|
||||||
|
* 用户封禁状态
|
||||||
|
*/
|
||||||
public static final String USER_DISABLE = "1";
|
public static final String USER_DISABLE = "1";
|
||||||
|
|
||||||
/** 角色封禁状态 */
|
/**
|
||||||
|
* 角色封禁状态
|
||||||
|
*/
|
||||||
public static final String ROLE_DISABLE = "1";
|
public static final String ROLE_DISABLE = "1";
|
||||||
|
|
||||||
/** 部门正常状态 */
|
/**
|
||||||
|
* 部门正常状态
|
||||||
|
*/
|
||||||
public static final String DEPT_NORMAL = "0";
|
public static final String DEPT_NORMAL = "0";
|
||||||
|
|
||||||
/** 部门停用状态 */
|
/**
|
||||||
|
* 部门停用状态
|
||||||
|
*/
|
||||||
public static final String DEPT_DISABLE = "1";
|
public static final String DEPT_DISABLE = "1";
|
||||||
|
|
||||||
/** 字典正常状态 */
|
/**
|
||||||
|
* 字典正常状态
|
||||||
|
*/
|
||||||
public static final String DICT_NORMAL = "0";
|
public static final String DICT_NORMAL = "0";
|
||||||
|
|
||||||
/** 是否为系统默认(是) */
|
/**
|
||||||
|
* 是否为系统默认(是)
|
||||||
|
*/
|
||||||
public static final String YES = "Y";
|
public static final String YES = "Y";
|
||||||
|
|
||||||
/** 是否菜单外链(是) */
|
/**
|
||||||
|
* 是否菜单外链(是)
|
||||||
|
*/
|
||||||
public static final String YES_FRAME = "0";
|
public static final String YES_FRAME = "0";
|
||||||
|
|
||||||
/** 是否菜单外链(否) */
|
/**
|
||||||
|
* 是否菜单外链(否)
|
||||||
|
*/
|
||||||
public static final String NO_FRAME = "1";
|
public static final String NO_FRAME = "1";
|
||||||
|
|
||||||
/** 菜单类型(目录) */
|
/**
|
||||||
|
* 菜单类型(目录)
|
||||||
|
*/
|
||||||
public static final String TYPE_DIR = "M";
|
public static final String TYPE_DIR = "M";
|
||||||
|
|
||||||
/** 菜单类型(菜单) */
|
/**
|
||||||
|
* 菜单类型(菜单)
|
||||||
|
*/
|
||||||
public static final String TYPE_MENU = "C";
|
public static final String TYPE_MENU = "C";
|
||||||
|
|
||||||
/** 菜单类型(按钮) */
|
/**
|
||||||
|
* 菜单类型(按钮)
|
||||||
|
*/
|
||||||
public static final String TYPE_BUTTON = "F";
|
public static final String TYPE_BUTTON = "F";
|
||||||
|
|
||||||
/** Layout组件标识 */
|
/**
|
||||||
|
* Layout组件标识
|
||||||
|
*/
|
||||||
public final static String LAYOUT = "Layout";
|
public final static String LAYOUT = "Layout";
|
||||||
|
|
||||||
/** ParentView组件标识 */
|
/**
|
||||||
|
* ParentView组件标识
|
||||||
|
*/
|
||||||
public final static String PARENT_VIEW = "ParentView";
|
public final static String PARENT_VIEW = "ParentView";
|
||||||
|
|
||||||
/** InnerLink组件标识 */
|
/**
|
||||||
|
* InnerLink组件标识
|
||||||
|
*/
|
||||||
public final static String INNER_LINK = "InnerLink";
|
public final static String INNER_LINK = "InnerLink";
|
||||||
|
|
||||||
/** 校验返回结果码 */
|
/**
|
||||||
|
* 校验返回结果码
|
||||||
|
*/
|
||||||
public final static String UNIQUE = "0";
|
public final static String UNIQUE = "0";
|
||||||
public final static String NOT_UNIQUE = "1";
|
public final static String NOT_UNIQUE = "1";
|
||||||
|
|
||||||
|
@ -8,8 +8,10 @@ import com.alibaba.excel.metadata.CellData;
|
|||||||
import com.alibaba.excel.metadata.GlobalConfiguration;
|
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.core.service.DictService;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -41,7 +43,7 @@ public class ExcelDictConvert implements Converter<Object> {
|
|||||||
if (StringUtils.isBlank(type)) {
|
if (StringUtils.isBlank(type)) {
|
||||||
value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator());
|
value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator());
|
||||||
} else {
|
} else {
|
||||||
value = ExcelUtil.reverseDictByExp(label, type, anno.separator());
|
value = SpringUtils.getBean(DictService.class).getDictValue(type, label, anno.separator());
|
||||||
}
|
}
|
||||||
return Convert.convert(contentProperty.getField().getType(), value);
|
return Convert.convert(contentProperty.getField().getType(), value);
|
||||||
}
|
}
|
||||||
@ -58,7 +60,7 @@ public class ExcelDictConvert implements Converter<Object> {
|
|||||||
if (StringUtils.isBlank(type)) {
|
if (StringUtils.isBlank(type)) {
|
||||||
label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator());
|
label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator());
|
||||||
} else {
|
} else {
|
||||||
label = ExcelUtil.convertDictByExp(value, type, anno.separator());
|
label = SpringUtils.getBean(DictService.class).getDictLabel(type, value, anno.separator());
|
||||||
}
|
}
|
||||||
return new CellData<>(label);
|
return new CellData<>(label);
|
||||||
}
|
}
|
||||||
|
@ -4,47 +4,39 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class BaseController
|
public class BaseController {
|
||||||
{
|
|
||||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功
|
* 返回成功
|
||||||
*/
|
*/
|
||||||
public AjaxResult<Void> success()
|
public AjaxResult<Void> success() {
|
||||||
{
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult<Void> error()
|
public AjaxResult<Void> error() {
|
||||||
{
|
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功消息
|
* 返回成功消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult<Void> success(String message)
|
public AjaxResult<Void> success(String message) {
|
||||||
{
|
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult<Void> error(String message)
|
public AjaxResult<Void> error(String message) {
|
||||||
{
|
|
||||||
return AjaxResult.error(message);
|
return AjaxResult.error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +46,7 @@ public class BaseController
|
|||||||
* @param rows 影响行数
|
* @param rows 影响行数
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
protected AjaxResult<Void> toAjax(int rows)
|
protected AjaxResult<Void> toAjax(int rows) {
|
||||||
{
|
|
||||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,48 +56,42 @@ public class BaseController
|
|||||||
* @param result 结果
|
* @param result 结果
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
protected AjaxResult<Void> toAjax(boolean result)
|
protected AjaxResult<Void> toAjax(boolean result) {
|
||||||
{
|
|
||||||
return result ? success() : error();
|
return result ? success() : error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面跳转
|
* 页面跳转
|
||||||
*/
|
*/
|
||||||
public String redirect(String url)
|
public String redirect(String url) {
|
||||||
{
|
|
||||||
return StringUtils.format("redirect:{}", url);
|
return StringUtils.format("redirect:{}", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户缓存信息
|
* 获取用户缓存信息
|
||||||
*/
|
*/
|
||||||
public LoginUser getLoginUser()
|
public LoginUser getLoginUser() {
|
||||||
{
|
|
||||||
return SecurityUtils.getLoginUser();
|
return SecurityUtils.getLoginUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取登录用户id
|
* 获取登录用户id
|
||||||
*/
|
*/
|
||||||
public Long getUserId()
|
public Long getUserId() {
|
||||||
{
|
|
||||||
return getLoginUser().getUserId();
|
return getLoginUser().getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取登录部门id
|
* 获取登录部门id
|
||||||
*/
|
*/
|
||||||
public Long getDeptId()
|
public Long getDeptId() {
|
||||||
{
|
|
||||||
return getLoginUser().getDeptId();
|
return getLoginUser().getDeptId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取登录用户名
|
* 获取登录用户名
|
||||||
*/
|
*/
|
||||||
public String getUsername()
|
public String getUsername() {
|
||||||
{
|
|
||||||
return getLoginUser().getUsername();
|
return getLoginUser().getUsername();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.common.core.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -13,11 +14,10 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Entity基类
|
* Entity基类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class BaseEntity implements Serializable {
|
public class BaseEntity implements Serializable {
|
||||||
|
|
||||||
@ -27,42 +27,42 @@ public class BaseEntity implements Serializable {
|
|||||||
* 搜索值
|
* 搜索值
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "搜索值")
|
@ApiModelProperty(value = "搜索值")
|
||||||
|
@TableField(exist = false)
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建者
|
* 创建者
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建者")
|
@ApiModelProperty(value = "创建者")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新者
|
* 更新者
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "更新者")
|
@ApiModelProperty(value = "更新者")
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "更新时间")
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求参数
|
* 请求参数
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "请求参数")
|
@ApiModelProperty(value = "请求参数")
|
||||||
|
@TableField(exist = false)
|
||||||
private Map<String, Object> params = new HashMap<>();
|
private Map<String, Object> params = new HashMap<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.ruoyi.common.core.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -12,12 +12,11 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Tree基类
|
* Tree基类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class TreeEntity extends BaseEntity {
|
public class TreeEntity extends BaseEntity {
|
||||||
|
|
||||||
@ -26,6 +25,7 @@ public class TreeEntity extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 父菜单名称
|
* 父菜单名称
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "父菜单名称")
|
@ApiModelProperty(value = "父菜单名称")
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
@ -35,21 +35,10 @@ public class TreeEntity extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "父菜单ID")
|
@ApiModelProperty(value = "父菜单ID")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示顺序
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "显示顺序")
|
|
||||||
private Integer orderNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 祖级列表
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "祖级列表")
|
|
||||||
private String ancestors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子部门
|
* 子部门
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "子部门")
|
@ApiModelProperty(value = "子部门")
|
||||||
private List<?> children = new ArrayList<>();
|
private List<?> children = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
package com.ruoyi.common.core.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Treeselect树结构实体类
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class TreeSelect implements Serializable
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 节点ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 节点名称 */
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
/** 子节点 */
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
|
||||||
private List<TreeSelect> children;
|
|
||||||
|
|
||||||
public TreeSelect(SysDept dept)
|
|
||||||
{
|
|
||||||
this.id = dept.getDeptId();
|
|
||||||
this.label = dept.getDeptName();
|
|
||||||
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
public TreeSelect(SysMenu menu)
|
|
||||||
{
|
|
||||||
this.id = menu.getMenuId();
|
|
||||||
this.label = menu.getMenuName();
|
|
||||||
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.ruoyi.common.core.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用操作日志实体
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OperLogDTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志主键
|
||||||
|
*/
|
||||||
|
private Long operId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作模块
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务类型(0其它 1新增 2修改 3删除)
|
||||||
|
*/
|
||||||
|
private Integer businessType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务类型数组
|
||||||
|
*/
|
||||||
|
private Integer[] businessTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求方法
|
||||||
|
*/
|
||||||
|
private String method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求方式
|
||||||
|
*/
|
||||||
|
private String requestMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类别(0其它 1后台用户 2手机端用户)
|
||||||
|
*/
|
||||||
|
private Integer operatorType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人员
|
||||||
|
*/
|
||||||
|
private String operName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求url
|
||||||
|
*/
|
||||||
|
private String operUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作地址
|
||||||
|
*/
|
||||||
|
private String operIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作地点
|
||||||
|
*/
|
||||||
|
private String operLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数
|
||||||
|
*/
|
||||||
|
private String operParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回参数
|
||||||
|
*/
|
||||||
|
private String jsonResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作状态(0正常 1异常)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误消息
|
||||||
|
*/
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间
|
||||||
|
*/
|
||||||
|
private Date operTime;
|
||||||
|
|
||||||
|
}
|
@ -1,48 +1,44 @@
|
|||||||
package com.ruoyi.common.core.domain.entity;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表 sys_dept
|
* 部门表 sys_dept
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_dept")
|
@TableName("sys_dept")
|
||||||
public class SysDept implements Serializable {
|
@ApiModel("部门业务对象")
|
||||||
|
public class SysDept extends TreeEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "dept_id", type = IdType.AUTO)
|
@ApiModelProperty(value = "部门id")
|
||||||
|
@TableId(value = "dept_id")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父部门ID
|
|
||||||
*/
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 祖级列表
|
|
||||||
*/
|
|
||||||
private String ancestors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门名称
|
* 部门名称
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "部门名称")
|
||||||
@NotBlank(message = "部门名称不能为空")
|
@NotBlank(message = "部门名称不能为空")
|
||||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
@ -50,23 +46,27 @@ public class SysDept implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 显示顺序
|
* 显示顺序
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "显示顺序")
|
||||||
@NotBlank(message = "显示顺序不能为空")
|
@NotBlank(message = "显示顺序不能为空")
|
||||||
private String orderNum;
|
private String orderNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 负责人
|
* 负责人
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "负责人")
|
||||||
private String leader;
|
private String leader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联系电话
|
* 联系电话
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "联系电话")
|
||||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "邮箱")
|
||||||
@Email(message = "邮箱格式不正确")
|
@Email(message = "邮箱格式不正确")
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
private String email;
|
private String email;
|
||||||
@ -74,54 +74,20 @@ public class SysDept implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 部门状态:0正常,1停用
|
* 部门状态:0正常,1停用
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "部门状态:0正常,1停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标志(0代表存在 2代表删除)
|
* 删除标志(0代表存在 2代表删除)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父部门名称
|
* 祖级列表
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@ApiModelProperty(value = "祖级列表")
|
||||||
private String parentName;
|
private String ancestors;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 子部门
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Map<String, Object> params = new HashMap<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,51 +2,54 @@ package com.ruoyi.common.core.domain.entity;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典数据表 sys_dict_data
|
* 字典数据表 sys_dict_data
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_dict_data")
|
@TableName("sys_dict_data")
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class SysDictData implements Serializable {
|
@ApiModel("字典数据业务对象")
|
||||||
private static final long serialVersionUID = 1L;
|
public class SysDictData extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典编码
|
* 字典编码
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典编码")
|
||||||
@ExcelProperty(value = "字典编码")
|
@ExcelProperty(value = "字典编码")
|
||||||
@TableId(value = "dict_code", type = IdType.AUTO)
|
@TableId(value = "dict_code")
|
||||||
private Long dictCode;
|
private Long dictCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典排序
|
* 字典排序
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典排序")
|
||||||
@ExcelProperty(value = "字典排序")
|
@ExcelProperty(value = "字典排序")
|
||||||
private Long dictSort;
|
private Long dictSort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典标签
|
* 字典标签
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典标签")
|
||||||
@ExcelProperty(value = "字典标签")
|
@ExcelProperty(value = "字典标签")
|
||||||
@NotBlank(message = "字典标签不能为空")
|
@NotBlank(message = "字典标签不能为空")
|
||||||
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
|
||||||
@ -55,6 +58,7 @@ public class SysDictData implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 字典键值
|
* 字典键值
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典键值")
|
||||||
@ExcelProperty(value = "字典键值")
|
@ExcelProperty(value = "字典键值")
|
||||||
@NotBlank(message = "字典键值不能为空")
|
@NotBlank(message = "字典键值不能为空")
|
||||||
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
|
||||||
@ -63,6 +67,7 @@ public class SysDictData implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 字典类型
|
* 字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典类型")
|
||||||
@ExcelProperty(value = "字典类型")
|
@ExcelProperty(value = "字典类型")
|
||||||
@NotBlank(message = "字典类型不能为空")
|
@NotBlank(message = "字典类型不能为空")
|
||||||
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
|
||||||
@ -71,17 +76,20 @@ public class SysDictData implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 样式属性(其他样式扩展)
|
* 样式属性(其他样式扩展)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "样式属性(其他样式扩展)")
|
||||||
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
||||||
private String cssClass;
|
private String cssClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格字典样式
|
* 表格字典样式
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "表格字典样式")
|
||||||
private String listClass;
|
private String listClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否默认(Y是 N否)
|
* 是否默认(Y是 N否)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "是否默认(Y是 N否)")
|
||||||
@ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(dictType = "sys_yes_no")
|
@ExcelDictFormat(dictType = "sys_yes_no")
|
||||||
private String isDefault;
|
private String isDefault;
|
||||||
@ -89,47 +97,19 @@ public class SysDictData implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "状态(0正常 1停用)")
|
||||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(dictType = "sys_common_status")
|
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Map<String, Object> params = new HashMap<>();
|
|
||||||
|
|
||||||
public boolean getDefault() {
|
public boolean getDefault() {
|
||||||
return UserConstants.YES.equals(this.isDefault) ? true : false;
|
return UserConstants.YES.equals(this.isDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,44 +2,46 @@ package com.ruoyi.common.core.domain.entity;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典类型表 sys_dict_type
|
* 字典类型表 sys_dict_type
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_dict_type")
|
@TableName("sys_dict_type")
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class SysDictType implements Serializable {
|
@ApiModel("字典类型业务对象")
|
||||||
private static final long serialVersionUID = 1L;
|
public class SysDictType extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典主键
|
* 字典主键
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典主键")
|
||||||
@ExcelProperty(value = "字典主键")
|
@ExcelProperty(value = "字典主键")
|
||||||
@TableId(value = "dict_id", type = IdType.AUTO)
|
@TableId(value = "dict_id")
|
||||||
private Long dictId;
|
private Long dictId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典名称
|
* 字典名称
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典名称")
|
||||||
@ExcelProperty(value = "字典名称")
|
@ExcelProperty(value = "字典名称")
|
||||||
@NotBlank(message = "字典名称不能为空")
|
@NotBlank(message = "字典名称不能为空")
|
||||||
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
|
||||||
@ -48,6 +50,7 @@ public class SysDictType implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 字典类型
|
* 字典类型
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "字典类型")
|
||||||
@ExcelProperty(value = "字典类型")
|
@ExcelProperty(value = "字典类型")
|
||||||
@NotBlank(message = "字典类型不能为空")
|
@NotBlank(message = "字典类型不能为空")
|
||||||
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||||
@ -56,43 +59,15 @@ public class SysDictType implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "状态(0正常 1停用)")
|
||||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(dictType = "sys_common_status")
|
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Map<String, Object> params = new HashMap<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,149 +1,120 @@
|
|||||||
package com.ruoyi.common.core.domain.entity;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单权限表 sys_menu
|
* 菜单权限表 sys_menu
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_menu")
|
@TableName("sys_menu")
|
||||||
public class SysMenu implements Serializable {
|
@ApiModel("菜单权限业务对象")
|
||||||
private static final long serialVersionUID = 1L;
|
public class SysMenu extends TreeEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单ID
|
* 菜单ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "menu_id", type = IdType.AUTO)
|
@ApiModelProperty(value = "菜单ID")
|
||||||
|
@TableId(value = "menu_id")
|
||||||
private Long menuId;
|
private Long menuId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单名称
|
* 菜单名称
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "菜单名称")
|
||||||
@NotBlank(message = "菜单名称不能为空")
|
@NotBlank(message = "菜单名称不能为空")
|
||||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||||
private String menuName;
|
private String menuName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父菜单名称
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String parentName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父菜单ID
|
|
||||||
*/
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示顺序
|
* 显示顺序
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "显示顺序")
|
||||||
@NotBlank(message = "显示顺序不能为空")
|
@NotBlank(message = "显示顺序不能为空")
|
||||||
private String orderNum;
|
private String orderNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由地址
|
* 路由地址
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "路由地址")
|
||||||
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件路径
|
* 组件路径
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "组件路径")
|
||||||
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
||||||
private String component;
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由参数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "路由参数")
|
||||||
|
private String query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为外链(0是 1否)
|
* 是否为外链(0是 1否)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "是否为外链(0是 1否)")
|
||||||
private String isFrame;
|
private String isFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否缓存(0缓存 1不缓存)
|
* 是否缓存(0缓存 1不缓存)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "是否缓存(0缓存 1不缓存)")
|
||||||
private String isCache;
|
private String isCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型(M目录 C菜单 F按钮)
|
* 类型(M目录 C菜单 F按钮)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "类型(M目录 C菜单 F按钮)")
|
||||||
@NotBlank(message = "菜单类型不能为空")
|
@NotBlank(message = "菜单类型不能为空")
|
||||||
private String menuType;
|
private String menuType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示状态(0显示 1隐藏)
|
* 显示状态(0显示 1隐藏)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "显示状态(0显示 1隐藏)")
|
||||||
private String visible;
|
private String visible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单状态(0显示 1隐藏)
|
* 菜单状态(0显示 1隐藏)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "菜单状态(0显示 1隐藏)")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限字符串
|
* 权限字符串
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "权限字符串")
|
||||||
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
||||||
private String perms;
|
private String perms;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单图标
|
* 菜单图标
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "菜单图标")
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Map<String, Object> params = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 子菜单
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private List<SysMenu> children = new ArrayList<SysMenu>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,44 +2,48 @@ package com.ruoyi.common.core.domain.entity;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色表 sys_role
|
* 角色表 sys_role
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_role")
|
@TableName("sys_role")
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class SysRole implements Serializable {
|
public class SysRole extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色ID
|
* 角色ID
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色ID")
|
||||||
@ExcelProperty(value = "角色序号")
|
@ExcelProperty(value = "角色序号")
|
||||||
@TableId(value = "role_id", type = IdType.AUTO)
|
@TableId(value = "role_id")
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色名称
|
* 角色名称
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色名称")
|
||||||
@ExcelProperty(value = "角色名称")
|
@ExcelProperty(value = "角色名称")
|
||||||
@NotBlank(message = "角色名称不能为空")
|
@NotBlank(message = "角色名称不能为空")
|
||||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||||
@ -48,6 +52,7 @@ public class SysRole implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 角色权限
|
* 角色权限
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色权限")
|
||||||
@ExcelProperty(value = "角色权限")
|
@ExcelProperty(value = "角色权限")
|
||||||
@NotBlank(message = "权限字符不能为空")
|
@NotBlank(message = "权限字符不能为空")
|
||||||
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
||||||
@ -56,6 +61,7 @@ public class SysRole implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 角色排序
|
* 角色排序
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色排序")
|
||||||
@ExcelProperty(value = "角色排序")
|
@ExcelProperty(value = "角色排序")
|
||||||
@NotBlank(message = "显示顺序不能为空")
|
@NotBlank(message = "显示顺序不能为空")
|
||||||
private String roleSort;
|
private String roleSort;
|
||||||
@ -63,6 +69,7 @@ public class SysRole implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
|
* 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)")
|
||||||
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
@ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||||
private String dataScope;
|
private String dataScope;
|
||||||
@ -70,16 +77,19 @@ public class SysRole implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)
|
* 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)")
|
||||||
private boolean menuCheckStrictly;
|
private boolean menuCheckStrictly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )
|
* 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )")
|
||||||
private boolean deptCheckStrictly;
|
private boolean deptCheckStrictly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色状态(0正常 1停用)
|
* 角色状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色状态(0正常 1停用)")
|
||||||
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(dictType = "sys_common_status")
|
@ExcelDictFormat(dictType = "sys_common_status")
|
||||||
private String status;
|
private String status;
|
||||||
@ -87,59 +97,34 @@ public class SysRole implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 删除标志(0代表存在 2代表删除)
|
* 删除标志(0代表存在 2代表删除)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Map<String, Object> params = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户是否存在此角色标识 默认不存在
|
* 用户是否存在此角色标识 默认不存在
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户是否存在此角色标识 默认不存在")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private boolean flag = false;
|
private boolean flag = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单组
|
* 菜单组
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "菜单组")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long[] menuIds;
|
private Long[] menuIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门组(数据权限)
|
* 部门组(数据权限)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "部门组(数据权限)")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long[] deptIds;
|
private Long[] deptIds;
|
||||||
|
|
||||||
@ -147,6 +132,7 @@ public class SysRole implements Serializable {
|
|||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否管理员")
|
||||||
public boolean isAdmin() {
|
public boolean isAdmin() {
|
||||||
return isAdmin(this.roleId);
|
return isAdmin(this.roleId);
|
||||||
}
|
}
|
||||||
|
@ -3,46 +3,51 @@ package com.ruoyi.common.core.domain.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对象 sys_user
|
* 用户对象 sys_user
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("sys_user")
|
@TableName("sys_user")
|
||||||
public class SysUser implements Serializable {
|
@ApiModel("用户信息业务对象")
|
||||||
private static final long serialVersionUID = 1L;
|
public class SysUser extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "user_id", type = IdType.AUTO)
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
@TableId(value = "user_id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "部门ID")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号
|
* 用户账号
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户账号")
|
||||||
@NotBlank(message = "用户账号不能为空")
|
@NotBlank(message = "用户账号不能为空")
|
||||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||||
private String userName;
|
private String userName;
|
||||||
@ -50,12 +55,14 @@ public class SysUser implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 用户昵称
|
* 用户昵称
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户昵称")
|
||||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户邮箱
|
* 用户邮箱
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户邮箱")
|
||||||
@Email(message = "邮箱格式不正确")
|
@Email(message = "邮箱格式不正确")
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
private String email;
|
private String email;
|
||||||
@ -63,21 +70,25 @@ public class SysUser implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 手机号码
|
* 手机号码
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
private String phonenumber;
|
private String phonenumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户性别
|
* 用户性别
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户性别")
|
||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户头像
|
* 用户头像
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户头像")
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "密码")
|
||||||
@TableField(
|
@TableField(
|
||||||
insertStrategy = FieldStrategy.NOT_EMPTY,
|
insertStrategy = FieldStrategy.NOT_EMPTY,
|
||||||
updateStrategy = FieldStrategy.NOT_EMPTY,
|
updateStrategy = FieldStrategy.NOT_EMPTY,
|
||||||
@ -91,94 +102,69 @@ public class SysUser implements Serializable {
|
|||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 盐加密
|
|
||||||
*/
|
|
||||||
private String salt;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 帐号状态(0正常 1停用)
|
* 帐号状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "帐号状态(0正常 1停用)")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标志(0代表存在 2代表删除)
|
* 删除标志(0代表存在 2代表删除)
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后登录IP
|
* 最后登录IP
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "最后登录IP")
|
||||||
private String loginIp;
|
private String loginIp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后登录时间
|
* 最后登录时间
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "最后登录时间")
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Map<String, Object> params = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门对象
|
* 部门对象
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "部门对象")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private SysDept dept;
|
private SysDept dept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色对象
|
* 角色对象
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色对象")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<SysRole> roles;
|
private List<SysRole> roles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色组
|
* 角色组
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色组")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long[] roleIds;
|
private Long[] roleIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位组
|
* 岗位组
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "岗位组")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long[] postIds;
|
private Long[] postIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色ID
|
* 角色ID
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "角色ID")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
@ -186,6 +172,7 @@ public class SysUser implements Serializable {
|
|||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否管理员")
|
||||||
public boolean isAdmin() {
|
public boolean isAdmin() {
|
||||||
return isAdmin(this.userId);
|
return isAdmin(this.userId);
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,43 @@
|
|||||||
package com.ruoyi.common.core.domain.model;
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
import lombok.*;
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录对象
|
* 用户登录对象
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class LoginBody
|
@ApiModel("用户登录对象")
|
||||||
{
|
public class LoginBody {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户名")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户密码
|
* 用户密码
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码
|
* 验证码
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "验证码")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 唯一标识
|
* 唯一标识
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "唯一标识")
|
||||||
private String uuid = "";
|
private String uuid = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.common.core.domain.model;
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import lombok.Data;
|
||||||
import lombok.*;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
@ -13,14 +13,14 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* 登录用户身份权限
|
* 登录用户身份权限
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class LoginUser implements UserDetails
|
public class LoginUser implements UserDetails {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,35 +74,38 @@ public class LoginUser implements UserDetails
|
|||||||
private Set<String> permissions;
|
private Set<String> permissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户名
|
||||||
*/
|
*/
|
||||||
private SysUser user;
|
private String username;
|
||||||
|
|
||||||
public LoginUser(SysUser user, Set<String> permissions)
|
/**
|
||||||
{
|
* 密码
|
||||||
this.user = user;
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public LoginUser(String username, String password, Set<String> permissions) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions)
|
public LoginUser(Long userId, Long deptId, String username, String password, Set<String> permissions) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
this.user = user;
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Override
|
@Override
|
||||||
public String getPassword()
|
public String getPassword() {
|
||||||
{
|
return password;
|
||||||
return user.getPassword();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsername()
|
public String getUsername() {
|
||||||
{
|
return username;
|
||||||
return user.getUserName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,50 +113,39 @@ public class LoginUser implements UserDetails
|
|||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Override
|
@Override
|
||||||
public boolean isAccountNonExpired()
|
public boolean isAccountNonExpired() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定用户是否解锁,锁定的用户无法进行身份验证
|
* 指定用户是否解锁,锁定的用户无法进行身份验证
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Override
|
@Override
|
||||||
public boolean isAccountNonLocked()
|
public boolean isAccountNonLocked() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
|
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Override
|
@Override
|
||||||
public boolean isCredentialsNonExpired()
|
public boolean isCredentialsNonExpired() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否可用 ,禁用的用户不能身份验证
|
* 是否可用 ,禁用的用户不能身份验证
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled()
|
public boolean isEnabled() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<? extends GrantedAuthority> getAuthorities()
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.ruoyi.common.core.domain.model;
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户注册对象
|
* 用户注册对象
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
public class RegisterBody extends LoginBody
|
@ApiModel("用户注册对象")
|
||||||
{
|
public class RegisterBody extends LoginBody {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
package com.ruoyi.common.core.mybatisplus.cache;
|
|
||||||
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.ruoyi.common.utils.RedisUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.ibatis.cache.Cache;
|
|
||||||
import org.springframework.data.redis.connection.RedisServerCommands;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.concurrent.locks.ReadWriteLock;
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mybatis-redis 二级缓存
|
|
||||||
*
|
|
||||||
* 使用方法 配置文件开启 mybatis-plus 二级缓存
|
|
||||||
* 在 XxxMapper.java 类上添加注解 @CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class MybatisPlusRedisCache implements Cache {
|
|
||||||
|
|
||||||
private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(true);
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
public MybatisPlusRedisCache(final String id) {
|
|
||||||
if (id == null) {
|
|
||||||
throw new IllegalArgumentException("Cache instances require an ID");
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putObject(Object key, Object value) {
|
|
||||||
if (value != null) {
|
|
||||||
RedisUtils.setCacheObject(key.toString(), value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getObject(Object key) {
|
|
||||||
try {
|
|
||||||
if (key != null) {
|
|
||||||
return RedisUtils.getCacheObject(key.toString());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error("缓存出错");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object removeObject(Object key) {
|
|
||||||
if (key != null) {
|
|
||||||
RedisUtils.deleteObject(key.toString());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
log.debug("清空缓存");
|
|
||||||
Collection<String> keys = RedisUtils.keys("*:" + this.id + "*");
|
|
||||||
if (!CollectionUtils.isEmpty(keys)) {
|
|
||||||
RedisUtils.deleteObject(keys);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSize() {
|
|
||||||
RedisTemplate<String, Object> redisTemplate = SpringUtil.getBean("redisTemplate");
|
|
||||||
Long size = redisTemplate.execute(RedisServerCommands::dbSize);
|
|
||||||
return size.intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ReadWriteLock getReadWriteLock() {
|
|
||||||
return this.readWriteLock;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,260 +0,0 @@
|
|||||||
package com.ruoyi.common.core.redis;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.redisson.api.*;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* spring redis 工具类
|
|
||||||
*
|
|
||||||
* @author shenxinquan
|
|
||||||
* @see com.ruoyi.common.utils.RedisUtils
|
|
||||||
* @deprecated 3.2.0 删除此类
|
|
||||||
**/
|
|
||||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
|
||||||
@Component
|
|
||||||
@Deprecated
|
|
||||||
public class RedisCache {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedissonClient redissonClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布通道消息
|
|
||||||
*
|
|
||||||
* @param channelKey 通道key
|
|
||||||
* @param msg 发送数据
|
|
||||||
* @param consumer 自定义处理
|
|
||||||
*/
|
|
||||||
public <T> void publish(String channelKey, T msg, Consumer<T> consumer) {
|
|
||||||
RTopic topic = redissonClient.getTopic(channelKey);
|
|
||||||
topic.publish(msg);
|
|
||||||
consumer.accept(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void publish(String channelKey, T msg) {
|
|
||||||
RTopic topic = redissonClient.getTopic(channelKey);
|
|
||||||
topic.publish(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订阅通道接收消息
|
|
||||||
*
|
|
||||||
* @param channelKey 通道key
|
|
||||||
* @param clazz 消息类型
|
|
||||||
* @param consumer 自定义处理
|
|
||||||
*/
|
|
||||||
public <T> void subscribe(String channelKey, Class<T> clazz, Consumer<T> consumer) {
|
|
||||||
RTopic topic = redissonClient.getTopic(channelKey);
|
|
||||||
topic.addListener(clazz, (channel, msg) -> consumer.accept(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存基本的对象,Integer、String、实体类等
|
|
||||||
*
|
|
||||||
* @param key 缓存的键值
|
|
||||||
* @param value 缓存的值
|
|
||||||
*/
|
|
||||||
public <T> void setCacheObject(final String key, final T value) {
|
|
||||||
redissonClient.getBucket(key).set(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存基本的对象,Integer、String、实体类等
|
|
||||||
*
|
|
||||||
* @param key 缓存的键值
|
|
||||||
* @param value 缓存的值
|
|
||||||
* @param timeout 时间
|
|
||||||
* @param timeUnit 时间颗粒度
|
|
||||||
*/
|
|
||||||
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
|
|
||||||
RBucket<T> result = redissonClient.getBucket(key);
|
|
||||||
result.set(value);
|
|
||||||
result.expire(timeout, timeUnit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置有效时间
|
|
||||||
*
|
|
||||||
* @param key Redis键
|
|
||||||
* @param timeout 超时时间
|
|
||||||
* @return true=设置成功;false=设置失败
|
|
||||||
*/
|
|
||||||
public boolean expire(final String key, final long timeout) {
|
|
||||||
return expire(key, timeout, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置有效时间
|
|
||||||
*
|
|
||||||
* @param key Redis键
|
|
||||||
* @param timeout 超时时间
|
|
||||||
* @param unit 时间单位
|
|
||||||
* @return true=设置成功;false=设置失败
|
|
||||||
*/
|
|
||||||
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
|
|
||||||
RBucket rBucket = redissonClient.getBucket(key);
|
|
||||||
return rBucket.expire(timeout, unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得缓存的基本对象。
|
|
||||||
*
|
|
||||||
* @param key 缓存键值
|
|
||||||
* @return 缓存键值对应的数据
|
|
||||||
*/
|
|
||||||
public <T> T getCacheObject(final String key) {
|
|
||||||
RBucket<T> rBucket = redissonClient.getBucket(key);
|
|
||||||
return rBucket.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除单个对象
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
*/
|
|
||||||
public boolean deleteObject(final String key) {
|
|
||||||
return redissonClient.getBucket(key).delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除集合对象
|
|
||||||
*
|
|
||||||
* @param collection 多个对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void deleteObject(final Collection collection) {
|
|
||||||
RBatch batch = redissonClient.createBatch();
|
|
||||||
collection.forEach(t->{
|
|
||||||
batch.getBucket(t.toString()).deleteAsync();
|
|
||||||
});
|
|
||||||
batch.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存List数据
|
|
||||||
*
|
|
||||||
* @param key 缓存的键值
|
|
||||||
* @param dataList 待缓存的List数据
|
|
||||||
* @return 缓存的对象
|
|
||||||
*/
|
|
||||||
public <T> boolean setCacheList(final String key, final List<T> dataList) {
|
|
||||||
RList<T> rList = redissonClient.getList(key);
|
|
||||||
return rList.addAll(dataList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得缓存的list对象
|
|
||||||
*
|
|
||||||
* @param key 缓存的键值
|
|
||||||
* @return 缓存键值对应的数据
|
|
||||||
*/
|
|
||||||
public <T> List<T> getCacheList(final String key) {
|
|
||||||
RList<T> rList = redissonClient.getList(key);
|
|
||||||
return rList.readAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存Set
|
|
||||||
*
|
|
||||||
* @param key 缓存键值
|
|
||||||
* @param dataSet 缓存的数据
|
|
||||||
* @return 缓存数据的对象
|
|
||||||
*/
|
|
||||||
public <T> boolean setCacheSet(final String key, final Set<T> dataSet) {
|
|
||||||
RSet<T> rSet = redissonClient.getSet(key);
|
|
||||||
return rSet.addAll(dataSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得缓存的set
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public <T> Set<T> getCacheSet(final String key) {
|
|
||||||
RSet<T> rSet = redissonClient.getSet(key);
|
|
||||||
return rSet.readAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存Map
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param dataMap
|
|
||||||
*/
|
|
||||||
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
|
|
||||||
if (dataMap != null) {
|
|
||||||
RMap<String, T> rMap = redissonClient.getMap(key);
|
|
||||||
rMap.putAll(dataMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得缓存的Map
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public <T> Map<String, T> getCacheMap(final String key) {
|
|
||||||
RMap<String, T> rMap = redissonClient.getMap(key);
|
|
||||||
return rMap.getAll(rMap.keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 往Hash中存入数据
|
|
||||||
*
|
|
||||||
* @param key Redis键
|
|
||||||
* @param hKey Hash键
|
|
||||||
* @param value 值
|
|
||||||
*/
|
|
||||||
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
|
|
||||||
RMap<String, T> rMap = redissonClient.getMap(key);
|
|
||||||
rMap.put(hKey, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取Hash中的数据
|
|
||||||
*
|
|
||||||
* @param key Redis键
|
|
||||||
* @param hKey Hash键
|
|
||||||
* @return Hash中的对象
|
|
||||||
*/
|
|
||||||
public <T> T getCacheMapValue(final String key, final String hKey) {
|
|
||||||
RMap<String, T> rMap = redissonClient.getMap(key);
|
|
||||||
return rMap.get(hKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取多个Hash中的数据
|
|
||||||
*
|
|
||||||
* @param key Redis键
|
|
||||||
* @param hKeys Hash键集合
|
|
||||||
* @return Hash对象集合
|
|
||||||
*/
|
|
||||||
public <K,V> Map<K,V> getMultiCacheMapValue(final String key, final Set<K> hKeys) {
|
|
||||||
RMap<K,V> rMap = redissonClient.getMap(key);
|
|
||||||
return rMap.getAll(hKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得缓存的基本对象列表
|
|
||||||
*
|
|
||||||
* @param pattern 字符串前缀
|
|
||||||
* @return 对象列表
|
|
||||||
*/
|
|
||||||
public Collection<String> keys(final String pattern) {
|
|
||||||
Iterable<String> iterable = redissonClient.getKeys().getKeysByPattern(pattern);
|
|
||||||
return Lists.newArrayList(iterable);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.common.core.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用 参数配置服务
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface ConfigService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数 key 获取参数值
|
||||||
|
*
|
||||||
|
* @param configKey 参数 key
|
||||||
|
* @return 参数值
|
||||||
|
*/
|
||||||
|
String getConfigValue(String configKey);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.ruoyi.common.core.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用 字典服务
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface DictService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分隔符
|
||||||
|
*/
|
||||||
|
String SEPARATOR = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典值获取字典标签
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
default String getDictLabel(String dictType, String dictValue) {
|
||||||
|
return getDictLabel(dictType, dictValue, SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典标签获取字典值
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictLabel 字典标签
|
||||||
|
* @return 字典值
|
||||||
|
*/
|
||||||
|
default String getDictValue(String dictType, String dictLabel) {
|
||||||
|
return getDictValue(dictType, dictLabel, SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典值获取字典标签
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典值
|
||||||
|
* @param separator 分隔符
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
String getDictLabel(String dictType, String dictValue, String separator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典标签获取字典值
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictLabel 字典标签
|
||||||
|
* @param separator 分隔符
|
||||||
|
* @return 字典值
|
||||||
|
*/
|
||||||
|
String getDictValue(String dictType, String dictLabel, String separator);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.common.core.service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用 系统访问日志
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface LogininforService {
|
||||||
|
|
||||||
|
void recordLogininfor(String username, String status, String message,
|
||||||
|
HttpServletRequest request, Object... args);
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.common.core.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.dto.OperLogDTO;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用 操作日志
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface OperLogService {
|
||||||
|
|
||||||
|
@Async
|
||||||
|
void recordOper(OperLogDTO operLogDTO);
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.ruoyi.common.core.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token验证处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface TokenService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户身份信息
|
||||||
|
*
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
LoginUser getLoginUser(HttpServletRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户身份信息
|
||||||
|
*/
|
||||||
|
void setLoginUser(LoginUser loginUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户身份信息
|
||||||
|
*/
|
||||||
|
void delLoginUser(String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建令牌
|
||||||
|
*
|
||||||
|
* @param loginUser 用户信息
|
||||||
|
* @return 令牌
|
||||||
|
*/
|
||||||
|
String createToken(LoginUser loginUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证令牌有效期,相差不足20分钟,自动刷新缓存
|
||||||
|
*
|
||||||
|
* @param loginUser
|
||||||
|
* @return 令牌
|
||||||
|
*/
|
||||||
|
void verifyToken(LoginUser loginUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新令牌有效期
|
||||||
|
*
|
||||||
|
* @param loginUser 登录信息
|
||||||
|
*/
|
||||||
|
void refreshToken(LoginUser loginUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户代理信息
|
||||||
|
*
|
||||||
|
* @param loginUser 登录信息
|
||||||
|
*/
|
||||||
|
void setUserAgent(LoginUser loginUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从令牌中获取用户名
|
||||||
|
*
|
||||||
|
* @param token 令牌
|
||||||
|
* @return 用户名
|
||||||
|
*/
|
||||||
|
String getUsernameFromToken(String token);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.common.core.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用 用户业务
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface UserService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户
|
||||||
|
*
|
||||||
|
* @param userName 用户名
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
SysUser selectUserByUserName(String userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
}
|
@ -4,10 +4,8 @@ package com.ruoyi.common.enums;
|
|||||||
* 操作状态
|
* 操作状态
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum BusinessStatus
|
public enum BusinessStatus {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 成功
|
* 成功
|
||||||
*/
|
*/
|
||||||
|
@ -5,8 +5,7 @@ package com.ruoyi.common.enums;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum BusinessType
|
public enum BusinessType {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 其它
|
* 其它
|
||||||
*/
|
*/
|
||||||
|
@ -1,36 +1,32 @@
|
|||||||
package com.ruoyi.common.enums;
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.springframework.lang.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求方式
|
* 请求方式
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum HttpMethod
|
public enum HttpMethod {
|
||||||
{
|
|
||||||
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
||||||
|
|
||||||
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
||||||
|
|
||||||
static
|
static {
|
||||||
{
|
for (HttpMethod httpMethod : values()) {
|
||||||
for (HttpMethod httpMethod : values())
|
|
||||||
{
|
|
||||||
mappings.put(httpMethod.name(), httpMethod);
|
mappings.put(httpMethod.name(), httpMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static HttpMethod resolve(@Nullable String method)
|
public static HttpMethod resolve(@Nullable String method) {
|
||||||
{
|
|
||||||
return (method != null ? mappings.get(method) : null);
|
return (method != null ? mappings.get(method) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(String method)
|
public boolean matches(String method) {
|
||||||
{
|
|
||||||
return (this == resolve(method));
|
return (this == resolve(method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@ package com.ruoyi.common.enums;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum LimitType
|
public enum LimitType {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 默认策略全局限流
|
* 默认策略全局限流
|
||||||
*/
|
*/
|
||||||
@ -16,5 +15,10 @@ public enum LimitType
|
|||||||
/**
|
/**
|
||||||
* 根据请求者IP进行限流
|
* 根据请求者IP进行限流
|
||||||
*/
|
*/
|
||||||
IP
|
IP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实例限流(集群多后端实例)
|
||||||
|
*/
|
||||||
|
CLUSTER
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@ package com.ruoyi.common.enums;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum OperatorType
|
public enum OperatorType {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 其它
|
* 其它
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ThreadPoolRejectedPolicy {
|
public enum ThreadPoolRejectedPolicy {
|
||||||
|
|
||||||
CALLER_RUNS_POLICY("等待", ThreadPoolExecutor.CallerRunsPolicy.class),
|
CALLER_RUNS_POLICY("调用方执行", ThreadPoolExecutor.CallerRunsPolicy.class),
|
||||||
DISCARD_OLDEST_POLICY("放弃最旧的", ThreadPoolExecutor.DiscardOldestPolicy.class),
|
DISCARD_OLDEST_POLICY("放弃最旧的", ThreadPoolExecutor.DiscardOldestPolicy.class),
|
||||||
DISCARD_POLICY("丢弃", ThreadPoolExecutor.DiscardPolicy.class),
|
DISCARD_POLICY("丢弃", ThreadPoolExecutor.DiscardPolicy.class),
|
||||||
ABORT_POLICY("中止", ThreadPoolExecutor.AbortPolicy.class);
|
ABORT_POLICY("中止", ThreadPoolExecutor.AbortPolicy.class);
|
||||||
|
@ -5,26 +5,22 @@ package com.ruoyi.common.enums;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum UserStatus
|
public enum UserStatus {
|
||||||
{
|
|
||||||
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
|
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final String info;
|
private final String info;
|
||||||
|
|
||||||
UserStatus(String code, String info)
|
UserStatus(String code, String info) {
|
||||||
{
|
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCode()
|
public String getCode() {
|
||||||
{
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInfo()
|
public String getInfo() {
|
||||||
{
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.ruoyi.common.excel;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
|
import com.alibaba.excel.event.AnalysisEventListener;
|
||||||
|
import com.alibaba.excel.exception.ExcelAnalysisException;
|
||||||
|
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.common.utils.ValidatorUtils;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintViolation;
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel 导入监听
|
||||||
|
*
|
||||||
|
* @author Yjoioooo
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements ExcelListener<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否Validator检验,默认为是
|
||||||
|
*/
|
||||||
|
private Boolean isValidate = Boolean.TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* excel 表头数据
|
||||||
|
*/
|
||||||
|
private Map<Integer, String> headMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入回执
|
||||||
|
*/
|
||||||
|
private ExcelResult<T> excelResult;
|
||||||
|
|
||||||
|
public DefaultExcelListener(boolean isValidate) {
|
||||||
|
this.excelResult = new DefautExcelResult<>();
|
||||||
|
this.isValidate = isValidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理异常
|
||||||
|
*
|
||||||
|
* @param exception ExcelDataConvertException
|
||||||
|
* @param context Excel 上下文
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onException(Exception exception, AnalysisContext context) throws Exception {
|
||||||
|
String errMsg = null;
|
||||||
|
if (exception instanceof ExcelDataConvertException) {
|
||||||
|
// 如果是某一个单元格的转换异常 能获取到具体行号
|
||||||
|
ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
|
||||||
|
Integer rowIndex = excelDataConvertException.getRowIndex();
|
||||||
|
Integer columnIndex = excelDataConvertException.getColumnIndex();
|
||||||
|
errMsg = StrUtil.format("第{}行-第{}列-表头{}: 解析异常<br/>",
|
||||||
|
rowIndex + 1, columnIndex + 1, headMap.get(columnIndex));
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.error(errMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exception instanceof ConstraintViolationException) {
|
||||||
|
ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception;
|
||||||
|
Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations();
|
||||||
|
String constraintViolationsMsg = constraintViolations.stream()
|
||||||
|
.map(ConstraintViolation::getMessage)
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
errMsg = StrUtil.format("第{}行数据校验异常: {}", context.readRowHolder().getRowIndex() + 1, constraintViolationsMsg);
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.error(errMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
excelResult.getErrorList().add(errMsg);
|
||||||
|
throw new ExcelAnalysisException(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
||||||
|
this.headMap = headMap;
|
||||||
|
log.debug("解析到一条表头数据: {}", JSON.toJSONString(headMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(T data, AnalysisContext context) {
|
||||||
|
if (isValidate) {
|
||||||
|
ValidatorUtils.validate(data);
|
||||||
|
}
|
||||||
|
excelResult.getList().add(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||||
|
log.debug("所有数据解析完成!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExcelResult<T> getExcelResult() {
|
||||||
|
return excelResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.ruoyi.common.excel;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认excel返回对象
|
||||||
|
*
|
||||||
|
* @author Yjoioooo
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class DefautExcelResult<T> implements ExcelResult<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据对象list
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
private List<T> list;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息列表
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
private List<String> errorList;
|
||||||
|
|
||||||
|
public DefautExcelResult() {
|
||||||
|
this.list = new ArrayList<>();
|
||||||
|
this.errorList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefautExcelResult(List<T> list, List<String> errorList) {
|
||||||
|
this.list = list;
|
||||||
|
this.errorList = errorList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefautExcelResult(ExcelResult<T> excelResult) {
|
||||||
|
this.list = excelResult.getList();
|
||||||
|
this.errorList = excelResult.getErrorList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getErrorList() {
|
||||||
|
return errorList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取导入回执
|
||||||
|
*
|
||||||
|
* @return 导入回执
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getAnalysis() {
|
||||||
|
int successCount = list.size();
|
||||||
|
int errorCount = errorList.size();
|
||||||
|
if (successCount == 0) {
|
||||||
|
return "读取失败,未解析到数据";
|
||||||
|
} else {
|
||||||
|
if (errorCount == 0) {
|
||||||
|
return StrUtil.format("恭喜您,全部读取成功!共{}条", successCount);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.common.excel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel 导入监听
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface ExcelListener<T> extends ReadListener<T> {
|
||||||
|
|
||||||
|
ExcelResult<T> getExcelResult();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.common.excel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* excel返回对象
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface ExcelResult<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象列表
|
||||||
|
*/
|
||||||
|
List<T> getList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误列表
|
||||||
|
*/
|
||||||
|
List<String> getErrorList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入回执
|
||||||
|
*/
|
||||||
|
String getAnalysis();
|
||||||
|
}
|
@ -5,11 +5,9 @@ package com.ruoyi.common.exception;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class DemoModeException extends RuntimeException
|
public class DemoModeException extends RuntimeException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public DemoModeException()
|
public DemoModeException() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@ package com.ruoyi.common.exception;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class GlobalException extends RuntimeException
|
public class GlobalException extends RuntimeException {
|
||||||
{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ public class GlobalException extends RuntimeException
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误明细,内部调试错误
|
* 错误明细,内部调试错误
|
||||||
*
|
* <p>
|
||||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||||
*/
|
*/
|
||||||
private String detailMessage;
|
private String detailMessage;
|
||||||
@ -25,33 +24,28 @@ public class GlobalException extends RuntimeException
|
|||||||
/**
|
/**
|
||||||
* 空构造方法,避免反序列化问题
|
* 空构造方法,避免反序列化问题
|
||||||
*/
|
*/
|
||||||
public GlobalException()
|
public GlobalException() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlobalException(String message)
|
public GlobalException(String message) {
|
||||||
{
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDetailMessage()
|
public String getDetailMessage() {
|
||||||
{
|
|
||||||
return detailMessage;
|
return detailMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlobalException setDetailMessage(String detailMessage)
|
public GlobalException setDetailMessage(String detailMessage) {
|
||||||
{
|
|
||||||
this.detailMessage = detailMessage;
|
this.detailMessage = detailMessage;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
@Override
|
||||||
{
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlobalException setMessage(String message)
|
public GlobalException setMessage(String message) {
|
||||||
{
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@ package com.ruoyi.common.exception;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public final class ServiceException extends RuntimeException
|
public final class ServiceException extends RuntimeException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +20,7 @@ public final class ServiceException extends RuntimeException
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误明细,内部调试错误
|
* 错误明细,内部调试错误
|
||||||
*
|
* <p>
|
||||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||||
*/
|
*/
|
||||||
private String detailMessage;
|
private String detailMessage;
|
||||||
@ -29,44 +28,37 @@ public final class ServiceException extends RuntimeException
|
|||||||
/**
|
/**
|
||||||
* 空构造方法,避免反序列化问题
|
* 空构造方法,避免反序列化问题
|
||||||
*/
|
*/
|
||||||
public ServiceException()
|
public ServiceException() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceException(String message)
|
public ServiceException(String message) {
|
||||||
{
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceException(String message, Integer code)
|
public ServiceException(String message, Integer code) {
|
||||||
{
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDetailMessage()
|
public String getDetailMessage() {
|
||||||
{
|
|
||||||
return detailMessage;
|
return detailMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
@Override
|
||||||
{
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCode()
|
public Integer getCode() {
|
||||||
{
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceException setMessage(String message)
|
public ServiceException setMessage(String message) {
|
||||||
{
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceException setDetailMessage(String detailMessage)
|
public ServiceException setDetailMessage(String detailMessage) {
|
||||||
{
|
|
||||||
this.detailMessage = detailMessage;
|
this.detailMessage = detailMessage;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,18 @@ package com.ruoyi.common.exception;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UtilException extends RuntimeException
|
public class UtilException extends RuntimeException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 8247610319171014183L;
|
private static final long serialVersionUID = 8247610319171014183L;
|
||||||
|
|
||||||
public UtilException(Throwable e)
|
public UtilException(Throwable e) {
|
||||||
{
|
|
||||||
super(e.getMessage(), e);
|
super(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UtilException(String message)
|
public UtilException(String message) {
|
||||||
{
|
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UtilException(String message, Throwable throwable)
|
public UtilException(String message, Throwable throwable) {
|
||||||
{
|
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,17 @@ package com.ruoyi.common.exception.base;
|
|||||||
|
|
||||||
import com.ruoyi.common.utils.MessageUtils;
|
import com.ruoyi.common.utils.MessageUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础异常
|
* 基础异常
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class BaseException extends RuntimeException
|
@Data
|
||||||
{
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class BaseException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,66 +35,39 @@ public class BaseException extends RuntimeException
|
|||||||
*/
|
*/
|
||||||
private String defaultMessage;
|
private String defaultMessage;
|
||||||
|
|
||||||
public BaseException(String module, String code, Object[] args, String defaultMessage)
|
public BaseException(String module, String code, Object[] args, String defaultMessage) {
|
||||||
{
|
|
||||||
this.module = module;
|
this.module = module;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.defaultMessage = defaultMessage;
|
this.defaultMessage = defaultMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseException(String module, String code, Object[] args)
|
public BaseException(String module, String code, Object[] args) {
|
||||||
{
|
|
||||||
this(module, code, args, null);
|
this(module, code, args, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseException(String module, String defaultMessage)
|
public BaseException(String module, String defaultMessage) {
|
||||||
{
|
|
||||||
this(module, null, null, defaultMessage);
|
this(module, null, null, defaultMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseException(String code, Object[] args)
|
public BaseException(String code, Object[] args) {
|
||||||
{
|
|
||||||
this(null, code, args, null);
|
this(null, code, args, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseException(String defaultMessage)
|
public BaseException(String defaultMessage) {
|
||||||
{
|
|
||||||
this(null, null, null, defaultMessage);
|
this(null, null, null, defaultMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage()
|
public String getMessage() {
|
||||||
{
|
|
||||||
String message = null;
|
String message = null;
|
||||||
if (!StringUtils.isEmpty(code))
|
if (!StringUtils.isEmpty(code)) {
|
||||||
{
|
|
||||||
message = MessageUtils.message(code, args);
|
message = MessageUtils.message(code, args);
|
||||||
}
|
}
|
||||||
if (message == null)
|
if (message == null) {
|
||||||
{
|
|
||||||
message = defaultMessage;
|
message = defaultMessage;
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModule()
|
|
||||||
{
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode()
|
|
||||||
{
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object[] getArgs()
|
|
||||||
{
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefaultMessage()
|
|
||||||
{
|
|
||||||
return defaultMessage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,10 @@ import com.ruoyi.common.exception.base.BaseException;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class FileException extends BaseException
|
public class FileException extends BaseException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public FileException(String code, Object[] args)
|
public FileException(String code, Object[] args) {
|
||||||
{
|
|
||||||
super("file", code, args, null);
|
super("file", code, args, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.file;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class FileNameLengthLimitExceededException extends FileException
|
public class FileNameLengthLimitExceededException extends FileException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public FileNameLengthLimitExceededException(int defaultFileNameLength)
|
public FileNameLengthLimitExceededException(int defaultFileNameLength) {
|
||||||
{
|
super("upload.filename.exceed.length", new Object[]{defaultFileNameLength});
|
||||||
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.file;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class FileSizeLimitExceededException extends FileException
|
public class FileSizeLimitExceededException extends FileException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public FileSizeLimitExceededException(long defaultMaxSize)
|
public FileSizeLimitExceededException(long defaultMaxSize) {
|
||||||
{
|
super("upload.exceed.maxSize", new Object[]{defaultMaxSize});
|
||||||
super("upload.exceed.maxSize", new Object[] { defaultMaxSize });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
package com.ruoyi.common.exception.file;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import org.apache.commons.fileupload.FileUploadException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件上传 误异常类
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class InvalidExtensionException extends FileUploadException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String[] allowedExtension;
|
|
||||||
private String extension;
|
|
||||||
private String filename;
|
|
||||||
|
|
||||||
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
|
|
||||||
{
|
|
||||||
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
|
|
||||||
this.allowedExtension = allowedExtension;
|
|
||||||
this.extension = extension;
|
|
||||||
this.filename = filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getAllowedExtension()
|
|
||||||
{
|
|
||||||
return allowedExtension;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExtension()
|
|
||||||
{
|
|
||||||
return extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFilename()
|
|
||||||
{
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class InvalidImageExtensionException extends InvalidExtensionException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
|
|
||||||
{
|
|
||||||
super(allowedExtension, extension, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class InvalidFlashExtensionException extends InvalidExtensionException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
|
|
||||||
{
|
|
||||||
super(allowedExtension, extension, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class InvalidMediaExtensionException extends InvalidExtensionException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
|
|
||||||
{
|
|
||||||
super(allowedExtension, extension, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class InvalidVideoExtensionException extends InvalidExtensionException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename)
|
|
||||||
{
|
|
||||||
super(allowedExtension, extension, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.ruoyi.common.exception.job;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计划策略异常
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class TaskException extends Exception
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Code code;
|
|
||||||
|
|
||||||
public TaskException(String msg, Code code)
|
|
||||||
{
|
|
||||||
this(msg, code, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TaskException(String msg, Code code, Exception nestedEx)
|
|
||||||
{
|
|
||||||
super(msg, nestedEx);
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Code getCode()
|
|
||||||
{
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Code
|
|
||||||
{
|
|
||||||
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class CaptchaException extends UserException
|
public class CaptchaException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public CaptchaException()
|
public CaptchaException() {
|
||||||
{
|
|
||||||
super("user.jcaptcha.error", null);
|
super("user.jcaptcha.error", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class CaptchaExpireException extends UserException
|
public class CaptchaExpireException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public CaptchaExpireException()
|
public CaptchaExpireException() {
|
||||||
{
|
|
||||||
super("user.jcaptcha.expire", null);
|
super("user.jcaptcha.expire", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,10 @@ import com.ruoyi.common.exception.base.BaseException;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserException extends BaseException
|
public class UserException extends BaseException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserException(String code, Object[] args)
|
public UserException(String code, Object[] args) {
|
||||||
{
|
|
||||||
super("user", code, args, null);
|
super("user", code, args, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserPasswordNotMatchException extends UserException
|
public class UserPasswordNotMatchException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserPasswordNotMatchException()
|
public UserPasswordNotMatchException() {
|
||||||
{
|
|
||||||
super("user.password.not.match", null);
|
super("user.password.not.match", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,37 +12,29 @@ import java.io.IOException;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RepeatableFilter implements Filter
|
public class RepeatableFilter implements Filter {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void init(FilterConfig filterConfig) throws ServletException
|
public void init(FilterConfig filterConfig) throws ServletException {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException {
|
||||||
{
|
|
||||||
ServletRequest requestWrapper = null;
|
ServletRequest requestWrapper = null;
|
||||||
if (request instanceof HttpServletRequest
|
if (request instanceof HttpServletRequest
|
||||||
&& StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE))
|
&& StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) {
|
||||||
{
|
|
||||||
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
||||||
}
|
}
|
||||||
if (null == requestWrapper)
|
if (null == requestWrapper) {
|
||||||
{
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
chain.doFilter(requestWrapper, response);
|
chain.doFilter(requestWrapper, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,10 @@ import java.nio.charset.StandardCharsets;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper
|
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
|
||||||
{
|
|
||||||
private final byte[] body;
|
private final byte[] body;
|
||||||
|
|
||||||
public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException
|
public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException {
|
||||||
{
|
|
||||||
super(request);
|
super(request);
|
||||||
request.setCharacterEncoding("UTF-8");
|
request.setCharacterEncoding("UTF-8");
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
@ -32,44 +30,36 @@ public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BufferedReader getReader() throws IOException
|
public BufferedReader getReader() throws IOException {
|
||||||
{
|
|
||||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServletInputStream getInputStream() throws IOException
|
public ServletInputStream getInputStream() throws IOException {
|
||||||
{
|
|
||||||
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
|
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
|
||||||
return new ServletInputStream()
|
return new ServletInputStream() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException
|
public int read() throws IOException {
|
||||||
{
|
|
||||||
return bais.read();
|
return bais.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int available() throws IOException
|
public int available() throws IOException {
|
||||||
{
|
|
||||||
return body.length;
|
return body.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished()
|
public boolean isFinished() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReady()
|
public boolean isReady() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setReadListener(ReadListener readListener)
|
public void setReadListener(ReadListener readListener) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -14,22 +14,18 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class XssFilter implements Filter
|
public class XssFilter implements Filter {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 排除链接
|
* 排除链接
|
||||||
*/
|
*/
|
||||||
public List<String> excludes = new ArrayList<>();
|
public List<String> excludes = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(FilterConfig filterConfig) throws ServletException
|
public void init(FilterConfig filterConfig) throws ServletException {
|
||||||
{
|
|
||||||
String tempExcludes = filterConfig.getInitParameter("excludes");
|
String tempExcludes = filterConfig.getInitParameter("excludes");
|
||||||
if (StringUtils.isNotEmpty(tempExcludes))
|
if (StringUtils.isNotEmpty(tempExcludes)) {
|
||||||
{
|
|
||||||
String[] url = tempExcludes.split(",");
|
String[] url = tempExcludes.split(",");
|
||||||
for (int i = 0; url != null && i < url.length; i++)
|
for (int i = 0; url != null && i < url.length; i++) {
|
||||||
{
|
|
||||||
excludes.add(url[i]);
|
excludes.add(url[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,12 +33,10 @@ public class XssFilter implements Filter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException {
|
||||||
{
|
|
||||||
HttpServletRequest req = (HttpServletRequest) request;
|
HttpServletRequest req = (HttpServletRequest) request;
|
||||||
HttpServletResponse resp = (HttpServletResponse) response;
|
HttpServletResponse resp = (HttpServletResponse) response;
|
||||||
if (handleExcludeURL(req, resp))
|
if (handleExcludeURL(req, resp)) {
|
||||||
{
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -50,21 +44,18 @@ public class XssFilter implements Filter
|
|||||||
chain.doFilter(xssRequest, response);
|
chain.doFilter(xssRequest, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response)
|
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) {
|
||||||
{
|
|
||||||
String url = request.getServletPath();
|
String url = request.getServletPath();
|
||||||
String method = request.getMethod();
|
String method = request.getMethod();
|
||||||
// GET DELETE 不过滤
|
// GET DELETE 不过滤
|
||||||
if (method == null || method.matches("GET") || method.matches("DELETE"))
|
if (method == null || method.matches("GET") || method.matches("DELETE")) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return StringUtils.matches(url, excludes);
|
return StringUtils.matches(url, excludes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,26 +19,21 @@ import java.nio.charset.StandardCharsets;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
|
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
public XssHttpServletRequestWrapper(HttpServletRequest request)
|
public XssHttpServletRequestWrapper(HttpServletRequest request) {
|
||||||
{
|
|
||||||
super(request);
|
super(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getParameterValues(String name)
|
public String[] getParameterValues(String name) {
|
||||||
{
|
|
||||||
String[] values = super.getParameterValues(name);
|
String[] values = super.getParameterValues(name);
|
||||||
if (values != null)
|
if (values != null) {
|
||||||
{
|
|
||||||
int length = values.length;
|
int length = values.length;
|
||||||
String[] escapseValues = new String[length];
|
String[] escapseValues = new String[length];
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++) {
|
||||||
{
|
|
||||||
// 防xss攻击和过滤前后空格
|
// 防xss攻击和过滤前后空格
|
||||||
escapseValues[i] = HtmlUtil.cleanHtmlTag(values[i]).trim();
|
escapseValues[i] = HtmlUtil.cleanHtmlTag(values[i]).trim();
|
||||||
}
|
}
|
||||||
@ -48,18 +43,15 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServletInputStream getInputStream() throws IOException
|
public ServletInputStream getInputStream() throws IOException {
|
||||||
{
|
|
||||||
// 非json类型,直接返回
|
// 非json类型,直接返回
|
||||||
if (!isJsonRequest())
|
if (!isJsonRequest()) {
|
||||||
{
|
|
||||||
return super.getInputStream();
|
return super.getInputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 为空,直接返回
|
// 为空,直接返回
|
||||||
String json = IoUtil.read(super.getInputStream(), StandardCharsets.UTF_8);
|
String json = IoUtil.read(super.getInputStream(), StandardCharsets.UTF_8);
|
||||||
if (StringUtils.isEmpty(json))
|
if (StringUtils.isEmpty(json)) {
|
||||||
{
|
|
||||||
return super.getInputStream();
|
return super.getInputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,34 +59,28 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
|
|||||||
json = HtmlUtil.cleanHtmlTag(json).trim();
|
json = HtmlUtil.cleanHtmlTag(json).trim();
|
||||||
byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8);
|
byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8);
|
||||||
final ByteArrayInputStream bis = IoUtil.toStream(jsonBytes);
|
final ByteArrayInputStream bis = IoUtil.toStream(jsonBytes);
|
||||||
return new ServletInputStream()
|
return new ServletInputStream() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished()
|
public boolean isFinished() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReady()
|
public boolean isReady() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int available() throws IOException
|
public int available() throws IOException {
|
||||||
{
|
|
||||||
return jsonBytes.length;
|
return jsonBytes.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setReadListener(ReadListener readListener)
|
public void setReadListener(ReadListener readListener) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException
|
public int read() throws IOException {
|
||||||
{
|
|
||||||
return bis.read();
|
return bis.read();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -105,8 +91,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
|
|||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
public boolean isJsonRequest()
|
public boolean isJsonRequest() {
|
||||||
{
|
|
||||||
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
||||||
return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE);
|
return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.config.properties;
|
package com.ruoyi.common.properties;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user