64 Commits

Author SHA1 Message Date
疯狂的狮子li
7249d05e34 Merge remote-tracking branch 'origin/dev' 2023-01-13 10:14:37 +08:00
疯狂的狮子li
1746316fea 🧧发布 1.5.0 新春版 新增多数据库支持 2023-01-13 10:10:26 +08:00
疯狂的狮子li
1ef9cfc1bf add 新增 BeanCopyUtils#mapToMap 方法 2023-01-12 16:52:25 +08:00
疯狂的狮子li
5c21e550a0 fix 修复 新版本 Redisson 存在与 boot 2.X 的兼容性问题 2023-01-12 15:20:22 +08:00
疯狂的狮子li
3d570ddc76 fix 修复 gateway 流控规则生效但不显示问题 2023-01-12 11:54:54 +08:00
疯狂的狮子li
64c65603cb update sa-token 1.33.0 => 1.34.0 2023-01-11 15:25:16 +08:00
疯狂的狮子li
9e8b460eb1 update springboot-admin 2.7.9 => 2.7.10
update easyexcel 3.1.4 => 3.1.5
update redisson 3.19.0 => 3.19.1
2023-01-10 17:42:20 +08:00
疯狂的狮子li
4e0793221e fix 修复 注册页面 验证码开关不生效问题 2023-01-10 16:43:18 +08:00
疯狂的狮子li
8bd9e723fd update 优化 demo服务 过滤健康检查sql打印 2023-01-09 16:36:21 +08:00
疯狂的狮子Li
246e92bf90 reset 回滚 错误优化导致问题
Signed-off-by: 疯狂的狮子Li <15040126243@163.com>
2023-01-08 08:09:08 +00:00
疯狂的狮子li
0b1052bb80 fix 修复 postgres 数据库用户名密码使用变量错误 2023-01-04 16:47:10 +08:00
疯狂的狮子li
be7218fcfb fix 修复 sql文件迁移过程中的错误 2023-01-04 16:46:51 +08:00
疯狂的狮子li
5ecbbddee8 update mybatis-plus 3.5.3 => 3.5.3.1 2023-01-03 11:53:05 +08:00
zlyx
9c9366b594 refactor 重构 BaseMapperPlus, 引入 MP V3.5.3 工具类 Db 进行批量增删改操作 ; 2022-12-30 17:23:12 +08:00
疯狂的狮子li
7bd5f9f84b update 优化 代码生成与框架主体使用相同的主键生成器 全局统一避免问题 2022-12-29 15:44:39 +08:00
疯狂的狮子li
738b54fe43 update mybatis-plus 3.5.2 => 3.5.3 2022-12-29 10:29:12 +08:00
疯狂的狮子li
f4be121c7d update 优化 更细致的 issue 提问模板 2022-12-28 18:57:58 +08:00
疯狂的狮子li
f887625a33 update 优化 更细致的 issue 提问模板 2022-12-28 18:53:41 +08:00
疯狂的狮子li
62e26e61d7 update easy-es 1.1.0 => 1.1.1
update hutool 5.8.10 => 5.8.11
update aws-s3 1.12.349 => 1.12.373
update aliyun-sms 2.0.22 => 2.0.23
update tencent-sms 3.1.635 => 3.1.660
2022-12-28 16:28:47 +08:00
疯狂的狮子li
e95543d18f add 增加 GET 请求提交日期参数 默认格式化配置 2022-12-28 15:04:06 +08:00
疯狂的狮子li
f5994d2cde add 增加 oracle postgres docker编排 2022-12-27 17:40:54 +08:00
疯狂的狮子li
665c1b1c48 update 优化 系统登录 使用单表查询校验用户 避免多次join查询 2022-12-27 17:38:29 +08:00
疯狂的狮子li
77e899981a update 优化 适配框架多数据库支持 完成 oracle postgres 数据库适配
(放弃 sqlserver 适配 原因: 基础中间件均不支持)
2022-12-27 16:32:25 +08:00
疯狂的狮子li
db5d448623 add 新增 代码生成器适配 多数据库可切换生成代码 2022-12-27 16:11:57 +08:00
疯狂的狮子li
be9442a9bd add 新增 oracle postgres 数据库框架sql脚本 2022-12-27 16:11:08 +08:00
疯狂的狮子li
b7afbd4464 add 增加 DataBaseHelper 数据库助手 用于适配多类型数据库 2022-12-27 16:07:49 +08:00
疯狂的狮子li
47397a3504 update 优化 删除主sql内无用数据 2022-12-27 16:05:08 +08:00
疯狂的狮子li
5b7d4188e0 fix 修复 新版本 dubbo-filter-seata 插件内核与seata不一致问题(临时) 2022-12-27 14:35:35 +08:00
疯狂的狮子li
72e65dc078 update 优化 删除 vue3 模板无用参数 2022-12-27 09:48:02 +08:00
疯狂的狮子Li
846e945c83 update 重构 ExcelUtil 全导出方法支持 OutputStream 流导出 不局限于 response 2022-12-26 11:13:13 +08:00
疯狂的狮子li
0d732b4e78 reset 回滚 poi对log4j强依赖 移除后导致导出异常 2022-12-23 16:26:59 +08:00
疯狂的狮子li
14e838f8f7 update 优化 maven 地址切换回 aliyun 仓库 2022-12-23 15:53:34 +08:00
疯狂的狮子li
cdf1b45a05 fix 修复 spring-boot-starter-logging 依赖报警告问题 2022-12-23 14:56:14 +08:00
疯狂的狮子li
0fbda617f3 update dubbo 3.1.3 => 3.1.4 2022-12-23 14:51:55 +08:00
疯狂的狮子li
cfb52117fc reset 回滚错误修改 屏蔽 fastjson 等依赖之后 会导致运行期间报错找不到类问题 2022-12-23 14:51:38 +08:00
疯狂的狮子li
72cdaf88b3 update seata 1.6.0 => 1.6.1 2022-12-23 13:50:13 +08:00
疯狂的狮子li
e41851c46a update springboot 2.7.6 => 2.7.7
update easyexcel 3.1.3 => 3.1.4
2022-12-23 13:30:46 +08:00
疯狂的狮子li
a28741984b update 优化 springdoc 配置鉴权头写死问题 增加持久化鉴权头配置 2022-12-22 18:29:05 +08:00
疯狂的狮子li
dbf79140ff update 优化 依赖项整理 抽取公共版本号 删除无用依赖管理 2022-12-22 14:34:11 +08:00
疯狂的狮子li
511afb77cf update 优化 私有化 sentinel 依赖传递 包含 fastjson 2022-12-22 14:04:12 +08:00
疯狂的狮子li
98fe53788a update 优化 私有化 dubbo 依赖传递 包含 fastjson fastjson2 gson 2022-12-22 14:01:49 +08:00
疯狂的狮子li
e09265c69d update 优化 私有化 seata 依赖传递 包含 guava druid fastjson 2022-12-22 13:56:50 +08:00
疯狂的狮子li
a44ee2b6eb update 优化 actuator 依赖整合到 common-web 模块 2022-12-22 13:46:53 +08:00
疯狂的狮子li
fdf0461508 update 优化 剔除项目内存在的log4j依赖 2022-12-22 13:41:31 +08:00
疯狂的狮子li
fa3b9e78dd update 优化 剔除无用依赖 2022-12-22 12:33:44 +08:00
疯狂的狮子Li
8030d1bd62 fix 修复 根据key更新参数配置报null问题 2022-12-21 21:34:29 +08:00
疯狂的狮子li
8503c44602 update 优化 验证码结果使用spel引擎自动计算 2022-12-21 10:42:29 +08:00
疯狂的狮子li
96984de06d add 增加 RedisUtils 检查缓存对象是否存在方法 2022-12-20 10:34:55 +08:00
疯狂的狮子li
fe173124d5 update springdoc 1.6.13 => 1.6.14
update snakeyaml 1.32 => 1.33
update springboot-admin 2.7.7 => 2.7.9
2022-12-19 14:40:55 +08:00
疯狂的狮子li
9adaae3e6e update redisson 3.18.0 => 3.19.0 2022-12-19 14:29:46 +08:00
疯狂的狮子li
78985f076b update nacos 2.1.2 => 2.2.0 适配升级 2022-12-19 14:19:42 +08:00
疯狂的狮子li
efc4bf5a0a update seata 1.5.2 => 1.6.0 适配升级 2022-12-19 14:15:47 +08:00
疯狂的狮子Li
0bb385f6cf update 优化 数据权限处理器 变量命名错误 2022-12-15 14:55:52 +08:00
疯狂的狮子Li
484fdba353 update 优化 去除无用继承 2022-12-15 14:54:44 +08:00
疯狂的狮子Li
4f5523a878 fix 修复 用户注册 用户类型字段书写错误 2022-12-14 17:11:10 +08:00
疯狂的狮子Li
0bf8156714 update 同步 ruoyi 相关提交
* update 优化 弹窗内容过多展示不全问题
* update echarts 4.9.0 => 5.4.0
* fix 修复 Vue3树形下拉不能默认选中
* update 优化 删除fuse无效选项maxPatternLength
* fix 修复 代码生成图片/文件/单选时选择必填无法校验问题
* fix 修复 修改参数键名时 未移除过期缓存配置
2022-12-14 14:53:20 +08:00
疯狂的狮子Li
2c6c618814 !66 fix:修复Minio安装警告,升级新版用户设置
Merge pull request !66 from Bleachtred/dev
2022-12-14 06:26:48 +00:00
bleachtred
b0e0a20b8c fix:修复Minio安装失败问题,升级新版用户设置 2022-12-13 16:40:02 +08:00
疯狂的狮子li
f5378e9296 update 更改 redeme 去除分布式数据同步组件说明 暂时没有好的解决方案 2022-12-09 13:50:50 +08:00
疯狂的狮子li
4092013da5 update 优化 使用spring事件发布机制 重构登录日志与操作日志 2022-12-08 09:49:39 +08:00
疯狂的狮子li
fd83d6bc0a update 优化 使用 spring 事件机制 重构 OssConfig 缓存更新 2022-12-07 19:17:26 +08:00
疯狂的狮子li
8cf3ead26c update 优化 单元格合并判断cellValue是否相等方法 2022-12-06 11:33:32 +08:00
疯狂的狮子li
70a94f378f update 优化 调整gateway拦截器执行顺序 优先处理xss过滤 然后进行缓存处理 2022-12-06 09:36:07 +08:00
疯狂的狮子li
2a5a73658d fix 修复 内网鉴权Filter 优先级问题 导致websocket连接失败 2022-12-05 15:17:16 +08:00
231 changed files with 5797 additions and 2108 deletions

View File

@@ -1,16 +1,49 @@
### 使用版本(未按照模板填写直接删除)
- jdk版本(带上尾号): 例如 1.8.0_202
- 框架版本(项目启动时输出的版本号): 例如 4.4.0
- 其他依赖版本(你觉得有必要的):
### 问题前提
> 功能不好用 不会用 是否已经看过项目文档
> 项目运行报错 是否已经拿着报错信息去百度 常见报错百度百度足以
> 是否搜索过其他issue 一些已经解决的问题 会在issue内留下解决方法
> 无法线上解决或者与框架无关的问题的欢迎加VIP群跟作者一对一谈
### 异常模块
> 此报错都涉及到那些系统模块
例如 ruoyi-system ruoyi-auth 等等
### 问题描述
> 越详细越容易直击问题所在
已知: XXX功能不好用 或 XXX数据不正常 等等
### 希望结果
> 想知道你觉得怎么样是正常或者合理的
希望功能可以有XXX结果 或者 XXX现象
### 重现步骤
> 作者并不知道这个问题是如何出现的
### 报错信息(截图为主 请勿发混乱格式)
- 1
- 2
- 3
### 相关代码与报错信息(请勿发混乱格式)
> 代码可按照如下形式提供或者截图均可 越详细越好
> 大多数问题都是 代码编写错误问题 逻辑问题 或者用法错误等问题
```java
public class XXX {
}
```

View File

@@ -1,7 +1,7 @@
### 更改目的 解决了什么问题(请提交到dev分支)
### 描述 做了哪些改动
### 改动逻辑 这么写的思路(让作者更好的理解你的意图)
### 测试 都做了哪些测试(未经过测试不采纳)

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-auth" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-auth:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-auth:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-auth/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-gateway" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-gateway:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-gateway:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-gateway/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-gen" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-gen:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-gen:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-modules/ruoyi-gen/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-job" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-job:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-job:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-modules/ruoyi-job/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-monitor" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-monitor:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-monitor:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-visual/ruoyi-monitor/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-nacos" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-nacos:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-nacos:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-visual/ruoyi-nacos/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-resource" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-resource:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-resource:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-modules/ruoyi-resource/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-seata-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-seata-server:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-seata-server:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-visual/ruoyi-seata-server/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-sentinel-dashboard" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-sentinel-dashboard:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-sentinel-dashboard:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-visual/ruoyi-sentinel-dashboard/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-system" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-system:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-system:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-modules/ruoyi-system/Dockerfile" />
</settings>

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-xxl-job-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-xxl-job-admin:1.4.0" />
<option name="imageTag" value="ruoyi/ruoyi-xxl-job-admin:1.5.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-visual/ruoyi-xxl-job-admin/Dockerfile" />
</settings>

102
README.md
View File

@@ -5,7 +5,7 @@
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus/blob/master/LICENSE)
[![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-提供支持-blue.svg)](https://www.jetbrains.com/?from=RuoYi-Cloud-Plus)
<br>
[![RuoYi-Cloud-Plus](https://img.shields.io/badge/RuoYi_Cloud_Plus-1.4.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus)
[![RuoYi-Cloud-Plus](https://img.shields.io/badge/RuoYi_Cloud_Plus-1.5.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus)
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.7-blue.svg)]()
[![JDK-8+](https://img.shields.io/badge/JDK-8-green.svg)]()
[![JDK-11](https://img.shields.io/badge/JDK-11-green.svg)]()
@@ -17,57 +17,55 @@
> 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4836388&doc_id=1469725) 分布式集群版本(功能一致)
| 功能介绍 | 使用技术 | 文档地址 | 特性注意事项 |
|--------------|--------------------------|----------------------------------------------------------------------------------------------------|-----------------------------------|
| 微服务权限管理系统 | RuoYi-Cloud-Plus | [RuoYi-Cloud-Plus官网](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus) | 重写 RuoYi-Cloud 全方位升级(不兼容原框架) |
| 分布式集群分支 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus官网](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) | 重写 RuoYi-Vue (不兼容原框架) |
| Vue3分支 | RuoYi-Cloud-Plus-UI | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus-UI) | 由于组件还未完善 仅供学习 |
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
| 微服务开发框架 | SpringCloud | [SpringCloud官网](https://spring.io/projects/spring-cloud) | |
| 微服务开发框架 | SpringCloudAlibaba | [SpringCloudAlibaba官网](https://spring.io/projects/spring-cloud-alibaba) | |
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 XNIO 的高性能容器 |
| 权限认证框架 | Sa-Token、Jwt | [Sa-Token官网](https://sa-token.dev33.cn/) | 强解耦、强扩展 |
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
| 关系数据库(未完成) | Oracle | [Oracle官网](https://www.oracle.com/cn/database/) | 适配 12c |
| 关系数据库(未完成) | PostgreSQL | [PostgreSQL官网](https://www.postgresql.org/) | 适配 14 |
| 关系数据库(未完成) | SQLServer | [SQLServer官网](https://docs.microsoft.com/zh-cn/sql/sql-server) | 适配 2019 |
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 5.X |
| 分布式注册中心 | Alibaba Nacos | [Alibaba Nacos文档](https://nacos.io/zh-cn/docs/quick-start.html) | 采用2.X 基于GRPC通信高性能 |
| 分布式配置中心 | Alibaba Nacos | [Alibaba Nacos文档](https://nacos.io/zh-cn/docs/quick-start.html) | 采用2.X 基于GRPC通信高性能 |
| 服务网关 | SpringCloud Gateway | [SpringCloud Gateway文档](https://spring.io/projects/spring-cloud-gateway) | 响应式高性能网关 |
| 负载均衡 | SpringCloud Loadbalancer | [SpringCloud Loadbalancer文档](https://spring.io/guides/gs/spring-cloud-loadbalancer/) | 负载均衡处理 |
| RPC远程调用 | Apache Dubbo | [Apache Dubbo官网](https://dubbo.apache.org/zh/) | 原生态使用体验、高性能 |
| 分布式限流熔断 | Alibaba Sentinel | [Alibaba Sentinel文档](https://sentinelguard.io/zh-cn/) | 无侵入、高扩展 |
| 分布式事务 | Alibaba Seata | [Alibaba Seata文档](http://seata.io/zh-cn/) | 无侵入、高扩展 支持 四种模式 |
| 分布式消息队列 | SpringCloud Stream | [SpringCloud Stream文档](https://spring.io/projects/spring-cloud-stream) | 门面框架兼容各种MQ集成 |
| 分布式消息队列 | Apache Kafka | [Apache Kafka文档](https://kafka.apache.org/) | 高性能高速度 |
| 分布式消息队列 | Apache RocketMQ | [Apache RocketMQ文档](http://rocketmq.apache.org/) | 高可用功能多样 |
| 分布式消息队列 | RabbitMQ | [RabbitMQ文档](https://www.rabbitmq.com/) | 支持各种扩展插件功能多样性 |
| 分布式搜索引擎 | ElasticSearch、Easy-Es | [Easy-Es官网](https://www.easy-es.cn/) | 以 Mybatis-Plus 方式操作 ElasticSearch |
| 分布式数据同步(未完成) | Alibaba Canal | [Alibaba Canal官网](https://github.com/alibaba/canal/wiki) | 采集数据同步各种数据库 ES Redis Mysql |
| 分布式链路追踪 | Apache SkyWalking | [Apache SkyWalking文档](https://skywalking.apache.org/docs/) | 链路追踪、网格分析、度量聚合、可视化 |
| 分布式日志中心 | ELK | [ElasticSearch官网](https://www.elastic.co/cn/elasticsearch/) | ELK业界成熟解决方案 |
| 分布式锁 | Lock4j | [Lock4j官网](https://gitee.com/baomidou/lock4j) | 注解锁、工具锁 多种多样 |
| 分布式幂等 | Redisson | [Lock4j文档](https://gitee.com/baomidou/lock4j) | 拦截重复提交 |
| 分布式任务调度 | Xxl-Job | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/) | 高性能 高可靠 易扩展 |
| 分布式文件存储 | Minio | [Minio文档](https://docs.min.io/) | 本地存储 |
| 分布式云存储 | 七牛、阿里、腾讯 | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储 |
| 短信模块 | 阿里、腾讯 | [短信使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5578491&doc_id=1469725) | 短信发送 |
| 分布式监控 | Prometheus、Grafana | [Prometheus文档](https://prometheus.io/docs/introduction/overview/) | 全方位性能监控 |
| 服务监控 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 |
| 数据框架 | Mybatis-Plus | [Mybatis-Plus文档](https://baomidou.com/guide/) | 快速 CRUD 增加开发效率 |
| 数据库框架 | P6spy | [p6spy官网](https://p6spy.readthedocs.io/) | 更强劲的 SQL 分析 |
| 多数据源框架 | Dynamic-Datasource | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content) | 支持主从与多种类数据库异构 |
| 序列化框架 | Jackson | [Jackson官网](https://github.com/FasterXML/jackson) | 统一使用 jackson 高效可靠 |
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
| 校验框架 | 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) | 性能优异 扩展性强 |
| 文档框架 | SpringDoc、javadoc | [接口文档](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus/wikis/pages?sort_id=5877829&doc_id=2056143) | 无注解零入侵基于java注释 |
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
| 代码生成器 | 适配MP、SpringDoc规范化代码 | [代码生成文档](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus/wikis/pages?sort_id=5522467&doc_id=2056143) | 一键生成前后端代码 |
| 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
| 国际化 | SpringMessage | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc) | Spring标准国际化方案 |
| 功能介绍 | 使用技术 | 文档地址 | 特性注意事项 |
|-----------|--------------------------|----------------------------------------------------------------------------------------------------|-----------------------------------|
| 微服务权限管理系统 | RuoYi-Cloud-Plus | [RuoYi-Cloud-Plus官网](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus) | 重写 RuoYi-Cloud 全方位升级(不兼容原框架) |
| 分布式集群分支 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus官网](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) | 重写 RuoYi-Vue (不兼容原框架) |
| Vue3分支 | RuoYi-Cloud-Plus-UI | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus-UI) | 由于组件还未完善 仅供学习 |
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
| 微服务开发框架 | SpringCloud | [SpringCloud官网](https://spring.io/projects/spring-cloud) | |
| 微服务开发框架 | SpringCloudAlibaba | [SpringCloudAlibaba官网](https://spring.io/projects/spring-cloud-alibaba) | |
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 XNIO 的高性能容器 |
| 权限认证框架 | Sa-Token、Jwt | [Sa-Token官网](https://sa-token.dev33.cn/) | 强解耦、强扩展 |
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
| 关系数据库 | Oracle | [Oracle官网](https://www.oracle.com/cn/database/) | 适配 12c |
| 关系数据库 | PostgreSQL | [PostgreSQL官网](https://www.postgresql.org/) | 适配 14 |
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 5.X |
| 分布式注册中心 | Alibaba Nacos | [Alibaba Nacos文档](https://nacos.io/zh-cn/docs/quick-start.html) | 采用2.X 基于GRPC通信高性能 |
| 分布式配置中心 | Alibaba Nacos | [Alibaba Nacos文档](https://nacos.io/zh-cn/docs/quick-start.html) | 采用2.X 基于GRPC通信高性能 |
| 服务网关 | SpringCloud Gateway | [SpringCloud Gateway文档](https://spring.io/projects/spring-cloud-gateway) | 响应式高性能网关 |
| 负载均衡 | SpringCloud Loadbalancer | [SpringCloud Loadbalancer文档](https://spring.io/guides/gs/spring-cloud-loadbalancer/) | 负载均衡处理 |
| RPC远程调用 | Apache Dubbo | [Apache Dubbo官网](https://dubbo.apache.org/zh/) | 原生态使用体验、高性能 |
| 分布式限流熔断 | Alibaba Sentinel | [Alibaba Sentinel文档](https://sentinelguard.io/zh-cn/) | 无侵入、高扩展 |
| 分布式事务 | Alibaba Seata | [Alibaba Seata文档](http://seata.io/zh-cn/) | 无侵入、高扩展 支持 四种模式 |
| 分布式消息队列 | SpringCloud Stream | [SpringCloud Stream文档](https://spring.io/projects/spring-cloud-stream) | 门面框架兼容各种MQ集成 |
| 分布式消息队列 | Apache Kafka | [Apache Kafka文档](https://kafka.apache.org/) | 高性能高速度 |
| 分布式消息队列 | Apache RocketMQ | [Apache RocketMQ文档](http://rocketmq.apache.org/) | 高可用功能多样 |
| 分布式消息队列 | RabbitMQ | [RabbitMQ文档](https://www.rabbitmq.com/) | 支持各种扩展插件功能多样性 |
| 分布式搜索引擎 | ElasticSearch、Easy-Es | [Easy-Es官网](https://www.easy-es.cn/) | 以 Mybatis-Plus 方式操作 ElasticSearch |
| 分布式链路追踪 | Apache SkyWalking | [Apache SkyWalking文档](https://skywalking.apache.org/docs/) | 链路追踪、网格分析、度量聚合、可视化 |
| 分布式日志中心 | ELK | [ElasticSearch官网](https://www.elastic.co/cn/elasticsearch/) | ELK业界成熟解决方案 |
| 分布式 | Lock4j | [Lock4j官网](https://gitee.com/baomidou/lock4j) | 注解锁、工具锁 多种多样 |
| 分布式幂等 | Redisson | [Lock4j文档](https://gitee.com/baomidou/lock4j) | 拦截重复提交 |
| 分布式任务调度 | Xxl-Job | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/) | 高性能 高可靠 易扩展 |
| 分布式文件存储 | Minio | [Minio文档](https://docs.min.io/) | 本地存储 |
| 分布式云存储 | 七牛、阿里、腾讯 | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储 |
| 短信模块 | 阿里、腾讯 | [短信使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5578491&doc_id=1469725) | 短信发送 |
| 分布式监控 | Prometheus、Grafana | [Prometheus文档](https://prometheus.io/docs/introduction/overview/) | 全方位性能监控 |
| 服务监控 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 |
| 数据库框架 | Mybatis-Plus | [Mybatis-Plus文档](https://baomidou.com/guide/) | 快速 CRUD 增加开发效率 |
| 数据库框架 | P6spy | [p6spy官网](https://p6spy.readthedocs.io/) | 更强劲的 SQL 分析 |
| 数据框架 | Dynamic-Datasource | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content) | 支持主从与多种类数据库异构 |
| 序列化框架 | Jackson | [Jackson官网](https://github.com/FasterXML/jackson) | 统一使用 jackson 高效可靠 |
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
| 校验框架 | 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) | 性能优异 扩展性强 |
| 文档框架 | SpringDoc、javadoc | [接口文档](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus/wikis/pages?sort_id=5877829&doc_id=2056143) | 无注解零入侵基于java注释 |
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
| 代码生成器 | 适配MP、SpringDoc规范化代码 | [代码生成文档](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus/wikis/pages?sort_id=5522467&doc_id=2056143) | 一键生成前后端代码 |
| 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
| 国际化 | SpringMessage | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc) | Spring标准国际化方案 |
## 参考文档

View File

@@ -74,6 +74,9 @@ spring:
max-request-size: 20MB
# 上传单个文件大小限制
max-file-size: 10MB
mvc:
format:
date-time: yyyy-MM-dd HH:mm:ss
#jackson配置
jackson:
# 日期格式化
@@ -255,6 +258,11 @@ swagger:
service-mapping:
ruoyi-gen: /code
springdoc:
swagger-ui:
# 持久化认证数据
persistAuthorization: true
# seata配置
seata:
# 默认关闭如需启用spring.datasource.dynami.seata需要同时开启

View File

@@ -13,6 +13,14 @@ datasource:
url: jdbc:mysql://localhost:3306/ry-job?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: root
password: password
# system-oracle:
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: password
# system-postgres:
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: password
spring:
datasource:

View File

@@ -97,4 +97,4 @@ spring:
groupId: ${spring.cloud.nacos.config.group}
namespace: ${spring.profiles.active}
data-type: json
rule-type: flow
rule-type: gw-flow

View File

@@ -11,14 +11,20 @@ spring:
url: ${datasource.system-master.url}
username: ${datasource.system-master.username}
password: ${datasource.system-master.password}
# 从库数据源
#slave:
# lazy: true
# type: ${spring.datasource.type}
# driver-class-name:
# url:
# username:
# password:
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: ${datasource.system-oracle.url}
# username: ${datasource.system-oracle.username}
# password: ${datasource.system-oracle.password}
# hikari:
# connectionTestQuery: SELECT 1 FROM DUAL
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: ${datasource.system-postgres.url}
# username: ${datasource.system-postgres.username}
# password: ${datasource.system-postgres.password}
# 代码生成
gen:

View File

@@ -11,6 +11,20 @@ spring:
url: ${datasource.system-master.url}
username: ${datasource.system-master.username}
password: ${datasource.system-master.password}
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: ${datasource.system-oracle.url}
# username: ${datasource.system-oracle.username}
# password: ${datasource.system-oracle.password}
# hikari:
# connectionTestQuery: SELECT 1 FROM DUAL
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: ${datasource.system-postgres.url}
# username: ${datasource.system-postgres.username}
# password: ${datasource.system-postgres.password}
mail:
enabled: false

View File

@@ -11,10 +11,17 @@ spring:
url: ${datasource.system-master.url}
username: ${datasource.system-master.username}
password: ${datasource.system-master.password}
# 从库数据源
# slave:
# type: ${spring.datasource.type}
# driver-class-name:
# url:
# username:
# password:
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: ${datasource.system-oracle.url}
# username: ${datasource.system-oracle.username}
# password: ${datasource.system-oracle.password}
# hikari:
# connectionTestQuery: SELECT 1 FROM DUAL
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: ${datasource.system-postgres.url}
# username: ${datasource.system-postgres.username}
# password: ${datasource.system-postgres.password}

45
docker/database.yml Normal file
View File

@@ -0,0 +1,45 @@
version: '3'
services:
# 此镜像仅用于测试 正式环境需自行安装数据库
# SID: XE user: system password: oracle
oracle:
image: tekintian/oracle12c:latest
container_name: oracle
environment:
# 时区上海
TZ: Asia/Shanghai
DBCA_TOTAL_MEMORY: 16192
ports:
- "18080:8080"
- "1521:1521"
volumes:
# 数据挂载
- "/docker/oracle/data:/u01/app/oracle"
network_mode: "host"
postgres:
image: postgres:14.2
container_name: postgres
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: postgres
ports:
- "5432:5432"
volumes:
- /docker/postgres/data:/var/lib/postgresql/data
network_mode: "host"
postgres13:
image: postgres:13.6
container_name: postgres13
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: postgres
ports:
- "5433:5432"
volumes:
- /docker/postgres13/data:/var/lib/postgresql/data
network_mode: "host"

View File

@@ -29,7 +29,7 @@ services:
network_mode: "host"
nacos:
image: ruoyi/ruoyi-nacos:1.4.0
image: ruoyi/ruoyi-nacos:1.5.0
container_name: nacos
ports:
- "8848:8848"
@@ -74,9 +74,9 @@ services:
# 时区上海
TZ: Asia/Shanghai
# 管理后台用户名
MINIO_ACCESS_KEY: ruoyi
MINIO_ROOT_USER: ruoyi
# 管理后台密码最小8个字符
MINIO_SECRET_KEY: ruoyi123
MINIO_ROOT_PASSWORD: ruoyi123
# https需要指定域名
#MINIO_SERVER_URL: "https://xxx.com:9000"
#MINIO_BROWSER_REDIRECT_URL: "https://xxx.com:9001"
@@ -96,7 +96,7 @@ services:
network_mode: "host"
seata-server:
image: ruoyi/ruoyi-seata-server:1.4.0
image: ruoyi/ruoyi-seata-server:1.5.0
container_name: seata-server
ports:
- "7091:7091"
@@ -135,7 +135,7 @@ services:
network_mode: "host"
sentinel:
image: ruoyi/ruoyi-sentinel-dashboard:1.4.0
image: ruoyi/ruoyi-sentinel-dashboard:1.5.0
container_name: sentinel
environment:
TZ: Asia/Shanghai
@@ -150,7 +150,7 @@ services:
network_mode: "host"
ruoyi-monitor:
image: ruoyi/ruoyi-monitor:1.4.0
image: ruoyi/ruoyi-monitor:1.5.0
container_name: ruoyi-monitor
environment:
# 时区上海
@@ -166,7 +166,7 @@ services:
network_mode: "host"
ruoyi-xxl-job-admin:
image: ruoyi/ruoyi-xxl-job-admin:1.4.0
image: ruoyi/ruoyi-xxl-job-admin:1.5.0
container_name: ruoyi-xxl-job-admin
environment:
# 时区上海
@@ -182,7 +182,7 @@ services:
network_mode: "host"
ruoyi-gateway:
image: ruoyi/ruoyi-gateway:1.4.0
image: ruoyi/ruoyi-gateway:1.5.0
container_name: ruoyi-gateway
environment:
# 时区上海
@@ -198,7 +198,7 @@ services:
network_mode: "host"
ruoyi-auth:
image: ruoyi/ruoyi-auth:1.4.0
image: ruoyi/ruoyi-auth:1.5.0
container_name: ruoyi-auth
environment:
# 时区上海
@@ -214,7 +214,7 @@ services:
network_mode: "host"
ruoyi-system:
image: ruoyi/ruoyi-system:1.4.0
image: ruoyi/ruoyi-system:1.5.0
container_name: ruoyi-system
environment:
# 时区上海
@@ -230,7 +230,7 @@ services:
network_mode: "host"
ruoyi-gen:
image: ruoyi/ruoyi-gen:1.4.0
image: ruoyi/ruoyi-gen:1.5.0
container_name: ruoyi-gen
environment:
# 时区上海
@@ -246,7 +246,7 @@ services:
network_mode: "host"
ruoyi-job:
image: ruoyi/ruoyi-job:1.4.0
image: ruoyi/ruoyi-job:1.5.0
container_name: ruoyi-job
environment:
# 时区上海
@@ -262,7 +262,7 @@ services:
network_mode: "host"
ruoyi-resource:
image: ruoyi/ruoyi-resource:1.4.0
image: ruoyi/ruoyi-resource:1.5.0
container_name: ruoyi-resource
environment:
# 时区上海

62
pom.xml
View File

@@ -6,54 +6,53 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<name>RuoYi-Cloud-Plus</name>
<url>https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus</url>
<description>RuoYi-Cloud-Plus微服务系统</description>
<properties>
<ruoyi.version>1.4.0</ruoyi.version>
<ruoyi.version>1.5.0</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.7.6</spring-boot.version>
<spring-boot.version>2.7.7</spring-boot.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
<spring-boot-admin.version>2.7.7</spring-boot-admin.version>
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
<spring-boot.mybatis>2.2.2</spring-boot.mybatis>
<mybatis.version>3.5.10</mybatis.version>
<mybatis-plus.version>3.5.2</mybatis-plus.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version>
<dynamic-ds.version>3.5.2</dynamic-ds.version>
<velocity.version>2.3</velocity.version>
<fastjson.version>1.2.83</fastjson.version>
<swagger.core.version>2.2.7</swagger.core.version>
<springdoc.version>1.6.13</springdoc.version>
<springdoc.version>1.6.14</springdoc.version>
<poi.version>5.2.3</poi.version>
<easyexcel.version>3.1.3</easyexcel.version>
<hutool.version>5.8.10</hutool.version>
<redisson.version>3.18.0</redisson.version>
<easyexcel.version>3.1.5</easyexcel.version>
<hutool.version>5.8.11</hutool.version>
<redisson.version>3.19.1</redisson.version>
<lock4j.version>2.2.3</lock4j.version>
<xxl-job.version>2.3.1</xxl-job.version>
<satoken.version>1.33.0</satoken.version>
<satoken.version>1.34.0</satoken.version>
<lombok.version>1.18.24</lombok.version>
<logstash.version>7.1.1</logstash.version>
<easy-es.version>1.1.0</easy-es.version>
<easy-es.version>1.1.1</easy-es.version>
<elasticsearch.version>7.14.0</elasticsearch.version>
<skywalking-toolkit.version>8.13.0</skywalking-toolkit.version>
<!-- 统一 guava 版本 解决隐式漏洞问题 -->
<guava.version>31.1-jre</guava.version>
<!-- 临时修复 snakeyaml 漏洞 -->
<snakeyaml.version>1.32</snakeyaml.version>
<snakeyaml.version>1.33</snakeyaml.version>
<!-- 临时修复 fastjson 漏洞 -->
<fastjson.version>1.2.83</fastjson.version>
<!-- OSS 配置 -->
<aws-java-sdk-s3.version>1.12.349</aws-java-sdk-s3.version>
<aws-java-sdk-s3.version>1.12.373</aws-java-sdk-s3.version>
<okhttp.version>4.10.0</okhttp.version>
<!-- SMS 配置 -->
<aliyun.sms.version>2.0.22</aliyun.sms.version>
<tencent.sms.version>3.1.635</tencent.sms.version>
<aliyun.sms.version>2.0.23</aliyun.sms.version>
<tencent.sms.version>3.1.660</tencent.sms.version>
</properties>
<profiles>
@@ -243,6 +242,17 @@
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>${redisson.version}</version>
<exclusions>
<exclusion>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-30</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-27</artifactId>
<version>${redisson.version}</version>
</dependency>
<dependency>
@@ -317,13 +327,6 @@
<version>${tencent.sms.version}</version>
</dependency>
<!-- 统一 guava 版本 解决隐式漏洞问题 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<!-- 临时修复 snakeyaml 漏洞 -->
<dependency>
<groupId>org.yaml</groupId>
@@ -331,7 +334,6 @@
<version>${snakeyaml.version}</version>
</dependency>
<!-- 统一 fastjson 版本 解决alibaba组件序列化漏洞问题 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
@@ -425,8 +427,8 @@
<repositories>
<repository>
<id>public</id>
<name>huawei nexus</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public/</url>
<releases>
<enabled>true</enabled>
</releases>
@@ -436,8 +438,8 @@
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>huawei nexus</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public/</url>
<releases>
<enabled>true</enabled>
</releases>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -8,7 +8,7 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-bom</artifactId>
<packaging>pom</packaging>
<version>1.4.0</version>
<version>1.5.0</version>
<description>
ruoyi-api-bom api依赖项

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -28,12 +28,6 @@
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sentinel</artifactId>
@@ -45,6 +39,12 @@
<artifactId>ruoyi-common-security</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-doc</artifactId>

View File

@@ -15,12 +15,13 @@ import com.ruoyi.common.core.exception.user.CaptchaExpireException;
import com.ruoyi.common.core.exception.user.UserException;
import com.ruoyi.common.core.utils.MessageUtils;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.SpringUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.log.event.LogininforEvent;
import com.ruoyi.common.redis.utils.RedisUtils;
import com.ruoyi.common.satoken.utils.LoginHelper;
import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysLogininfor;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import com.ruoyi.system.api.model.XcxLoginUser;
@@ -128,7 +129,7 @@ public class SysLoginService {
* @return
*/
public void recordLogininfor(String username, String status, String message) {
SysLogininfor logininfor = new SysLogininfor();
LogininforEvent logininfor = new LogininforEvent();
logininfor.setUserName(username);
logininfor.setIpaddr(ServletUtils.getClientIP());
logininfor.setMsg(message);
@@ -138,7 +139,7 @@ public class SysLoginService {
} else if (Constants.LOGIN_FAIL.equals(status)) {
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
}
remoteLogService.saveLogininfor(logininfor);
SpringUtils.context().publishEvent(logininfor);
}
/**

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -6,7 +6,7 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-alibaba-bom</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<packaging>pom</packaging>
<description>
@@ -16,10 +16,9 @@
<properties>
<spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
<sentinel.version>1.8.6</sentinel.version>
<seata.version>1.5.2</seata.version>
<nacos.client.version>2.1.2</nacos.client.version>
<nacos.config.version>2.0.4</nacos.config.version>
<dubbo.version>3.1.3</dubbo.version>
<seata.version>1.6.1</seata.version>
<nacos.client.version>2.2.0</nacos.client.version>
<dubbo.version>3.1.4</dubbo.version>
<spring.context.support.version>1.0.11</spring.context.support.version>
</properties>
<dependencyManagement>
@@ -36,11 +35,6 @@
<artifactId>nacos-client</artifactId>
<version>${nacos.client.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-config</artifactId>
<version>${nacos.config.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>

View File

@@ -6,7 +6,7 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-bom</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<packaging>pom</packaging>
<description>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -20,7 +20,7 @@ import java.util.concurrent.*;
* @author Lion Li
*/
@Slf4j
@EnableAsync
@EnableAsync(proxyTargetClass = true)
@AutoConfiguration
public class AsyncConfig extends AsyncConfigurerSupport {

View File

@@ -12,6 +12,7 @@ import org.springframework.cglib.beans.BeanCopier;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.cglib.core.Converter;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -131,6 +132,25 @@ public class BeanCopyUtils {
return bean;
}
/**
* map拷贝到map
*
* @param map 数据来源
* @param clazz 返回的对象类型
* @return map对象
*/
public static <T, V> Map<String, V> mapToMap(Map<String, T> map, Class<V> clazz) {
if (MapUtil.isEmpty(map)) {
return null;
}
if (ObjectUtil.isNull(clazz)) {
return null;
}
Map<String, V> copyMap = new LinkedHashMap<>(map.size());
map.forEach((k, v) -> copyMap.put(k, copy(v, clazz)));
return copyMap;
}
/**
* BeanCopier属性缓存<br>
* 缓存用于防止多次反射造成的性能问题

View File

@@ -3,6 +3,7 @@ package com.ruoyi.common.core.utils;
import cn.hutool.extra.spring.SpringUtil;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
/**
* spring工具类
@@ -59,4 +60,12 @@ public final class SpringUtils extends SpringUtil {
public static <T> T getAopProxy(T invoker) {
return (T) AopContext.currentProxy();
}
/**
* 获取spring上下文
*/
public static ApplicationContext context() {
return getApplicationContext();
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -21,10 +21,7 @@ import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
/**
* Swagger 文档配置
@@ -57,8 +54,11 @@ public class SwaggerAutoConfiguration {
openApi.tags(swaggerProperties.getTags());
openApi.paths(swaggerProperties.getPaths());
openApi.components(swaggerProperties.getComponents());
Set<String> keySet = swaggerProperties.getComponents().getSecuritySchemes().keySet();
List<SecurityRequirement> list = new ArrayList<>();
list.add(new SecurityRequirement().addList("apikey"));
SecurityRequirement securityRequirement = new SecurityRequirement();
keySet.forEach(securityRequirement::addList);
list.add(securityRequirement);
openApi.security(list);
return openApi;

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -36,6 +36,21 @@
<artifactId>dubbo-spring-boot-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -86,7 +86,7 @@ public class CellMergeStrategy extends AbstractMergeStrategy {
// 空值跳过不合并
continue;
}
if (cellValue != val) {
if (!cellValue.equals(val)) {
if (i - repeatCell.getCurrent() > 1) {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum));
}

View File

@@ -24,6 +24,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.List;
@@ -84,7 +85,13 @@ public class ExcelUtil {
* @param response 响应体
*/
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, HttpServletResponse response) {
exportExcel(list, sheetName, clazz, false, response);
try {
resetResponse(sheetName, response);
ServletOutputStream os = response.getOutputStream();
exportExcel(list, sheetName, clazz, false, os);
} catch (IOException e) {
throw new RuntimeException("导出Excel异常");
}
}
/**
@@ -100,23 +107,48 @@ public class ExcelUtil {
try {
resetResponse(sheetName, response);
ServletOutputStream os = response.getOutputStream();
ExcelWriterSheetBuilder builder = EasyExcel.write(os, clazz)
.autoCloseStream(false)
// 自动适配
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
// 大数值自动转换 防止失真
.registerConverter(new ExcelBigNumberConvert())
.sheet(sheetName);
if (merge) {
// 合并处理器
builder.registerWriteHandler(new CellMergeStrategy(list, true));
}
builder.doWrite(list);
exportExcel(list, sheetName, clazz, merge, os);
} catch (IOException e) {
throw new RuntimeException("导出Excel异常");
}
}
/**
* 导出excel
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @param clazz 实体类
* @param os 输出流
*/
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, OutputStream os) {
exportExcel(list, sheetName, clazz, false, os);
}
/**
* 导出excel
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @param clazz 实体类
* @param merge 是否合并单元格
* @param os 输出流
*/
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, boolean merge, OutputStream os) {
ExcelWriterSheetBuilder builder = EasyExcel.write(os, clazz)
.autoCloseStream(false)
// 自动适配
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
// 大数值自动转换 防止失真
.registerConverter(new ExcelBigNumberConvert())
.sheet(sheetName);
if (merge) {
// 合并处理器
builder.registerWriteHandler(new CellMergeStrategy(list, true));
}
builder.doWrite(list);
}
/**
* 单表多数据模板导出 模板格式为 {.属性}
*
@@ -125,31 +157,46 @@ public class ExcelUtil {
* 例如: excel/temp.xlsx
* 重点: 模板文件必须放置到启动类对应的 resource 目录下
* @param data 模板需要的数据
* @param response 响应体
*/
public static void exportTemplate(List<Object> data, String filename, String templatePath, HttpServletResponse response) {
try {
resetResponse(filename, response);
ClassPathResource templateResource = new ClassPathResource(templatePath);
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
.withTemplate(templateResource.getStream())
.autoCloseStream(false)
// 大数值自动转换 防止失真
.registerConverter(new ExcelBigNumberConvert())
.build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
if (CollUtil.isEmpty(data)) {
throw new IllegalArgumentException("数据为空");
}
// 单表多数据导出 模板格式为 {.属性}
for (Object d : data) {
excelWriter.fill(d, writeSheet);
}
excelWriter.finish();
ServletOutputStream os = response.getOutputStream();
exportTemplate(data, templatePath, os);
} catch (IOException e) {
throw new RuntimeException("导出Excel异常");
}
}
/**
* 单表多数据模板导出 模板格式为 {.属性}
*
* @param templatePath 模板路径 resource 目录下的路径包括模板文件名
* 例如: excel/temp.xlsx
* 重点: 模板文件必须放置到启动类对应的 resource 目录下
* @param data 模板需要的数据
* @param os 输出流
*/
public static void exportTemplate(List<Object> data, String templatePath, OutputStream os) {
ClassPathResource templateResource = new ClassPathResource(templatePath);
ExcelWriter excelWriter = EasyExcel.write(os)
.withTemplate(templateResource.getStream())
.autoCloseStream(false)
// 大数值自动转换 防止失真
.registerConverter(new ExcelBigNumberConvert())
.build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
if (CollUtil.isEmpty(data)) {
throw new IllegalArgumentException("数据为空");
}
// 单表多数据导出 模板格式为 {.属性}
for (Object d : data) {
excelWriter.fill(d, writeSheet);
}
excelWriter.finish();
}
/**
* 多表多数据模板导出 模板格式为 {key.属性}
*
@@ -158,37 +205,52 @@ public class ExcelUtil {
* 例如: excel/temp.xlsx
* 重点: 模板文件必须放置到启动类对应的 resource 目录下
* @param data 模板需要的数据
* @param response 响应体
*/
public static void exportTemplateMultiList(Map<String, Object> data, String filename, String templatePath, HttpServletResponse response) {
try {
resetResponse(filename, response);
ClassPathResource templateResource = new ClassPathResource(templatePath);
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
.withTemplate(templateResource.getStream())
.autoCloseStream(false)
// 大数值自动转换 防止失真
.registerConverter(new ExcelBigNumberConvert())
.build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
if (CollUtil.isEmpty(data)) {
throw new IllegalArgumentException("数据为空");
}
for (Map.Entry<String, Object> map : data.entrySet()) {
// 设置列表后续还有数据
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
if (map.getValue() instanceof Collection) {
// 多表导出必须使用 FillWrapper
excelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);
} else {
excelWriter.fill(map.getValue(), writeSheet);
}
}
excelWriter.finish();
ServletOutputStream os = response.getOutputStream();
exportTemplateMultiList(data, templatePath, os);
} catch (IOException e) {
throw new RuntimeException("导出Excel异常");
}
}
/**
* 多表多数据模板导出 模板格式为 {key.属性}
*
* @param templatePath 模板路径 resource 目录下的路径包括模板文件名
* 例如: excel/temp.xlsx
* 重点: 模板文件必须放置到启动类对应的 resource 目录下
* @param data 模板需要的数据
* @param os 输出流
*/
public static void exportTemplateMultiList(Map<String, Object> data, String templatePath, OutputStream os) {
ClassPathResource templateResource = new ClassPathResource(templatePath);
ExcelWriter excelWriter = EasyExcel.write(os)
.withTemplate(templateResource.getStream())
.autoCloseStream(false)
// 大数值自动转换 防止失真
.registerConverter(new ExcelBigNumberConvert())
.build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
if (CollUtil.isEmpty(data)) {
throw new IllegalArgumentException("数据为空");
}
for (Map.Entry<String, Object> map : data.entrySet()) {
// 设置列表后续还有数据
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
if (map.getValue() instanceof Collection) {
// 多表导出必须使用 FillWrapper
excelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);
} else {
excelWriter.fill(map.getValue(), writeSheet);
}
}
excelWriter.finish();
}
/**
* 重置响应体
*/

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,18 +5,17 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.core.utils.JsonUtils;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.SpringUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessStatus;
import com.ruoyi.common.log.service.AsyncLogService;
import com.ruoyi.common.log.event.OperLogEvent;
import com.ruoyi.common.satoken.utils.LoginHelper;
import com.ruoyi.system.api.domain.SysOperLog;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.http.HttpMethod;
import org.springframework.validation.BindingResult;
@@ -42,9 +41,6 @@ public class LogAspect {
*/
public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
@Autowired
private AsyncLogService asyncLogService;
/**
* 处理完请求后执行
*
@@ -69,7 +65,7 @@ public class LogAspect {
protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult) {
try {
// *========数据库日志=========*//
SysOperLog operLog = new SysOperLog();
OperLogEvent operLog = new OperLogEvent();
operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
// 请求的地址
operLog.setOperIp(ServletUtils.getClientIP());
@@ -91,8 +87,8 @@ public class LogAspect {
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
// 处理设置注解上的参数
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
// 保存数据库
asyncLogService.saveSysLog(operLog);
// 发布事件保存数据库
SpringUtils.context().publishEvent(operLog);
} catch (Exception exp) {
// 记录本地异常日志
log.error("异常信息:{}", exp.getMessage());
@@ -107,7 +103,7 @@ public class LogAspect {
* @param operLog 操作日志
* @throws Exception
*/
public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception {
public void getControllerMethodDescription(JoinPoint joinPoint, Log log, OperLogEvent operLog, Object jsonResult) throws Exception {
// 设置action动作
operLog.setBusinessType(log.businessType().ordinal());
// 设置标题
@@ -131,7 +127,7 @@ public class LogAspect {
* @param operLog 操作日志
* @throws Exception 异常
*/
private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception {
private void setRequestValue(JoinPoint joinPoint, OperLogEvent operLog) throws Exception {
String requestMethod = operLog.getRequestMethod();
if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) {
String params = argsArrayToString(joinPoint.getArgs());

View File

@@ -0,0 +1,40 @@
package com.ruoyi.common.log.event;
import com.ruoyi.common.core.utils.BeanCopyUtils;
import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysLogininfor;
import com.ruoyi.system.api.domain.SysOperLog;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
/**
* 异步调用日志服务
*
* @author ruoyi
*/
@Component
public class LogEventListener {
@DubboReference
private RemoteLogService remoteLogService;
/**
* 保存系统日志记录
*/
@Async
@EventListener
public void saveLog(OperLogEvent operLogEvent) {
SysOperLog sysOperLog = BeanCopyUtils.copy(operLogEvent, SysOperLog.class);
remoteLogService.saveLog(sysOperLog);
}
@Async
@EventListener
public void saveLogininfor(LogininforEvent logininforEvent) {
SysLogininfor sysLogininfor = BeanCopyUtils.copy(logininforEvent, SysLogininfor.class);
remoteLogService.saveLogininfor(sysLogininfor);
}
}

View File

@@ -0,0 +1,38 @@
package com.ruoyi.common.log.event;
import lombok.Data;
import java.io.Serializable;
/**
* 登录事件
*
* @author Lion Li
*/
@Data
public class LogininforEvent implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户账号
*/
private String userName;
/**
* 登录状态 0成功 1失败
*/
private String status;
/**
* ip地址
*/
private String ipaddr;
/**
* 提示消息
*/
private String msg;
}

View File

@@ -0,0 +1,104 @@
package com.ruoyi.common.log.event;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 操作日志事件
*
* @author Lion Li
*/
@Data
public class OperLogEvent 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;
}

View File

@@ -1,27 +0,0 @@
package com.ruoyi.common.log.service;
import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysOperLog;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
/**
* 异步调用日志服务
*
* @author ruoyi
*/
@Service
public class AsyncLogService {
@DubboReference
private RemoteLogService remoteLogService;
/**
* 保存系统日志记录
*/
@Async
public void saveSysLog(SysOperLog sysOperLog) {
remoteLogService.saveLog(sysOperLog);
}
}

View File

@@ -1,2 +1,2 @@
com.ruoyi.common.log.service.AsyncLogService
com.ruoyi.common.log.event.LogEventListener
com.ruoyi.common.log.aspect.LogAspect

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -50,6 +50,21 @@
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- Oracle -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
</dependency>
<!-- PostgreSql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- SqlServer -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -4,16 +4,12 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.ruoyi.common.core.utils.BeanCopyUtils;
import org.apache.ibatis.binding.MapperMethod;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
@@ -21,7 +17,6 @@ import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 自定义 Mapper 接口, 实现 自定义扩展
@@ -37,8 +32,6 @@ public interface BaseMapperPlus<M, T, V> extends BaseMapper<T> {
Log log = LogFactory.getLog(BaseMapperPlus.class);
int DEFAULT_BATCH_SIZE = 1000;
default Class<V> currentVoClass() {
return (Class<V>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseMapperPlus.class, 2);
}
@@ -59,79 +52,49 @@ public interface BaseMapperPlus<M, T, V> extends BaseMapper<T> {
* 批量插入
*/
default boolean insertBatch(Collection<T> entityList) {
return insertBatch(entityList, DEFAULT_BATCH_SIZE);
return Db.saveBatch(entityList);
}
/**
* 批量更新
*/
default boolean updateBatchById(Collection<T> entityList) {
return updateBatchById(entityList, DEFAULT_BATCH_SIZE);
return Db.updateBatchById(entityList);
}
/**
* 批量插入或更新
*/
default boolean insertOrUpdateBatch(Collection<T> entityList) {
return insertOrUpdateBatch(entityList, DEFAULT_BATCH_SIZE);
return Db.saveOrUpdateBatch(entityList);
}
/**
* 批量插入(包含限制条数)
*/
default boolean insertBatch(Collection<T> entityList, int batchSize) {
String sqlStatement = SqlHelper.getSqlStatement(this.currentMapperClass(), SqlMethod.INSERT_ONE);
return SqlHelper.executeBatch(this.currentModelClass(), log, entityList, batchSize,
(sqlSession, entity) -> sqlSession.insert(sqlStatement, entity));
return Db.saveBatch(entityList, batchSize);
}
/**
* 批量更新(包含限制条数)
*/
default boolean updateBatchById(Collection<T> entityList, int batchSize) {
String sqlStatement = SqlHelper.getSqlStatement(this.currentMapperClass(), SqlMethod.UPDATE_BY_ID);
return SqlHelper.executeBatch(this.currentModelClass(), log, entityList, batchSize,
(sqlSession, entity) -> {
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
param.put(Constants.ENTITY, entity);
sqlSession.update(sqlStatement, param);
});
return Db.updateBatchById(entityList, batchSize);
}
/**
* 批量插入或更新(包含限制条数)
*/
default boolean insertOrUpdateBatch(Collection<T> entityList, int batchSize) {
TableInfo tableInfo = TableInfoHelper.getTableInfo(this.currentModelClass());
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
return SqlHelper.saveOrUpdateBatch(this.currentModelClass(), this.currentMapperClass(), log, entityList, batchSize, (sqlSession, entity) -> {
Object idVal = tableInfo.getPropertyValue(entity, keyProperty);
String sqlStatement = SqlHelper.getSqlStatement(this.currentMapperClass(), SqlMethod.SELECT_BY_ID);
return StringUtils.checkValNull(idVal)
|| CollectionUtils.isEmpty(sqlSession.selectList(sqlStatement, entity));
}, (sqlSession, entity) -> {
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
param.put(Constants.ENTITY, entity);
String sqlStatement = SqlHelper.getSqlStatement(this.currentMapperClass(), SqlMethod.UPDATE_BY_ID);
sqlSession.update(sqlStatement, param);
});
return Db.saveOrUpdateBatch(entityList, batchSize);
}
/**
* 插入或更新(包含限制条数)
*/
default boolean insertOrUpdate(T entity) {
if (null != entity) {
TableInfo tableInfo = TableInfoHelper.getTableInfo(this.currentModelClass());
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
Object idVal = tableInfo.getPropertyValue(entity, tableInfo.getKeyProperty());
return StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal)) ? insert(entity) > 0 : updateById(entity) > 0;
}
return false;
return Db.saveOrUpdate(entity);
}
default V selectVoById(Serializable id) {

View File

@@ -0,0 +1,49 @@
package com.ruoyi.common.mybatis.enums;
import com.ruoyi.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 数据库类型
*
* @author Lion Li
*/
@Getter
@AllArgsConstructor
public enum DataBaseType {
/**
* MySQL
*/
MY_SQL("MySQL"),
/**
* Oracle
*/
ORACLE("Oracle"),
/**
* PostgreSQL
*/
POSTGRE_SQL("PostgreSQL"),
/**
* SQL Server
*/
SQL_SERVER("Microsoft SQL Server");
private final String type;
public static DataBaseType find(String databaseProductName) {
if (StringUtils.isBlank(databaseProductName)) {
return null;
}
for (DataBaseType type : values()) {
if (type.getType().equals(databaseProductName)) {
return type;
}
}
return null;
}
}

View File

@@ -54,7 +54,7 @@ public class PlusDataPermissionHandler {
/**
* 无效注解方法缓存用于快速返回
*/
private final Set<String> inavlidCacheSet = new ConcurrentHashSet<>();
private final Set<String> invalidCacheSet = new ConcurrentHashSet<>();
/**
* spel 解析器
@@ -70,7 +70,7 @@ public class PlusDataPermissionHandler {
public Expression getSqlSegment(Expression where, String mappedStatementId, boolean isSelect) {
DataColumn[] dataColumns = findAnnotation(mappedStatementId);
if (ArrayUtil.isEmpty(dataColumns)) {
inavlidCacheSet.add(mappedStatementId);
invalidCacheSet.add(mappedStatementId);
return where;
}
LoginUser currentUser = DataPermissionHelper.getVariable("user");
@@ -194,6 +194,6 @@ public class PlusDataPermissionHandler {
* 是否为无效方法 无数据权限
*/
public boolean isInvalid(String mappedStatementId) {
return inavlidCacheSet.contains(mappedStatementId);
return invalidCacheSet.contains(mappedStatementId);
}
}

View File

@@ -0,0 +1,72 @@
package com.ruoyi.common.mybatis.helper;
import cn.hutool.core.convert.Convert;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.SpringUtils;
import com.ruoyi.common.mybatis.enums.DataBaseType;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
/**
* 数据库助手
*
* @author Lion Li
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DataBaseHelper {
private static final DynamicRoutingDataSource DS = SpringUtils.getBean(DynamicRoutingDataSource.class);
/**
* 获取当前数据库类型
*/
public static DataBaseType getDataBaseType() {
DataSource dataSource = DS.determineDataSource();
try (Connection conn = dataSource.getConnection()) {
DatabaseMetaData metaData = conn.getMetaData();
String databaseProductName = metaData.getDatabaseProductName();
return DataBaseType.find(databaseProductName);
} catch (SQLException e) {
throw new ServiceException(e.getMessage());
}
}
public static boolean isMySql() {
return DataBaseType.MY_SQL == getDataBaseType();
}
public static boolean isOracle() {
return DataBaseType.ORACLE == getDataBaseType();
}
public static boolean isPostgerSql() {
return DataBaseType.POSTGRE_SQL == getDataBaseType();
}
public static boolean isSqlServer() {
return DataBaseType.SQL_SERVER == getDataBaseType();
}
public static String findInSet(Object var1, String var2) {
DataBaseType dataBasyType = getDataBaseType();
String var = Convert.toStr(var1);
if (dataBasyType == DataBaseType.SQL_SERVER) {
// charindex(',100,' , ',0,100,101,') <> 0
return "charindex('," + var + ",' , ','+" + var2 + "+',') <> 0";
} else if (dataBasyType == DataBaseType.POSTGRE_SQL) {
// (select position(',100,' in ',0,100,101,')) <> 0
return "(select position('," + var + ",' in ','||" + var2 + "||',')) <> 0";
} else if (dataBasyType == DataBaseType.ORACLE) {
// instr(',0,100,101,' , ',100,') <> 0
return "instr(','||" + var2 + "||',' , '," + var + ",') <> 0";
}
// find_in_set(100 , '0,100,101')
return "find_in_set(" + var + " , " + var2 + ") <> 0";
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -22,18 +22,17 @@
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- SpringBoot Boot Redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--redisson-->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-27</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>

View File

@@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
@@ -25,7 +24,7 @@ import org.springframework.context.annotation.Bean;
@AutoConfiguration
@EnableCaching
@EnableConfigurationProperties(RedissonProperties.class)
public class RedisConfiguration extends CachingConfigurerSupport {
public class RedisConfiguration {
@Autowired
private RedissonProperties redissonProperties;

View File

@@ -4,7 +4,6 @@ import com.ruoyi.common.core.utils.SpringUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.redisson.api.*;
import org.redisson.config.Config;
import java.time.Duration;
import java.util.Collection;
@@ -27,14 +26,6 @@ public class RedisUtils {
private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class);
public static NameMapper getNameMapper() {
Config config = CLIENT.getConfig();
if (config.isClusterConfig()) {
return config.useClusterServers().getNameMapper();
}
return config.useSingleServer().getNameMapper();
}
/**
* 限流
*
@@ -218,6 +209,15 @@ public class RedisUtils {
batch.execute();
}
/**
* 检查缓存对象是否存在
*
* @param key 缓存的键值
*/
public static boolean isExistsObject(final String key) {
return CLIENT.getBucket(key).isExists();
}
/**
* 缓存List数据
*
@@ -437,8 +437,8 @@ public class RedisUtils {
* @return 对象列表
*/
public static Collection<String> keys(final String pattern) {
Stream<String> stream = CLIENT.getKeys().getKeysStreamByPattern(getNameMapper().map(pattern));
return stream.map(key -> getNameMapper().unmap(key)).collect(Collectors.toList());
Stream<String> stream = CLIENT.getKeys().getKeysStreamByPattern(pattern);
return stream.collect(Collectors.toList());
}
/**
@@ -447,7 +447,7 @@ public class RedisUtils {
* @param pattern 字符串前缀
*/
public static void deleteKeys(final String pattern) {
CLIENT.getKeys().deleteByPattern(getNameMapper().map(pattern));
CLIENT.getKeys().deleteByPattern(pattern);
}
/**
@@ -457,7 +457,7 @@ public class RedisUtils {
*/
public static Boolean hasKey(String key) {
RKeys rKeys = CLIENT.getKeys();
return rKeys.countExists(getNameMapper().map(key)) > 0;
return rKeys.countExists(key) > 0;
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -81,12 +81,18 @@ public class LoginHelper {
LoginUser loginUser = getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
String loginId = StpUtil.getLoginIdAsString();
String[] strs = StringUtils.split(loginId, JOIN_CODE);
if (!ArrayUtil.containsAny(strs, UserType.values())) {
String userId = null;
for (UserType value : UserType.values()) {
if (StringUtils.contains(loginId, value.getUserType())) {
String[] strs = StringUtils.split(loginId, JOIN_CODE);
// 用户id在总是在最后
userId = strs[strs.length - 1];
}
}
if (StringUtils.isBlank(userId)) {
throw new UtilException("登录用户: LoginId异常 => " + loginId);
}
// 用户id在总是在最后
return Long.parseLong(strs[strs.length - 1]);
return Long.parseLong(userId);
}
return loginUser.getUserId();
}

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -18,16 +18,35 @@
<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<optional>true</optional>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-filter-seata</artifactId>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- SpringBoot Seata -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-filter-seata</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@@ -1,107 +0,0 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.integration.dubbo;
import io.seata.common.util.StringUtils;
import io.seata.core.constants.DubboConstants;
import io.seata.core.context.RootContext;
import io.seata.core.model.BranchType;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The type Transaction propagation filter.
*
* @author sharajava
*/
@Activate(group = {DubboConstants.PROVIDER, DubboConstants.CONSUMER}, order = 100)
public class ApacheDubboTransactionPropagationFilter implements Filter {
private static final Logger LOGGER = LoggerFactory.getLogger(ApacheDubboTransactionPropagationFilter.class);
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
String xid = RootContext.getXID();
BranchType branchType = RootContext.getBranchType();
String rpcXid = getRpcXid();
String rpcBranchType = RpcContext.getServiceContext().getAttachment(RootContext.KEY_BRANCH_TYPE);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("xid in RootContext[{}] xid in RpcContext[{}]", xid, rpcXid);
}
boolean bind = false;
if (xid != null) {
RpcContext.getServiceContext().setAttachment(RootContext.KEY_XID, xid);
RpcContext.getServiceContext().setAttachment(RootContext.KEY_BRANCH_TYPE, branchType.name());
} else {
if (rpcXid != null) {
RootContext.bind(rpcXid);
if (StringUtils.equals(BranchType.TCC.name(), rpcBranchType)) {
RootContext.bindBranchType(BranchType.TCC);
}
bind = true;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("bind xid [{}] branchType [{}] to RootContext", rpcXid, rpcBranchType);
}
}
}
try {
return invoker.invoke(invocation);
} finally {
if (bind) {
BranchType previousBranchType = RootContext.getBranchType();
String unbindXid = RootContext.unbind();
if (BranchType.TCC == previousBranchType) {
RootContext.unbindBranchType();
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("unbind xid [{}] branchType [{}] from RootContext", unbindXid, previousBranchType);
}
if (!rpcXid.equalsIgnoreCase(unbindXid)) {
LOGGER.warn("xid in change during RPC from {} to {},branchType from {} to {}", rpcXid, unbindXid,
rpcBranchType != null ? rpcBranchType : "AT", previousBranchType);
if (unbindXid != null) {
RootContext.bind(unbindXid);
LOGGER.warn("bind xid [{}] back to RootContext", unbindXid);
if (BranchType.TCC == previousBranchType) {
RootContext.bindBranchType(BranchType.TCC);
LOGGER.warn("bind branchType [{}] back to RootContext", previousBranchType);
}
}
}
}
RpcContext.getServiceContext().removeAttachment(RootContext.KEY_XID);
RpcContext.getServiceContext().removeAttachment(RootContext.KEY_BRANCH_TYPE);
RpcContext.getServerContext().removeAttachment(RootContext.KEY_XID);
RpcContext.getServerContext().removeAttachment(RootContext.KEY_BRANCH_TYPE);
}
}
/**
* get rpc xid
* @return
*/
private String getRpcXid() {
String rpcXid = RpcContext.getServiceContext().getAttachment(RootContext.KEY_XID);
if (rpcXid == null) {
rpcXid = RpcContext.getServiceContext().getAttachment(RootContext.KEY_XID.toLowerCase());
}
return rpcXid;
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,6 +20,7 @@
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- Sentinel Datasource Nacos -->
<dependency>
<groupId>com.alibaba.csp</groupId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -34,6 +34,12 @@
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
@@ -44,6 +50,19 @@
<groupId>net.dreamlu</groupId>
<artifactId>mica-metrics</artifactId>
<version>2.7.6</version>
<exclusions>
<exclusion>
<groupId>net.dreamlu</groupId>
<artifactId>mica-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-core</artifactId>
<version>2.7.6</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-example</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -29,12 +29,6 @@
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sentinel</artifactId>

View File

@@ -41,10 +41,25 @@ spring:
datasource:
# 主库数据源
master:
type: ${spring.datasource.type}
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${datasource.system-master.url}
username: ${datasource.system-master.username}
password: ${datasource.system-master.password}
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: ${datasource.system-oracle.url}
# username: ${datasource.system-oracle.username}
# password: ${datasource.system-oracle.password}
# hikari:
# connectionTestQuery: SELECT 1 FROM DUAL
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: ${datasource.system-postgres.url}
# username: ${datasource.system-postgres.url}
# password: ${datasource.system-postgres.url}
--- # elasticsearch 功能配置
# 文档地址: https://www.easy-es.cn/

View File

@@ -24,3 +24,5 @@ outagedetection=true
outagedetectioninterval=2
# 是否过滤 Log
filter=true
# 过滤 Log 时所排除的 sql 关键字,以逗号分隔
exclude=SELECT 1

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-example</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -44,12 +44,6 @@
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sentinel</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,6 +3,7 @@ package com.ruoyi.gateway.filter;
import cn.dev33.satoken.same.SaSameUtil;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
@@ -14,7 +15,7 @@ import reactor.core.publisher.Mono;
* @author Lion Li
*/
@Component
public class ForwardAuthFilter implements GlobalFilter {
public class ForwardAuthFilter implements GlobalFilter, Ordered {
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest newRequest = exchange
@@ -26,5 +27,10 @@ public class ForwardAuthFilter implements GlobalFilter {
ServerWebExchange newExchange = exchange.mutate().request(newRequest).build();
return chain.filter(newExchange);
}
@Override
public int getOrder() {
return -100;
}
}

View File

@@ -33,6 +33,6 @@ public class GlobalCacheRequestFilter implements GlobalFilter, Ordered {
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
return Ordered.HIGHEST_PRECEDENCE + 1;
}
}

View File

@@ -95,6 +95,6 @@ public class XssFilter implements GlobalFilter, Ordered {
@Override
public int getOrder() {
return -100;
return Ordered.HIGHEST_PRECEDENCE;
}
}

View File

@@ -2,7 +2,6 @@ package com.ruoyi.gateway.service.impl;
import cn.hutool.captcha.AbstractCaptcha;
import cn.hutool.captcha.generator.CodeGenerator;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.Constants;
@@ -17,6 +16,9 @@ import com.ruoyi.gateway.config.properties.CaptchaProperties;
import com.ruoyi.gateway.enums.CaptchaType;
import com.ruoyi.gateway.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.stereotype.Service;
import java.io.IOException;
@@ -57,30 +59,18 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz());
captcha.setGenerator(codeGenerator);
captcha.createCode();
String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode();
String code = captcha.getCode();
if (isMath) {
ExpressionParser parser = new SpelExpressionParser();
Expression exp = parser.parseExpression(StringUtils.remove(code, "="));
code = exp.getValue(String.class);
}
RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
ajax.put("uuid", uuid);
ajax.put("img", captcha.getImageBase64());
return R.ok(ajax);
}
private String getCodeResult(String capStr) {
int numberLength = captchaProperties.getNumberLength();
int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim());
char operator = capStr.charAt(numberLength);
int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim());
switch (operator) {
case '*':
return Convert.toStr(a * b);
case '+':
return Convert.toStr(a + b);
case '-':
return Convert.toStr(a - b);
default:
return StringUtils.EMPTY;
}
}
/**
* 校验验证码
*/

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-cloud-plus</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-modules</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -29,12 +29,6 @@
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Apache Velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>

View File

@@ -202,7 +202,7 @@ public class GenTable extends BaseEntity {
public static boolean isSuperColumn(String tplCategory, String javaField) {
if (isTree(tplCategory)) {
return StringUtils.equalsAnyIgnoreCase(javaField,
ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
}
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
}

View File

@@ -189,10 +189,10 @@ public class GenTableColumn extends BaseEntity {
public static boolean isSuperColumn(String javaField) {
return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime",
// TreeEntity
"parentName", "parentId");
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime",
// TreeEntity
"parentName", "parentId");
}
public boolean isUsableColumn() {

View File

@@ -18,16 +18,7 @@ import java.util.List;
@InterceptorIgnore(dataPermission = "true")
public interface GenTableMapper extends BaseMapperPlus<GenTableMapper, GenTable, GenTable> {
Page<GenTable> selectPageDbTableList(@Param("page") Page<GenTable> page, @Param(Constants.WRAPPER) Wrapper<Object> queryWrapper);
/**
* 查询据库列表
*
* @param queryWrapper 查询条件
* @return 数据库表集合
*/
List<GenTable> selectDbTableList(@Param(Constants.WRAPPER) Wrapper<Object> queryWrapper);
Page<GenTable> selectPageDbTableList(@Param("page") Page<GenTable> page, @Param("genTable") GenTable genTable);
/**
* 查询据库列表

View File

@@ -6,9 +6,10 @@ import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.constant.Constants;
@@ -50,6 +51,7 @@ import java.util.zip.ZipOutputStream;
*
* @author ruoyi
*/
@DS("#header.datasource")
@Slf4j
@RequiredArgsConstructor
@Service
@@ -57,6 +59,7 @@ public class GenTableServiceImpl implements IGenTableService {
private final GenTableMapper baseMapper;
private final GenTableColumnMapper genTableColumnMapper;
private final IdentifierGenerator identifierGenerator;
/**
* 查询业务字段列表
@@ -90,17 +93,6 @@ public class GenTableServiceImpl implements IGenTableService {
return TableDataInfo.build(page);
}
/**
* 查询业务列表
*
* @param genTable 业务信息
* @return 业务集合
*/
@Override
public List<GenTable> selectGenTableList(GenTable genTable) {
return baseMapper.selectList(this.buildGenTableQueryWrapper(genTable));
}
private QueryWrapper<GenTable> buildGenTableQueryWrapper(GenTable genTable) {
Map<String, Object> params = genTable.getParams();
QueryWrapper<GenTable> wrapper = Wrappers.query();
@@ -114,36 +106,10 @@ public class GenTableServiceImpl implements IGenTableService {
@Override
public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery) {
Page<GenTable> page = baseMapper.selectPageDbTableList(pageQuery.build(), this.buildDbTableQueryWrapper(genTable));
Page<GenTable> page = baseMapper.selectPageDbTableList(pageQuery.build(), genTable);
return TableDataInfo.build(page);
}
/**
* 查询据库列表
*
* @param genTable 业务信息
* @return 数据库表集合
*/
@Override
public List<GenTable> selectDbTableList(GenTable genTable) {
return baseMapper.selectDbTableList(this.buildDbTableQueryWrapper(genTable));
}
private Wrapper<Object> buildDbTableQueryWrapper(GenTable genTable) {
Map<String, Object> params = genTable.getParams();
QueryWrapper<Object> wrapper = Wrappers.query();
wrapper.apply("table_schema = (select database())")
.notLike("table_name", "xxl_job_")
.notLike("table_name", "gen_")
.notInSql("table_name", "select table_name from gen_table")
.like(StringUtils.isNotBlank(genTable.getTableName()), "lower(table_name)", StringUtils.lowerCase(genTable.getTableName()))
.like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment()))
.between(params.get("beginTime") != null && params.get("endTime") != null,
"create_time", params.get("beginTime"), params.get("endTime"))
.orderByDesc("create_time");
return wrapper;
}
/**
* 查询据库列表
*
@@ -241,10 +207,9 @@ public class GenTableServiceImpl implements IGenTableService {
Map<String, String> dataMap = new LinkedHashMap<>();
// 查询表信息
GenTable table = baseMapper.selectGenTableById(tableId);
Snowflake snowflake = IdUtil.getSnowflake();
List<Long> menuIds = new ArrayList<>();
for (int i = 0; i < 6; i++) {
menuIds.add(snowflake.nextId());
menuIds.add(identifierGenerator.nextId(null).longValue());
}
table.setMenuIds(menuIds);
// 设置主子表信息
@@ -291,10 +256,9 @@ public class GenTableServiceImpl implements IGenTableService {
public void generatorCode(String tableName) {
// 查询表信息
GenTable table = baseMapper.selectGenTableByName(tableName);
Snowflake snowflake = IdUtil.getSnowflake();
List<Long> menuIds = new ArrayList<>();
for (int i = 0; i < 6; i++) {
menuIds.add(snowflake.nextId());
menuIds.add(identifierGenerator.nextId(null).longValue());
}
table.setMenuIds(menuIds);
// 设置主子表信息

View File

@@ -27,22 +27,6 @@ public interface IGenTableService {
TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery);
/**
* 查询业务列表
*
* @param genTable 业务信息
* @return 业务集合
*/
List<GenTable> selectGenTableList(GenTable genTable);
/**
* 查询据库列表
*
* @param genTable 业务信息
* @return 数据库表集合
*/
List<GenTable> selectDbTableList(GenTable genTable);
/**
* 查询据库列表
*

View File

@@ -92,11 +92,6 @@ public class GenUtils {
column.setIsQuery(GenConstants.REQUIRE);
}
// 查询字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) {
column.setIsQuery(GenConstants.REQUIRE);
}
// 查询字段类型
if (StringUtils.endsWithIgnoreCase(columnName, "name")) {
column.setQueryType(GenConstants.QUERY_LIKE);
@@ -107,7 +102,7 @@ public class GenUtils {
}
// 类型&性别字段设置下拉框
else if (StringUtils.endsWithIgnoreCase(columnName, "type")
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) {
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) {
column.setHtmlType(GenConstants.HTML_SELECT);
}
// 图片字段设置图片上传控件
@@ -154,9 +149,11 @@ public class GenUtils {
* @return 业务名
*/
public static String getBusinessName(String tableName) {
int lastIndex = tableName.lastIndexOf("_");
int firstIndex = tableName.indexOf("_");
int nameLength = tableName.length();
return StringUtils.substring(tableName, lastIndex + 1, nameLength);
String businessName = StringUtils.substring(tableName, firstIndex + 1, nameLength);
businessName = StringUtils.toCamelCase(businessName);
return businessName;
}
/**

View File

@@ -8,6 +8,7 @@ import com.ruoyi.common.core.constant.GenConstants;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.JsonUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.mybatis.helper.DataBaseHelper;
import com.ruoyi.gen.domain.GenTable;
import com.ruoyi.gen.domain.GenTableColumn;
import lombok.AccessLevel;
@@ -138,7 +139,13 @@ public class VelocityUtils {
templates.add("vm/java/serviceImpl.java.vm");
templates.add("vm/java/controller.java.vm");
templates.add("vm/xml/mapper.xml.vm");
templates.add("vm/sql/sql.vm");
if (DataBaseHelper.isOracle()) {
templates.add("vm/sql/oracle/sql.vm");
} else if (DataBaseHelper.isPostgerSql()) {
templates.add("vm/sql/postgres/sql.vm");
} else {
templates.add("vm/sql/sql.vm");
}
templates.add("vm/js/api.js.vm");
if (GenConstants.TPL_CRUD.equals(tplCategory)) {
templates.add("vm/vue/index.vue.vm");
@@ -263,8 +270,8 @@ public class VelocityUtils {
public static void addDicts(Set<String> dicts, List<GenTableColumn> columns) {
for (GenTableColumn column : columns) {
if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
column.getHtmlType(),
new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX})) {
column.getHtmlType(),
new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) {
dicts.add("'" + column.getDictType() + "'");
}
}
@@ -289,7 +296,7 @@ public class VelocityUtils {
*/
public static String getParentMenuId(Dict paramsObj) {
if (CollUtil.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)
&& StringUtils.isNotEmpty(paramsObj.getStr(GenConstants.PARENT_MENU_ID))) {
&& StringUtils.isNotEmpty(paramsObj.getStr(GenConstants.PARENT_MENU_ID))) {
return paramsObj.getStr(GenConstants.PARENT_MENU_ID);
}
return DEFAULT_PARENT_MENU_ID;

View File

@@ -30,9 +30,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
order by ordinal_position
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isMySql()">
select column_name,
(case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required,
(case when column_key = 'PRI' then '1' else '0' end) as is_pk,
ordinal_position as sort,
column_comment,
(case when extra = 'auto_increment' then '1' else '0' end) as is_increment,
column_type
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
order by ordinal_position
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isOracle()">
select lower(temp.column_name) as column_name,
(case when (temp.nullable = 'N' and temp.constraint_type != 'P') then '1' else null end) as is_required,
(case when temp.constraint_type = 'P' then '1' else '0' end) as is_pk,
temp.column_id as sort,
temp.comments as column_comment,
(case when temp.constraint_type = 'P' then '1' else '0' end) as is_increment,
lower(temp.data_type) as column_type
from (
select col.column_id, col.column_name,col.nullable, col.data_type, colc.comments, uc.constraint_type, row_number()
over (partition by col.column_name order by uc.constraint_type desc) as row_flg
from user_tab_columns col
left join user_col_comments colc on colc.table_name = col.table_name and colc.column_name = col.column_name
left join user_cons_columns ucc on ucc.table_name = col.table_name and ucc.column_name = col.column_name
left join user_constraints uc on uc.constraint_name = ucc.constraint_name
where col.table_name = upper(#{tableName})
) temp
WHERE temp.row_flg = 1
ORDER BY temp.column_id
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isPostgerSql()">
SELECT column_name, is_required, is_pk, sort, column_comment, is_increment, column_type
FROM (
SELECT c.relname AS table_name,
a.attname AS column_name,
d.description AS column_comment,
CASE WHEN a.attnotnull AND con.conname IS NULL THEN 1 ELSE 0
END AS is_required,
CASE WHEN con.conname IS NOT NULL THEN 1 ELSE 0
END AS is_pk,
a.attnum AS sort,
CASE WHEN "position"(pg_get_expr(ad.adbin, ad.adrelid),
((c.relname::text || '_'::text) || a.attname::text) || '_seq'::text) > 0 THEN 1 ELSE 0
END AS is_increment,
btrim(
CASE WHEN t.typelem <![CDATA[ <> ]]> 0::oid AND t.typlen = '-1'::integer THEN 'ARRAY'::text ELSE
CASE WHEN t.typtype = 'd'::"char" THEN format_type(t.typbasetype, NULL::integer)
ELSE format_type(a.atttypid, NULL::integer) END
END, '"'::text
) AS column_type
FROM pg_attribute a
JOIN (pg_class c JOIN pg_namespace n ON c.relnamespace = n.oid) ON a.attrelid = c.oid
LEFT JOIN pg_description d ON d.objoid = c.oid AND a.attnum = d.objsubid
LEFT JOIN pg_constraint con ON con.conrelid = c.oid AND (a.attnum = ANY (con.conkey))
LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum
LEFT JOIN pg_type t ON a.atttypid = t.oid
WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
AND a.attnum > 0
AND n.nspname = 'public'::name
ORDER BY c.relname, a.attnum
) temp
WHERE table_name = (#{tableName})
</if>
</select>
</mapper>

View File

@@ -54,30 +54,139 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<select id="selectPageDbTableList" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time
from information_schema.tables
${ew.getCustomSqlSegment}
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isMySql()">
select table_name, table_comment, create_time, update_time
from information_schema.tables
where table_schema = (select database())
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="genTable.tableName != null and genTable.tableName != ''">
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
</if>
<if test="genTable.tableComment != null and genTable.tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
</if>
order by create_time desc
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isOracle()">
select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time
from user_tables dt, user_tab_comments dtc, user_objects uo
where dt.table_name = dtc.table_name
and dt.table_name = uo.object_name
and uo.object_type = 'TABLE'
AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%'
AND lower(dt.table_name) NOT IN (select table_name from gen_table)
<if test="genTable.tableName != null and genTable.tableName != ''">
AND lower(dt.table_name) like lower(concat(concat('%', #{genTable.tableName}), '%'))
</if>
<if test="genTable.tableComment != null and genTable.tableComment != ''">
AND lower(dtc.comments) like lower(concat(concat('%', #{genTable.tableComment}), '%'))
</if>
order by create_time desc
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isPostgerSql()">
select table_name, table_comment, create_time, update_time
from (
SELECT c.relname AS table_name,
obj_description(c.oid) AS table_comment,
CURRENT_TIMESTAMP AS create_time,
CURRENT_TIMESTAMP AS update_time
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
AND c.relname != 'spatial_%'::text
AND n.nspname = 'public'::name
AND n.nspname <![CDATA[ <> ]]> ''::name
) list_table
where table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="genTable.tableName != null and genTable.tableName != ''">
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
</if>
<if test="genTable.tableComment != null and genTable.tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
</if>
order by create_time desc
</if>
</select>
<select id="selectDbTableList" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time
from information_schema.tables
${ew.getCustomSqlSegment}
</select>
<select id="selectDbTableListByNames" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isMySql()">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isOracle()">
select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time
from user_tables dt, user_tab_comments dtc, user_objects uo
where dt.table_name = dtc.table_name
and dt.table_name = uo.object_name
and uo.object_type = 'TABLE'
AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%'
AND dt.table_name NOT IN (select table_name from gen_table)
and lower(dt.table_name) in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isPostgerSql()">
select table_name, table_comment, create_time, update_time
from (
SELECT c.relname AS table_name,
obj_description(c.oid) AS table_comment,
CURRENT_TIMESTAMP AS create_time,
CURRENT_TIMESTAMP AS update_time
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
AND c.relname != 'spatial_%'::text
AND n.nspname = 'public'::name
AND n.nspname <![CDATA[ <> ]]> ''::name
) list_table
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%'
and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</if>
</select>
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
and table_name = #{tableName}
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isMySql()">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
and table_name = #{tableName}
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isOracle()">
select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time
from user_tables dt, user_tab_comments dtc, user_objects uo
where dt.table_name = dtc.table_name
and dt.table_name = uo.object_name
and uo.object_type = 'TABLE'
AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%'
AND dt.table_name NOT IN (select table_name from gen_table)
and lower(dt.table_name) = #{tableName}
</if>
<if test="@com.ruoyi.common.mybatis.helper.DataBaseHelper@isPostgerSql()">
select table_name, table_comment, create_time, update_time
from (
SELECT c.relname AS table_name,
obj_description(c.oid) AS table_comment,
CURRENT_TIMESTAMP AS create_time,
CURRENT_TIMESTAMP AS update_time
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
AND c.relname != 'spatial_%'::text
AND n.nspname = 'public'::name
AND n.nspname <![CDATA[ <> ]]> ''::name
) list_table
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%'
and table_name = #{tableName}
</if>
</select>
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">

View File

@@ -0,0 +1,19 @@
-- 菜单 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[0]}, '${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate, '', null, '${functionName}菜单');
-- 按钮 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[1]}, '${functionName}查询', ${table.menuIds[0]}, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate, '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[2]}, '${functionName}新增', ${table.menuIds[0]}, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate, '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[3]}, '${functionName}修改', ${table.menuIds[0]}, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate, '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[4]}, '${functionName}删除', ${table.menuIds[0]}, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate, '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[5]}, '${functionName}导出', ${table.menuIds[0]}, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate, '', null, '');

View File

@@ -0,0 +1,20 @@
-- 菜单 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[0]}, '${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', now(), '', null, '${functionName}菜单');
-- 按钮 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[1]}, '${functionName}查询', ${table.menuIds[0]}, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', now(), '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[2]}, '${functionName}新增', ${table.menuIds[0]}, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', now(), '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[3]}, '${functionName}修改', ${table.menuIds[0]}, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', now(), '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[4]}, '${functionName}删除', ${table.menuIds[0]}, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', now(), '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values(${table.menuIds[5]}, '${functionName}导出', ${table.menuIds[0]}, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', now(), '', null, '');

View File

@@ -186,11 +186,11 @@
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
</el-form-item>
#elseif($column.htmlType == "imageUpload")
<el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}">
<image-upload v-model="form.${field}"/>
</el-form-item>
#elseif($column.htmlType == "fileUpload")
<el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}">
<file-upload v-model="form.${field}"/>
</el-form-item>
#elseif($column.htmlType == "editor")
@@ -204,8 +204,11 @@
v-for="dict in dict.type.${dictType}"
:key="dict.value"
:label="dict.label"
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
#if($column.javaType == "Integer" || $column.javaType == "Long")
:value="parseInt(dict.value)"
#else
:value="dict.value"
#end
></el-option>
</el-select>
</el-form-item>
@@ -216,7 +219,7 @@
</el-select>
</el-form-item>
#elseif($column.htmlType == "checkbox" && "" != $dictType)
<el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}">
<el-checkbox-group v-model="form.${field}">
<el-checkbox
v-for="dict in dict.type.${dictType}"
@@ -227,24 +230,27 @@
</el-checkbox-group>
</el-form-item>
#elseif($column.htmlType == "checkbox" && $dictType)
<el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}">
<el-checkbox-group v-model="form.${field}">
<el-checkbox>请选择字典生成</el-checkbox>
</el-checkbox-group>
</el-form-item>
#elseif($column.htmlType == "radio" && "" != $dictType)
<el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}">
<el-radio-group v-model="form.${field}">
<el-radio
v-for="dict in dict.type.${dictType}"
:key="dict.value"
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
#if($column.javaType == "Integer" || $column.javaType == "Long")
:label="parseInt(dict.value)"
#else
:label="dict.value"
#end
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
#elseif($column.htmlType == "radio" && $dictType)
<el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}">
<el-radio-group v-model="form.${field}">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
@@ -335,7 +341,7 @@ export default {
#set($comment=$column.columnComment)
#end
$column.javaField: [
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
]#if($foreach.count != $columns.size()),#end
#end
#end
@@ -398,10 +404,7 @@ export default {
reset() {
this.form = {
#foreach ($column in $columns)
#if($column.htmlType == "radio")
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end
#elseif($column.htmlType == "checkbox")
#if($column.htmlType == "checkbox")
$column.javaField: []#if($foreach.count != $columns.size()),#end
#else
$column.javaField: null#if($foreach.count != $columns.size()),#end

Some files were not shown because too many files have changed in this diff Show More