mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
Compare commits
190 Commits
v3.8.0
...
v3.8.0last
| Author | SHA1 | Date | |
|---|---|---|---|
| 5972c74b43 | |||
| d69cb121fc | |||
| 10a9edd10b | |||
| c71ff3fbcc | |||
| 08612d5bfa | |||
| 2ecce8f02d | |||
| 62937f14fb | |||
| d6ccc4a326 | |||
| 1893108136 | |||
| 7980915bdc | |||
| 550997268b | |||
| 9e7d40a080 | |||
| 2c38db456b | |||
| e52538d304 | |||
| e91cbd5cd8 | |||
| 70cec8b5c6 | |||
| d2365088ce | |||
| a679571a5a | |||
| b9c74e549f | |||
| 81c1724016 | |||
| 56d59eb589 | |||
| a00fcae3a3 | |||
| 9aea5de668 | |||
| 8979dd7ae9 | |||
| a56bd05389 | |||
| 9cf3328ea4 | |||
| 286d10a50f | |||
| 37c593e1d4 | |||
| 68f36cb1e5 | |||
| 78454d3434 | |||
| 56fbc2ed8f | |||
| 197d7adaaf | |||
| 49ba40e98a | |||
| e952518d71 | |||
| 0e184eaa64 | |||
| 86a3ed9dae | |||
| 1e259c805e | |||
| 8a82141c95 | |||
| 94bff11eb1 | |||
| 590d73dfe3 | |||
| fe9630d15c | |||
| 77ae25b86a | |||
| 3b34276cf8 | |||
| cffba084fc | |||
| d1589acc41 | |||
| 888a032266 | |||
| 0d18e536f0 | |||
| 21392c44f8 | |||
| 2730d8e06f | |||
| 0002606d41 | |||
| 8bd19484ee | |||
| 5d2db92613 | |||
| c1b39d21dd | |||
| e83c9b8190 | |||
| 309c76d268 | |||
| 9bd03f467d | |||
| f78eabfc66 | |||
| e032591366 | |||
| de767e07b4 | |||
| b77d3e36ab | |||
| 7885aaed3b | |||
| 6f4c2eb77c | |||
| 3f0597a0f6 | |||
| 04a3764f00 | |||
| 68464109de | |||
| 79866c5823 | |||
| d64b8ecaef | |||
| ec9f2b146a | |||
| 69fd2888a1 | |||
| 748331d649 | |||
| cb1d8e3527 | |||
| a89b299a4b | |||
| 7a15bfc161 | |||
| 65f7eb9542 | |||
| b70e709e53 | |||
| 2ba17648c4 | |||
| 36caab37e2 | |||
| 6e721e4120 | |||
| a17b403675 | |||
| 632fd72d79 | |||
| 15fc262675 | |||
| 6768d65e1e | |||
| 410ab7bcc3 | |||
| 174f1ae432 | |||
| eef2f7e269 | |||
| 6a0ec66d3d | |||
| 163b0b531f | |||
| d1af49a33f | |||
| 03265691e6 | |||
| de9cc2f30d | |||
| 26887959cd | |||
| 7e15e81218 | |||
| 8b0e0367c7 | |||
| 334f7dbb62 | |||
| e9ddd21286 | |||
| 458526075e | |||
| a1b55f0d40 | |||
| 2f0a3bcd87 | |||
| 30d3a9f17b | |||
| 03739f2837 | |||
| d9e8bd2bc8 | |||
| 81eef5a838 | |||
| f528f72903 | |||
| 918286c144 | |||
| 512234a804 | |||
| cacc59b8fd | |||
| c744633139 | |||
| 0e4d304878 | |||
| 17a8964487 | |||
| 8ac6989d2c | |||
| 402ab0ffc4 | |||
| 7778ede90e | |||
| 06144206df | |||
| 3d3b5850ad | |||
| 816eeb9225 | |||
| 0b42efbbbf | |||
| b8e0d4391d | |||
| 72b34d082b | |||
| 7112649a21 | |||
| fbc312c35d | |||
| b8162a4a6d | |||
| 28404d2fd3 | |||
| c92c9be49a | |||
| 58e85e0569 | |||
| 6fc34d8a39 | |||
| 790df934b5 | |||
| 8aee4011a2 | |||
| 6e0277c60a | |||
| e923654161 | |||
| 06b41ae479 | |||
| 11af85d87a | |||
| 4caff75cce | |||
| 811861a957 | |||
| 24623ba4b0 | |||
| 7c68b46943 | |||
| 7c34161369 | |||
| bc52aa918d | |||
| 9dfdd47b36 | |||
| 272a7540eb | |||
| ad796f079f | |||
| e7e7716d05 | |||
| c5d620d2b2 | |||
| cdea05ebb0 | |||
| ca9a433f3c | |||
| 2be6052cd4 | |||
| 68ed67ee49 | |||
| d5903ba52a | |||
| 3ee635eddf | |||
| 21bc68fb53 | |||
| f532e57862 | |||
| da08adbea1 | |||
| 46e3e62b59 | |||
| 3656264f8a | |||
| 3361d48cd4 | |||
| ed86ea3da1 | |||
| 3deb0e5487 | |||
| 9e4792941e | |||
| b5fd5fe782 | |||
| 33c0104a02 | |||
| 81ed5100af | |||
| 87f9dc0064 | |||
| b311fedc6b | |||
| e321a0405f | |||
| d8bc74794d | |||
| 732f05dc74 | |||
| 6ce92798c6 | |||
| f4454e9348 | |||
| d9134ae0c8 | |||
| 25180e41c8 | |||
| a99e3f2268 | |||
| d27c354bf1 | |||
| d818b1dd9d | |||
| bcdbec0091 | |||
| 098bb12b9e | |||
| 4a6c750b19 | |||
| d396e5304a | |||
| 9bed25be8c | |||
| 7109b42092 | |||
| 1667b14194 | |||
| e9514873d2 | |||
| 0ee090664e | |||
| 4a9eda4ab0 | |||
| 2416c8b251 | |||
| 5b056f9dd6 | |||
| a93998dc56 | |||
| 268c27a782 | |||
| 23ace2712a | |||
| 157feeb925 | |||
| 4e25d4162f | |||
| 47a68f31e1 |
14
README-AI.md
14
README-AI.md
@ -25,7 +25,7 @@ JeecgBoot平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
> - 对话回复格式美观:
|
> - 对话回复格式美观:
|
||||||
> 在对话过程中,JEECG AI能够保持回复内容的原格式,也不丢失图片,使得输出的文章更加美观,不会出现格式错乱的情况,还支持图片的渲染。
|
> 在对话过程中,JEECG AI能够保持回复内容的原格式,也不丢失图片,使得输出的文章更加美观,不会出现格式错乱的情况,还支持图片的渲染。
|
||||||
> - PDF文档导入与格式转换:
|
> - PDF文档导入与格式转换:
|
||||||
> JEECG AI在处理PDF文档时,能够更好地保持原始格式和图片,确保转换后的内容与原始文档一致。这哥功能在许多AI产品中表现不佳,而JEECG AI在这方面做出了显著的优化
|
> JEECG AI在处理PDF文档时,能够更好地保持原始格式和图片,确保转换后的内容与原始文档一致。这个功能在许多AI产品中表现不佳,而JEECG AI在这方面做出了显著的优化
|
||||||
|
|
||||||
|
|
||||||
| 功能 | Dify | Jeecg AI |
|
| 功能 | Dify | Jeecg AI |
|
||||||
@ -63,11 +63,17 @@ JeecgBoot平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 产品体验
|
|
||||||
|
|
||||||
- 使用手册:https://help.jeecg.com/aigc
|
#### 在线体验
|
||||||
- 演示地址:https://boot3.jeecg.com
|
|
||||||
|
|
||||||
|
- JeecgBoot演示: https://boot3.jeecg.com
|
||||||
|
- 敲敲云在线搭建AI知识库:https://app.qiaoqiaoyun.com
|
||||||
|
|
||||||
|
|
||||||
|
## 技术交流
|
||||||
|
|
||||||
|
- 开发文档:https://help.jeecg.com/aigc
|
||||||
|
- QQ群:716488839
|
||||||
|
|
||||||
|
|
||||||
## 功能列表
|
## 功能列表
|
||||||
|
|||||||
21
README.md
21
README.md
@ -41,10 +41,22 @@ JeecgBoot 提供了一系列 `低代码能力`,实现`真正的零代码`在
|
|||||||
|
|
||||||
适用项目
|
适用项目
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
JeecgBoot AI低代码平台,可以应用在任何J2EE项目的开发中,支持信创国产化(默认适配达梦和人大金仓)。尤其适合SAAS项目、企业信息管理系统(MIS)、内部办公系统(OA)、企业资源计划系统(ERP)、客户关系管理系统(CRM)等,其半智能手工Merge的开发方式,可以显著提高开发效率70%以上,极大降低开发成本。
|
JeecgBoot AI低代码平台,可以应用在任何J2EE项目的开发中,支持信创国产化。尤其适合SAAS项目、企业信息管理系统(MIS)、内部办公系统(OA)、企业资源计划系统(ERP)、客户关系管理系统(CRM)等,其半智能手工Merge的开发方式,可以显著提高开发效率70%以上,极大降低开发成本。
|
||||||
又是一个全栈式 AI 开发平台,快速帮助企业构建和部署个性化的 AI 应用。
|
又是一个全栈式 AI 开发平台,快速帮助企业构建和部署个性化的 AI 应用。
|
||||||
|
|
||||||
|
|
||||||
|
信创国产化
|
||||||
|
-----------------------------------
|
||||||
|
JeecgBoot 是一个开源低代码开发平台,支持全信创环境。它兼容多种国产操作系统和数据库,包括:
|
||||||
|
|
||||||
|
- 操作系统:国产麒麟、银河麒麟等国产系统几乎都是基于 Linux 内核,因此它们具有良好的兼容性。
|
||||||
|
- 数据库:达梦、人大金仓、TiDB , [转库文档](https://my.oschina.net/jeecg/blog/4905722)
|
||||||
|
- 中间件:东方通 TongWeb、TongRDS,宝兰德 AppServer、CacheDB, [信创配置文档](https://help.jeecg.com/java/tongweb-deploy/)
|
||||||
|
|
||||||
|
通过这些适配,JeecgBoot 为使用国产软件和硬件的用户提供了高效的开发解决方案。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
项目说明
|
项目说明
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
@ -93,6 +105,11 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
[](https://www.bilibili.com/video/BV1zmd7YFE4w)
|
[](https://www.bilibili.com/video/BV1zmd7YFE4w)
|
||||||
|
|
||||||
|
|
||||||
|
##### 在线体验
|
||||||
|
|
||||||
|
- JeecgBoot演示: https://boot3.jeecg.com
|
||||||
|
- 敲敲云在线搭建AI知识库:https://app.qiaoqiaoyun.com
|
||||||
|
|
||||||
##### Dify `VS` JEECG AI
|
##### Dify `VS` JEECG AI
|
||||||
|
|
||||||
> JEECG AI与Dify相比,在多个方面展现出显著的优势,特别是在文档处理、格式和图片保持方面。以下是一些具体的优点:
|
> JEECG AI与Dify相比,在多个方面展现出显著的优势,特别是在文档处理、格式和图片保持方面。以下是一些具体的优点:
|
||||||
@ -101,7 +118,7 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
> - 对话回复格式美观:
|
> - 对话回复格式美观:
|
||||||
> 在对话过程中,JEECG AI能够保持回复内容的原格式,也不丢失图片,使得输出的文章更加美观,不会出现格式错乱的情况,还支持图片的渲染。
|
> 在对话过程中,JEECG AI能够保持回复内容的原格式,也不丢失图片,使得输出的文章更加美观,不会出现格式错乱的情况,还支持图片的渲染。
|
||||||
> - PDF文档导入与格式转换:
|
> - PDF文档导入与格式转换:
|
||||||
> JEECG AI在处理PDF文档时,能够更好地保持原始格式和图片,确保转换后的内容与原始文档一致。这哥功能在许多AI产品中表现不佳,而JEECG AI在这方面做出了显著的优化
|
> JEECG AI在处理PDF文档时,能够更好地保持原始格式和图片,确保转换后的内容与原始文档一致。这个功能在许多AI产品中表现不佳,而JEECG AI在这方面做出了显著的优化
|
||||||
|
|
||||||
##### 功能大模块
|
##### 功能大模块
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
JeecgBoot 低代码开发平台
|
JeecgBoot 低代码开发平台
|
||||||
===============
|
===============
|
||||||
|
|
||||||
当前最新版本: 3.8.0(发布日期:2025-04-21)
|
当前最新版本: 3.8.0(发布日期:2025-05-16)
|
||||||
|
|
||||||
|
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
[](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
170
jeecg-boot/db/基于AK和SK安全鉴权的OpenAPI/升级SQL脚本.sql
Normal file
170
jeecg-boot/db/基于AK和SK安全鉴权的OpenAPI/升级SQL脚本.sql
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
Navicat Premium Data Transfer
|
||||||
|
|
||||||
|
Source Server : mysql5.7
|
||||||
|
Source Server Type : MySQL
|
||||||
|
Source Server Version : 50738 (5.7.38)
|
||||||
|
Source Host : 127.0.0.1:3306
|
||||||
|
Source Schema : jeecg-boot
|
||||||
|
|
||||||
|
Target Server Type : MySQL
|
||||||
|
Target Server Version : 50738 (5.7.38)
|
||||||
|
File Encoding : 65001
|
||||||
|
|
||||||
|
Date: 15/05/2025 10:18:36
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for open_api
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `open_api`;
|
||||||
|
CREATE TABLE `open_api` (
|
||||||
|
`id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '接口名称',
|
||||||
|
`request_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '请求方法',
|
||||||
|
`request_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '接口地址',
|
||||||
|
`black_list` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'IP 黑名单',
|
||||||
|
`body` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '请求体内容',
|
||||||
|
`origin_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '原始地址',
|
||||||
|
`status` int(10) NULL DEFAULT NULL COMMENT '状态',
|
||||||
|
`del_flag` int(10) NULL DEFAULT NULL COMMENT '删除标识',
|
||||||
|
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
|
||||||
|
`headers_json` json NULL COMMENT '请求头json',
|
||||||
|
`params_json` json NULL COMMENT '请求参数json',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '接口表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of open_api
|
||||||
|
-- ----------------------------
|
||||||
|
INSERT INTO `open_api` VALUES ('1922132683346649090', '根据部门查询用户', 'GET', 'TEwcXBlr', NULL, NULL, '/sys/user/queryUserByDepId', 1, 0, 'admin', '2025-05-13 11:31:58', 'admin', '2025-05-15 10:10:01', '[]', '[{\"id\": \"row_24\", \"note\": \"\", \"paramKey\": \"id\", \"required\": \"1\", \"defaultValue\": \"\"}]');
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for open_api_auth
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `open_api_auth`;
|
||||||
|
CREATE TABLE `open_api_auth` (
|
||||||
|
`id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '授权名称',
|
||||||
|
`ak` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'AK',
|
||||||
|
`sk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'SK',
|
||||||
|
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
|
||||||
|
`system_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '关联系统用户名',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '权限表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of open_api_auth
|
||||||
|
-- ----------------------------
|
||||||
|
INSERT INTO `open_api_auth` VALUES ('1922164194775056386', 'scott', 'ak-pFjyNHWRsJEFWlu6', '4hV5dBrZtmGAtPdbA5yseaeKRYNpzGsS', 'admin', '2025-05-13 13:37:11', NULL, NULL, 'e9ca23d68d884d4ebb19d07889727dae');
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for open_api_log
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `open_api_log`;
|
||||||
|
CREATE TABLE `open_api_log` (
|
||||||
|
`id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`api_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '接口ID',
|
||||||
|
`call_auth_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '调用ID',
|
||||||
|
`call_time` datetime NULL DEFAULT NULL COMMENT '调用时间',
|
||||||
|
`used_time` bigint(20) NULL DEFAULT NULL COMMENT '耗时',
|
||||||
|
`response_time` datetime NULL DEFAULT NULL COMMENT '响应时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '调用记录表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of open_api_log
|
||||||
|
-- ----------------------------
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922175238557913090', '1922132683346649090', '1922164194775056386', '2025-05-13 14:21:04', 94, '2025-05-13 14:21:04');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922175436256432130', '1922132683346649090', '1922164194775056386', '2025-05-13 14:21:51', 38, '2025-05-13 14:21:51');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922175487921868802', '1922132683346649090', '1922164194775056386', '2025-05-13 14:22:03', 31, '2025-05-13 14:22:03');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922176033789562883', '1922132683346649090', '1922164194775056386', '2025-05-13 14:24:13', 27, '2025-05-13 14:24:13');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922176583943835650', '1922132683346649090', '1922164194775056386', '2025-05-13 14:26:25', 39, '2025-05-13 14:26:25');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922177249969934337', '1922132683346649090', '1922164194775056386', '2025-05-13 14:28:08', 55250, '2025-05-13 14:29:03');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922180212645941249', '1922132683346649090', '1922164194775056386', '2025-05-13 14:40:46', 4162, '2025-05-13 14:40:50');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922180441692688385', '1922132683346649090', '1922164194775056386', '2025-05-13 14:41:11', 33346, '2025-05-13 14:41:44');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922180521686454273', '1922132683346649090', '1922164194775056386', '2025-05-13 14:42:00', 3570, '2025-05-13 14:42:03');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922180965825499138', '1922132683346649090', '1922164194775056386', '2025-05-13 14:42:10', 99211, '2025-05-13 14:43:49');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922181034515615746', '1922132683346649090', '1922164194775056386', '2025-05-13 14:43:52', 14005, '2025-05-13 14:44:06');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922183171307982850', '1922132683346649090', '1922164194775056386', '2025-05-13 14:52:15', 19834, '2025-05-13 14:52:35');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922184177068523521', '1922132683346649090', '1922164194775056386', '2025-05-13 14:56:34', 748, '2025-05-13 14:56:35');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922184729043107841', '1922132683346649090', '1922164194775056386', '2025-05-13 14:58:46', 1031, '2025-05-13 14:58:47');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922184806453182465', '1922132683346649090', '1922164194775056386', '2025-05-13 14:59:05', 68, '2025-05-13 14:59:05');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922184918382379009', '1922132683346649090', '1922164194775056386', '2025-05-13 14:59:10', 22155, '2025-05-13 14:59:32');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922185292635844610', '1922132683346649090', '1922164194775056386', '2025-05-13 15:00:55', 6267, '2025-05-13 15:01:01');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922186002672791554', '1922132683346649090', '1922164194775056386', '2025-05-13 15:03:23', 27554, '2025-05-13 15:03:50');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922187506582425601', '1922132683346649090', '1922164194775056386', '2025-05-13 15:09:45', 3464, '2025-05-13 15:09:49');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922187586597163011', '1922132683346649090', '1922164194775056386', '2025-05-13 15:10:08', 82, '2025-05-13 15:10:08');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922187924741951490', '1922132683346649090', '1922164194775056386', '2025-05-13 15:10:49', 39590, '2025-05-13 15:11:28');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922188138710261761', '1922132683346649090', '1922164194775056386', '2025-05-13 15:12:19', 758, '2025-05-13 15:12:19');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922188290661507073', '1922132683346649090', '1922164194775056386', '2025-05-13 15:12:29', 26527, '2025-05-13 15:12:56');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922189701755424769', '1922132683346649090', '1922164194775056386', '2025-05-13 15:18:28', 3619, '2025-05-13 15:18:32');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922190076784803841', '1922132683346649090', '1922164194775056386', '2025-05-13 15:20:01', 741, '2025-05-13 15:20:02');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922836671113101313', '1922132683346649090', '1922164194775056386', '2025-05-15 10:09:21', 186, '2025-05-15 10:09:22');
|
||||||
|
INSERT INTO `open_api_log` VALUES ('1922836856287428610', '1922132683346649090', '1922164194775056386', '2025-05-15 10:10:06', 145, '2025-05-15 10:10:06');
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for open_api_permission
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `open_api_permission`;
|
||||||
|
CREATE TABLE `open_api_permission` (
|
||||||
|
`id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`api_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '接口ID',
|
||||||
|
`api_auth_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '认证ID',
|
||||||
|
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'openapi授权' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of open_api_permission
|
||||||
|
-- ----------------------------
|
||||||
|
INSERT INTO `open_api_permission` VALUES ('1922164225875820545', '1922132683346649090', '1922164194775056386', 'admin', '2025-05-13 13:37:18', NULL, NULL);
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1917957565728198657', '1922109301837606914', '接口文档', '/openapi/SwaggerUI', 'openapi/SwaggerUI', 1, '', null, 1, null, '0', 1, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 23:01:32', 'admin', '2025-05-13 09:59:46', 0, 0, null, 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('1922109301837606914', '', 'OpenApi管理', '/openapi', 'layouts/RouteView', 1, '', null, 0, null, '0', 12.1, 0, 'ant-design:swap-outlined', 0, 0, 0, 0, null, 'admin', '2025-05-13 09:59:03', 'admin', '2025-05-13 10:02:43', 0, 0, null, 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193340030', '1922109301837606914', '接口管理', '/openapi/openApiList', 'openapi/OpenApiList', 1, null, null, 1, null, '1', 0, 0, null, 0, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', 'admin', '2025-05-13 09:59:24', 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193350031', '2025050104193340030', '添加接口管理', null, null, 0, null, null, 2, 'openapi:open_api:add', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193350032', '2025050104193340030', '编辑接口管理', null, null, 0, null, null, 2, 'openapi:open_api:edit', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193350033', '2025050104193340030', '删除接口管理', null, null, 0, null, null, 2, 'openapi:open_api:delete', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193350034', '2025050104193340030', '批量删除接口管理', null, null, 0, null, null, 2, 'openapi:open_api:deleteBatch', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193350035', '2025050104193340030', '导出excel_接口管理', null, null, 0, null, null, 2, 'openapi:open_api:exportXls', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050104193350036', '2025050104193340030', '导入excel_接口管理', null, null, 0, null, null, 2, 'openapi:open_api:importExcel', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 16:19:03', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940200', '1922109301837606914', '授权管理', '/openapi/openApiAuthList', 'openapi/OpenApiAuthList', 1, null, null, 1, null, '1', 0, 0, null, 0, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', 'admin', '2025-05-13 09:59:35', 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940201', '2025050105554940200', '添加授权管理', null, null, 0, null, null, 2, 'openapi:open_api_auth:add', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940202', '2025050105554940200', '编辑授权管理', null, null, 0, null, null, 2, 'openapi:open_api_auth:edit', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940203', '2025050105554940200', '删除授权管理', null, null, 0, null, null, 2, 'openapi:open_api_auth:delete', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940204', '2025050105554940200', '批量删除授权管理', null, null, 0, null, null, 2, 'openapi:open_api_auth:deleteBatch', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940205', '2025050105554940200', '导出excel_授权管理', null, null, 0, null, null, 2, 'openapi:open_api_auth:exportXls', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', null, null, 0, 0, '1', 0);
|
||||||
|
INSERT INTO sys_permission (id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) VALUES ('2025050105554940206', '2025050105554940200', '导入excel_授权管理', null, null, 0, null, null, 2, 'openapi:open_api_auth:importExcel', '1', null, 0, null, 1, 0, 0, 0, null, 'admin', '2025-05-01 17:55:20', null, null, 0, 0, '1', 0);
|
||||||
|
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917957659860963330', 'f6817f48af4fb3af11b9e8bf182f618b', '1917957565728198657', null, '2025-05-01 23:01:55', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1922109760551858178', 'f6817f48af4fb3af11b9e8bf182f618b', '1922109301837606914', null, '2025-05-13 10:00:53', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071739539457', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193340030', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071806648321', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193350031', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071806648322', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193350032', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071806648323', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193350033', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071806648324', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193350034', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071806648325', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193350035', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917857071806648326', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050104193350036', null, '2025-05-01 16:22:13', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917881149426864129', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050105554940200', null, '2025-05-01 17:57:53', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917881149431058436', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050105554940203', null, '2025-05-01 17:57:53', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917881149431058437', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050105554940204', null, '2025-05-01 17:57:53', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917881149431058438', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050105554940205', null, '2025-05-01 17:57:53', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917881149431058439', 'f6817f48af4fb3af11b9e8bf182f618b', '2025050105554940206', null, '2025-05-01 17:57:53', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1917957659860963330', 'f6817f48af4fb3af11b9e8bf182f618b', '1917957565728198657', null, '2025-05-01 23:01:55', '0:0:0:0:0:0:0:1');
|
||||||
|
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('1922109760551858178', 'f6817f48af4fb3af11b9e8bf182f618b', '1922109301837606914', null, '2025-05-13 10:00:53', '0:0:0:0:0:0:0:1');
|
||||||
@ -3,6 +3,7 @@
|
|||||||
> JeecgBoot属于平台级产品,每次升级改动较大,目前做不到平滑升级。
|
> JeecgBoot属于平台级产品,每次升级改动较大,目前做不到平滑升级。
|
||||||
|
|
||||||
### 增量升级方案
|
### 增量升级方案
|
||||||
|
|
||||||
#### 1.代码合并
|
#### 1.代码合并
|
||||||
本地通过svn或git做好主干,在分支上做业务开发,jeecg每次版本发布,可以手工覆盖主干的代码,对比合并代码;
|
本地通过svn或git做好主干,在分支上做业务开发,jeecg每次版本发布,可以手工覆盖主干的代码,对比合并代码;
|
||||||
|
|
||||||
@ -11,5 +12,12 @@
|
|||||||
- 其他库请手工执行SQL, 目录: `jeecg-module-system\jeecg-system-start\src\main\resources\flyway\sql\mysql`
|
- 其他库请手工执行SQL, 目录: `jeecg-module-system\jeecg-system-start\src\main\resources\flyway\sql\mysql`
|
||||||
> 注意: 升级sql只提供mysql版本;如果有权限升级, 还需要手工角色授权,退出重新登录才好使。
|
> 注意: 升级sql只提供mysql版本;如果有权限升级, 还需要手工角色授权,退出重新登录才好使。
|
||||||
|
|
||||||
#### 3.兼容问题
|
#### 3.其他数据库脚本说明
|
||||||
|
原先官方默认提供oracle和SqlServer的脚本,但是维护成本太高,未提供脚本的数据库,可以参考下面的文档自己转
|
||||||
|
https://my.oschina.net/jeecg/blog/4905722
|
||||||
|
(注意:定时任务的表qrtz_*,需要删掉用原始的脚本重新执行一下)
|
||||||
|
quartz-2.2.3-distribution.tar.gz放到百度网盘中,大家自己下载,执行所需数据库脚本
|
||||||
|
https://pan.baidu.com/s/1WrmZdUuAPg3iBwJ-LoHWyg?pwd=8mdz
|
||||||
|
|
||||||
|
#### 4.兼容问题
|
||||||
每次发版,会针对不兼容地方重点说明。
|
每次发版,会针对不兼容地方重点说明。
|
||||||
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-boot-parent</artifactId>
|
<artifactId>jeecg-boot-parent</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>jeecg-boot-base-core</artifactId>
|
<artifactId>jeecg-boot-base-core</artifactId>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<!--jeecg-tools-->
|
<!--jeecg-tools-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-boot-common</artifactId>
|
<artifactId>jeecg-boot-common3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--集成springmvc框架并实现自动配置 -->
|
<!--集成springmvc框架并实现自动配置 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -108,21 +108,32 @@
|
|||||||
<!-- mybatis-plus -->
|
<!-- mybatis-plus -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
|
<version>${mybatis-plus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-jsqlparser-4.9</artifactId>
|
||||||
|
<version>${mybatis-plus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- minidao -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-jsqlparser-4.9</artifactId>
|
||||||
<version>${mybatis-plus.version}</version>
|
<version>${mybatis-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- druid -->
|
<!-- druid -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||||
<version>${druid.version}</version>
|
<version>${druid.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 动态数据源 -->
|
<!-- 动态数据源 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
||||||
<version>${dynamic-datasource-spring-boot-starter.version}</version>
|
<version>${dynamic-datasource-spring-boot-starter.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -191,7 +202,50 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.shiro</groupId>
|
<groupId>org.apache.shiro</groupId>
|
||||||
<artifactId>shiro-spring-boot-starter</artifactId>
|
<artifactId>shiro-spring-boot-starter</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
<version>${shiro.version}</version>
|
<version>${shiro.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-spring</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-spring</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
<version>${shiro.version}</version>
|
||||||
|
<!-- 排除仍使用了javax.servlet的依赖 -->
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-web</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<!-- 引入适配jakarta的依赖包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-core</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
<version>${shiro.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-web</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
<version>${shiro.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- shiro-redis -->
|
<!-- shiro-redis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -210,12 +264,23 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- knife4j -->
|
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j-spring-boot-starter.version}</version>
|
||||||
|
</dependency>-->
|
||||||
|
<!-- knife4j 升级springboot3.4.5报错 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-ui</artifactId>
|
||||||
<version>${knife4j-spring-boot-starter.version}</version>
|
<version>${knife4j-spring-boot-starter.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 代码生成器 -->
|
<!-- 代码生成器 -->
|
||||||
<!-- 如下载失败,请参考此文档 https://help.jeecg.com/java/setup/maven.html -->
|
<!-- 如下载失败,请参考此文档 https://help.jeecg.com/java/setup/maven.html -->
|
||||||
@ -237,7 +302,7 @@
|
|||||||
|
|
||||||
<!-- AutoPoi Excel工具类-->
|
<!-- AutoPoi Excel工具类-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework</groupId>
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
<artifactId>autopoi-web</artifactId>
|
<artifactId>autopoi-web</artifactId>
|
||||||
<version>${autopoi-web.version}</version>
|
<version>${autopoi-web.version}</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
@ -286,6 +351,16 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xkcoding.justauth</groupId>
|
<groupId>com.xkcoding.justauth</groupId>
|
||||||
<artifactId>justauth-spring-boot-starter</artifactId>
|
<artifactId>justauth-spring-boot-starter</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
@ -312,7 +387,12 @@
|
|||||||
<!-- chatgpt -->
|
<!-- chatgpt -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-boot-starter-chatgpt</artifactId>
|
<artifactId>jeecg-boot-starter3-chatgpt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- minidao -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
|
<artifactId>minidao-spring-boot-starter-jsqlparser-4.9</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@ -2,7 +2,7 @@ package org.jeecg.common.api.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,14 +20,14 @@ import org.jeecg.common.system.vo.LoginUser;
|
|||||||
import org.jeecg.common.util.IpUtils;
|
import org.jeecg.common.util.IpUtils;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import javax.servlet.ServletRequest;
|
import jakarta.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import jakarta.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ public class AutoLogAspect {
|
|||||||
// 请求的方法参数值
|
// 请求的方法参数值
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
// 请求的方法参数名称
|
// 请求的方法参数名称
|
||||||
LocalVariableTableParameterNameDiscoverer u = new LocalVariableTableParameterNameDiscoverer();
|
StandardReflectionParameterNameDiscoverer u=new StandardReflectionParameterNameDiscoverer();
|
||||||
String[] paramNames = u.getParameterNames(method);
|
String[] paramNames = u.getParameterNames(method);
|
||||||
if (args != null && paramNames != null) {
|
if (args != null && paramNames != null) {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package org.jeecg.common.exception;
|
package org.jeecg.common.exception;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
@ -32,8 +34,6 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|||||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|||||||
@ -23,9 +23,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: Entity基类
|
* @Description: Entity基类
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import org.jeecg.common.system.vo.SysUserCacheInfo;
|
|||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -6,16 +6,18 @@ import com.auth0.jwt.algorithms.Algorithm;
|
|||||||
import com.auth0.jwt.exceptions.JWTDecodeException;
|
import com.auth0.jwt.exceptions.JWTDecodeException;
|
||||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.ServletResponse;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package org.jeecg.common.util;
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
|||||||
@ -4,13 +4,13 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.handler.IFillRuleHandler;
|
import org.jeecg.common.handler.IFillRuleHandler;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package org.jeecg.common.util;
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package org.jeecg.common.util;
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.ServiceNameConstants;
|
import org.jeecg.common.constant.ServiceNameConstants;
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import org.jeecg.common.exception.JeecgBoot401Exception;
|
|||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author scott
|
* @Author scott
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package org.jeecg.common.util.encryption;
|
package org.jeecg.common.util.encryption;
|
||||||
|
|
||||||
import org.apache.shiro.codec.Base64;
|
import org.apache.shiro.lang.codec.Base64;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import org.jeecg.common.constant.CommonConstant;
|
|||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|||||||
@ -1,255 +1,255 @@
|
|||||||
package org.jeecg.common.util.sqlparse;
|
//package org.jeecg.common.util.sqlparse;
|
||||||
|
//
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
//import net.sf.jsqlparser.JSQLParserException;
|
||||||
import net.sf.jsqlparser.expression.*;
|
//import net.sf.jsqlparser.expression.*;
|
||||||
import net.sf.jsqlparser.parser.CCJSqlParserManager;
|
//import net.sf.jsqlparser.parser.CCJSqlParserManager;
|
||||||
import net.sf.jsqlparser.schema.Column;
|
//import net.sf.jsqlparser.schema.Column;
|
||||||
import net.sf.jsqlparser.schema.Table;
|
//import net.sf.jsqlparser.schema.Table;
|
||||||
import net.sf.jsqlparser.statement.Statement;
|
//import net.sf.jsqlparser.statement.Statement;
|
||||||
import net.sf.jsqlparser.statement.select.*;
|
//import net.sf.jsqlparser.statement.select.*;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
//import org.jeecg.common.exception.JeecgBootException;
|
||||||
import org.jeecg.common.util.sqlparse.vo.SelectSqlInfo;
|
//import org.jeecg.common.util.sqlparse.vo.SelectSqlInfo;
|
||||||
|
//
|
||||||
import java.io.StringReader;
|
//import java.io.StringReader;
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 解析所有表名和字段的类
|
// * 解析所有表名和字段的类
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class JSqlParserAllTableManager {
|
//public class JSqlParserAllTableManager {
|
||||||
|
//
|
||||||
private final String sql;
|
// private final String sql;
|
||||||
private final Map<String, SelectSqlInfo> allTableMap = new HashMap<>();
|
// private final Map<String, SelectSqlInfo> allTableMap = new HashMap<>();
|
||||||
/**
|
// /**
|
||||||
* 别名对应实际表名
|
// * 别名对应实际表名
|
||||||
*/
|
// */
|
||||||
private final Map<String, String> tableAliasMap = new HashMap<>();
|
// private final Map<String, String> tableAliasMap = new HashMap<>();
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 解析后的sql
|
// * 解析后的sql
|
||||||
*/
|
// */
|
||||||
private String parsedSql = null;
|
// private String parsedSql = null;
|
||||||
|
//
|
||||||
JSqlParserAllTableManager(String selectSql) {
|
// JSqlParserAllTableManager(String selectSql) {
|
||||||
this.sql = selectSql;
|
// this.sql = selectSql;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 开始解析
|
// * 开始解析
|
||||||
*
|
// *
|
||||||
* @return
|
// * @return
|
||||||
* @throws JSQLParserException
|
// * @throws JSQLParserException
|
||||||
*/
|
// */
|
||||||
public Map<String, SelectSqlInfo> parse() throws JSQLParserException {
|
// public Map<String, SelectSqlInfo> parse() throws JSQLParserException {
|
||||||
// 1. 创建解析器
|
// // 1. 创建解析器
|
||||||
CCJSqlParserManager mgr = new CCJSqlParserManager();
|
// CCJSqlParserManager mgr = new CCJSqlParserManager();
|
||||||
// 2. 使用解析器解析sql生成具有层次结构的java类
|
// // 2. 使用解析器解析sql生成具有层次结构的java类
|
||||||
Statement stmt = mgr.parse(new StringReader(this.sql));
|
// Statement stmt = mgr.parse(new StringReader(this.sql));
|
||||||
if (stmt instanceof Select) {
|
// if (stmt instanceof Select) {
|
||||||
Select selectStatement = (Select) stmt;
|
// Select selectStatement = (Select) stmt;
|
||||||
SelectBody selectBody = selectStatement.getSelectBody();
|
// SelectBody selectBody = selectStatement.getSelectBody();
|
||||||
this.parsedSql = selectBody.toString();
|
// this.parsedSql = selectBody.toString();
|
||||||
// 3. 解析select查询sql的信息
|
// // 3. 解析select查询sql的信息
|
||||||
if (selectBody instanceof PlainSelect) {
|
// if (selectBody instanceof PlainSelect) {
|
||||||
PlainSelect plainSelect = (PlainSelect) selectBody;
|
// PlainSelect plainSelect = (PlainSelect) selectBody;
|
||||||
// 4. 合并 fromItems
|
// // 4. 合并 fromItems
|
||||||
List<FromItem> fromItems = new ArrayList<>();
|
// List<FromItem> fromItems = new ArrayList<>();
|
||||||
fromItems.add(plainSelect.getFromItem());
|
// fromItems.add(plainSelect.getFromItem());
|
||||||
// 4.1 处理join的表
|
// // 4.1 处理join的表
|
||||||
List<Join> joins = plainSelect.getJoins();
|
// List<Join> joins = plainSelect.getJoins();
|
||||||
if (joins != null) {
|
// if (joins != null) {
|
||||||
joins.forEach(join -> fromItems.add(join.getRightItem()));
|
// joins.forEach(join -> fromItems.add(join.getRightItem()));
|
||||||
}
|
// }
|
||||||
// 5. 处理 fromItems
|
// // 5. 处理 fromItems
|
||||||
for (FromItem fromItem : fromItems) {
|
// for (FromItem fromItem : fromItems) {
|
||||||
// 5.1 通过表名的方式from
|
// // 5.1 通过表名的方式from
|
||||||
if (fromItem instanceof Table) {
|
// if (fromItem instanceof Table) {
|
||||||
this.addSqlInfoByTable((Table) fromItem);
|
// this.addSqlInfoByTable((Table) fromItem);
|
||||||
}
|
// }
|
||||||
// 5.2 通过子查询的方式from
|
// // 5.2 通过子查询的方式from
|
||||||
else if (fromItem instanceof SubSelect) {
|
// else if (fromItem instanceof SubSelect) {
|
||||||
this.handleSubSelect((SubSelect) fromItem);
|
// this.handleSubSelect((SubSelect) fromItem);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 6. 解析 selectFields
|
// // 6. 解析 selectFields
|
||||||
List<SelectItem> selectItems = plainSelect.getSelectItems();
|
// List<SelectItem> selectItems = plainSelect.getSelectItems();
|
||||||
for (SelectItem selectItem : selectItems) {
|
// for (SelectItem selectItem : selectItems) {
|
||||||
// 6.1 查询的是全部字段
|
// // 6.1 查询的是全部字段
|
||||||
if (selectItem instanceof AllColumns) {
|
// if (selectItem instanceof AllColumns) {
|
||||||
// 当 selectItem 为 AllColumns 时,fromItem 必定为 Table
|
// // 当 selectItem 为 AllColumns 时,fromItem 必定为 Table
|
||||||
String tableName = plainSelect.getFromItem(Table.class).getName();
|
// String tableName = plainSelect.getFromItem(Table.class).getName();
|
||||||
// 此处必定不为空,因为在解析 fromItem 时,已经将表名添加到 allTableMap 中
|
// // 此处必定不为空,因为在解析 fromItem 时,已经将表名添加到 allTableMap 中
|
||||||
SelectSqlInfo sqlInfo = this.allTableMap.get(tableName);
|
// SelectSqlInfo sqlInfo = this.allTableMap.get(tableName);
|
||||||
assert sqlInfo != null;
|
// assert sqlInfo != null;
|
||||||
// 设置为查询全部字段
|
// // 设置为查询全部字段
|
||||||
sqlInfo.setSelectAll(true);
|
// sqlInfo.setSelectAll(true);
|
||||||
sqlInfo.setSelectFields(null);
|
// sqlInfo.setSelectFields(null);
|
||||||
sqlInfo.setRealSelectFields(null);
|
// sqlInfo.setRealSelectFields(null);
|
||||||
}
|
// }
|
||||||
// 6.2 查询的是带表别名( u.* )的全部字段
|
// // 6.2 查询的是带表别名( u.* )的全部字段
|
||||||
else if (selectItem instanceof AllTableColumns) {
|
// else if (selectItem instanceof AllTableColumns) {
|
||||||
AllTableColumns allTableColumns = (AllTableColumns) selectItem;
|
// AllTableColumns allTableColumns = (AllTableColumns) selectItem;
|
||||||
String aliasName = allTableColumns.getTable().getName();
|
// String aliasName = allTableColumns.getTable().getName();
|
||||||
// 通过别名获取表名
|
// // 通过别名获取表名
|
||||||
String tableName = this.tableAliasMap.get(aliasName);
|
// String tableName = this.tableAliasMap.get(aliasName);
|
||||||
if (tableName == null) {
|
// if (tableName == null) {
|
||||||
tableName = aliasName;
|
// tableName = aliasName;
|
||||||
}
|
// }
|
||||||
SelectSqlInfo sqlInfo = this.allTableMap.get(tableName);
|
// SelectSqlInfo sqlInfo = this.allTableMap.get(tableName);
|
||||||
// 如果此处为空,则说明该字段是通过子查询获取的,所以可以不处理,只有实际表才需要处理
|
// // 如果此处为空,则说明该字段是通过子查询获取的,所以可以不处理,只有实际表才需要处理
|
||||||
if (sqlInfo != null) {
|
// if (sqlInfo != null) {
|
||||||
// 设置为查询全部字段
|
// // 设置为查询全部字段
|
||||||
sqlInfo.setSelectAll(true);
|
// sqlInfo.setSelectAll(true);
|
||||||
sqlInfo.setSelectFields(null);
|
// sqlInfo.setSelectFields(null);
|
||||||
sqlInfo.setRealSelectFields(null);
|
// sqlInfo.setRealSelectFields(null);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 6.3 各种字段表达式处理
|
// // 6.3 各种字段表达式处理
|
||||||
else if (selectItem instanceof SelectExpressionItem) {
|
// else if (selectItem instanceof SelectExpressionItem) {
|
||||||
SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem;
|
// SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem;
|
||||||
Expression expression = selectExpressionItem.getExpression();
|
// Expression expression = selectExpressionItem.getExpression();
|
||||||
Alias alias = selectExpressionItem.getAlias();
|
// Alias alias = selectExpressionItem.getAlias();
|
||||||
this.handleExpression(expression, alias, plainSelect.getFromItem());
|
// this.handleExpression(expression, alias, plainSelect.getFromItem());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
log.warn("暂时尚未处理该类型的 SelectBody: {}", selectBody.getClass().getName());
|
// log.warn("暂时尚未处理该类型的 SelectBody: {}", selectBody.getClass().getName());
|
||||||
throw new JeecgBootException("暂时尚未处理该类型的 SelectBody");
|
// throw new JeecgBootException("暂时尚未处理该类型的 SelectBody");
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
// 非 select 查询sql,不做处理
|
// // 非 select 查询sql,不做处理
|
||||||
throw new JeecgBootException("非 select 查询sql,不做处理");
|
// throw new JeecgBootException("非 select 查询sql,不做处理");
|
||||||
}
|
// }
|
||||||
return this.allTableMap;
|
// return this.allTableMap;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 处理子查询
|
// * 处理子查询
|
||||||
*
|
// *
|
||||||
* @param subSelect
|
// * @param subSelect
|
||||||
*/
|
// */
|
||||||
private void handleSubSelect(SubSelect subSelect) {
|
// private void handleSubSelect(SubSelect subSelect) {
|
||||||
try {
|
// try {
|
||||||
String subSelectSql = subSelect.getSelectBody().toString();
|
// String subSelectSql = subSelect.getSelectBody().toString();
|
||||||
// 递归调用解析
|
// // 递归调用解析
|
||||||
Map<String, SelectSqlInfo> map = JSqlParserUtils.parseAllSelectTable(subSelectSql);
|
// Map<String, SelectSqlInfo> map = JSqlParserUtils.parseAllSelectTable(subSelectSql);
|
||||||
if (map != null) {
|
// if (map != null) {
|
||||||
this.assignMap(map);
|
// this.assignMap(map);
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
log.error("解析子查询出错", e);
|
// log.error("解析子查询出错", e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 处理查询字段表达式
|
// * 处理查询字段表达式
|
||||||
*
|
// *
|
||||||
* @param expression
|
// * @param expression
|
||||||
*/
|
// */
|
||||||
private void handleExpression(Expression expression, Alias alias, FromItem fromItem) {
|
// private void handleExpression(Expression expression, Alias alias, FromItem fromItem) {
|
||||||
// 处理函数式字段 CONCAT(name,'(',age,')')
|
// // 处理函数式字段 CONCAT(name,'(',age,')')
|
||||||
if (expression instanceof Function) {
|
// if (expression instanceof Function) {
|
||||||
Function functionExp = (Function) expression;
|
// Function functionExp = (Function) expression;
|
||||||
List<Expression> expressions = functionExp.getParameters().getExpressions();
|
// List<Expression> expressions = functionExp.getParameters().getExpressions();
|
||||||
for (Expression expItem : expressions) {
|
// for (Expression expItem : expressions) {
|
||||||
this.handleExpression(expItem, null, fromItem);
|
// this.handleExpression(expItem, null, fromItem);
|
||||||
}
|
// }
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// 处理字段上的子查询
|
// // 处理字段上的子查询
|
||||||
if (expression instanceof SubSelect) {
|
// if (expression instanceof SubSelect) {
|
||||||
this.handleSubSelect((SubSelect) expression);
|
// this.handleSubSelect((SubSelect) expression);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// 不处理字面量
|
// // 不处理字面量
|
||||||
if (expression instanceof StringValue ||
|
// if (expression instanceof StringValue ||
|
||||||
expression instanceof NullValue ||
|
// expression instanceof NullValue ||
|
||||||
expression instanceof LongValue ||
|
// expression instanceof LongValue ||
|
||||||
expression instanceof DoubleValue ||
|
// expression instanceof DoubleValue ||
|
||||||
expression instanceof HexValue ||
|
// expression instanceof HexValue ||
|
||||||
expression instanceof DateValue ||
|
// expression instanceof DateValue ||
|
||||||
expression instanceof TimestampValue ||
|
// expression instanceof TimestampValue ||
|
||||||
expression instanceof TimeValue
|
// expression instanceof TimeValue
|
||||||
) {
|
// ) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 处理字段
|
// // 处理字段
|
||||||
if (expression instanceof Column) {
|
// if (expression instanceof Column) {
|
||||||
Column column = (Column) expression;
|
// Column column = (Column) expression;
|
||||||
// 查询字段名
|
// // 查询字段名
|
||||||
String fieldName = column.getColumnName();
|
// String fieldName = column.getColumnName();
|
||||||
String aliasName = fieldName;
|
// String aliasName = fieldName;
|
||||||
if (alias != null) {
|
// if (alias != null) {
|
||||||
aliasName = alias.getName();
|
// aliasName = alias.getName();
|
||||||
}
|
// }
|
||||||
String tableName;
|
// String tableName;
|
||||||
if (column.getTable() != null) {
|
// if (column.getTable() != null) {
|
||||||
// 通过列的表名获取 sqlInfo
|
// // 通过列的表名获取 sqlInfo
|
||||||
// 例如 user.name,这里的 tableName 就是 user
|
// // 例如 user.name,这里的 tableName 就是 user
|
||||||
tableName = column.getTable().getName();
|
// tableName = column.getTable().getName();
|
||||||
// 有可能是别名,需要转换为真实表名
|
// // 有可能是别名,需要转换为真实表名
|
||||||
if (this.tableAliasMap.get(tableName) != null) {
|
// if (this.tableAliasMap.get(tableName) != null) {
|
||||||
tableName = this.tableAliasMap.get(tableName);
|
// tableName = this.tableAliasMap.get(tableName);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
// 当column的table为空时,说明是 fromItem 中的字段
|
// // 当column的table为空时,说明是 fromItem 中的字段
|
||||||
tableName = ((Table) fromItem).getName();
|
// tableName = ((Table) fromItem).getName();
|
||||||
}
|
// }
|
||||||
SelectSqlInfo $sqlInfo = this.allTableMap.get(tableName);
|
// SelectSqlInfo $sqlInfo = this.allTableMap.get(tableName);
|
||||||
if ($sqlInfo != null) {
|
// if ($sqlInfo != null) {
|
||||||
$sqlInfo.addSelectField(aliasName, fieldName);
|
// $sqlInfo.addSelectField(aliasName, fieldName);
|
||||||
} else {
|
// } else {
|
||||||
log.warn("发生意外情况,未找到表名为 {} 的 SelectSqlInfo", tableName);
|
// log.warn("发生意外情况,未找到表名为 {} 的 SelectSqlInfo", tableName);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据表名添加sqlInfo
|
// * 根据表名添加sqlInfo
|
||||||
*
|
// *
|
||||||
* @param table
|
// * @param table
|
||||||
*/
|
// */
|
||||||
private void addSqlInfoByTable(Table table) {
|
// private void addSqlInfoByTable(Table table) {
|
||||||
String tableName = table.getName();
|
// String tableName = table.getName();
|
||||||
// 解析 aliasName
|
// // 解析 aliasName
|
||||||
if (table.getAlias() != null) {
|
// if (table.getAlias() != null) {
|
||||||
this.tableAliasMap.put(table.getAlias().getName(), tableName);
|
// this.tableAliasMap.put(table.getAlias().getName(), tableName);
|
||||||
}
|
// }
|
||||||
SelectSqlInfo sqlInfo = new SelectSqlInfo(this.parsedSql);
|
// SelectSqlInfo sqlInfo = new SelectSqlInfo(this.parsedSql);
|
||||||
sqlInfo.setFromTableName(table.getName());
|
// sqlInfo.setFromTableName(table.getName());
|
||||||
this.allTableMap.put(sqlInfo.getFromTableName(), sqlInfo);
|
// this.allTableMap.put(sqlInfo.getFromTableName(), sqlInfo);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 合并map
|
// * 合并map
|
||||||
*
|
// *
|
||||||
* @param source
|
// * @param source
|
||||||
*/
|
// */
|
||||||
private void assignMap(Map<String, SelectSqlInfo> source) {
|
// private void assignMap(Map<String, SelectSqlInfo> source) {
|
||||||
for (Map.Entry<String, SelectSqlInfo> entry : source.entrySet()) {
|
// for (Map.Entry<String, SelectSqlInfo> entry : source.entrySet()) {
|
||||||
SelectSqlInfo sqlInfo = this.allTableMap.get(entry.getKey());
|
// SelectSqlInfo sqlInfo = this.allTableMap.get(entry.getKey());
|
||||||
if (sqlInfo == null) {
|
// if (sqlInfo == null) {
|
||||||
this.allTableMap.put(entry.getKey(), entry.getValue());
|
// this.allTableMap.put(entry.getKey(), entry.getValue());
|
||||||
} else {
|
// } else {
|
||||||
// 合并
|
// // 合并
|
||||||
if (sqlInfo.getSelectFields() == null) {
|
// if (sqlInfo.getSelectFields() == null) {
|
||||||
sqlInfo.setSelectFields(entry.getValue().getSelectFields());
|
// sqlInfo.setSelectFields(entry.getValue().getSelectFields());
|
||||||
} else {
|
// } else {
|
||||||
sqlInfo.getSelectFields().addAll(entry.getValue().getSelectFields());
|
// sqlInfo.getSelectFields().addAll(entry.getValue().getSelectFields());
|
||||||
}
|
// }
|
||||||
if (sqlInfo.getRealSelectFields() == null) {
|
// if (sqlInfo.getRealSelectFields() == null) {
|
||||||
sqlInfo.setRealSelectFields(entry.getValue().getRealSelectFields());
|
// sqlInfo.setRealSelectFields(entry.getValue().getRealSelectFields());
|
||||||
} else {
|
// } else {
|
||||||
sqlInfo.getRealSelectFields().addAll(entry.getValue().getRealSelectFields());
|
// sqlInfo.getRealSelectFields().addAll(entry.getValue().getRealSelectFields());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@ -1,190 +1,190 @@
|
|||||||
package org.jeecg.common.util.sqlparse;
|
//package org.jeecg.common.util.sqlparse;
|
||||||
|
//
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
//import net.sf.jsqlparser.JSQLParserException;
|
||||||
import net.sf.jsqlparser.expression.*;
|
//import net.sf.jsqlparser.expression.*;
|
||||||
import net.sf.jsqlparser.parser.CCJSqlParserManager;
|
//import net.sf.jsqlparser.parser.CCJSqlParserManager;
|
||||||
import net.sf.jsqlparser.schema.Column;
|
//import net.sf.jsqlparser.schema.Column;
|
||||||
import net.sf.jsqlparser.schema.Table;
|
//import net.sf.jsqlparser.schema.Table;
|
||||||
import net.sf.jsqlparser.statement.Statement;
|
//import net.sf.jsqlparser.statement.Statement;
|
||||||
import net.sf.jsqlparser.statement.select.*;
|
//import net.sf.jsqlparser.statement.select.*;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
//import org.jeecg.common.exception.JeecgBootException;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
//import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.common.util.sqlparse.vo.SelectSqlInfo;
|
//import org.jeecg.common.util.sqlparse.vo.SelectSqlInfo;
|
||||||
|
//
|
||||||
import java.io.StringReader;
|
//import java.io.StringReader;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class JSqlParserUtils {
|
//public class JSqlParserUtils {
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 解析 查询(select)sql的信息,
|
// * 解析 查询(select)sql的信息,
|
||||||
* 此方法会展开所有子查询到一个map里,
|
// * 此方法会展开所有子查询到一个map里,
|
||||||
* key只存真实的表名,如果查询的没有真实的表名,则会被忽略。
|
// * key只存真实的表名,如果查询的没有真实的表名,则会被忽略。
|
||||||
* value只存真实的字段名,如果查询的没有真实的字段名,则会被忽略。
|
// * value只存真实的字段名,如果查询的没有真实的字段名,则会被忽略。
|
||||||
* <p>
|
// * <p>
|
||||||
* 例如:SELECT a.*,d.age,(SELECT count(1) FROM sys_depart) AS count FROM (SELECT username AS foo, realname FROM sys_user) a, demo d
|
// * 例如:SELECT a.*,d.age,(SELECT count(1) FROM sys_depart) AS count FROM (SELECT username AS foo, realname FROM sys_user) a, demo d
|
||||||
* 解析后的结果为:{sys_user=[username, realname], demo=[age], sys_depart=[]}
|
// * 解析后的结果为:{sys_user=[username, realname], demo=[age], sys_depart=[]}
|
||||||
*
|
// *
|
||||||
* @param selectSql
|
// * @param selectSql
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
public static Map<String, SelectSqlInfo> parseAllSelectTable(String selectSql) throws JSQLParserException {
|
// public static Map<String, SelectSqlInfo> parseAllSelectTable(String selectSql) throws JSQLParserException {
|
||||||
if (oConvertUtils.isEmpty(selectSql)) {
|
// if (oConvertUtils.isEmpty(selectSql)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// log.info("解析查询Sql:{}", selectSql);
|
// // log.info("解析查询Sql:{}", selectSql);
|
||||||
JSqlParserAllTableManager allTableManager = new JSqlParserAllTableManager(selectSql);
|
// JSqlParserAllTableManager allTableManager = new JSqlParserAllTableManager(selectSql);
|
||||||
return allTableManager.parse();
|
// return allTableManager.parse();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 解析 查询(select)sql的信息,子查询嵌套
|
// * 解析 查询(select)sql的信息,子查询嵌套
|
||||||
*
|
// *
|
||||||
* @param selectSql
|
// * @param selectSql
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
public static SelectSqlInfo parseSelectSqlInfo(String selectSql) throws JSQLParserException {
|
// public static SelectSqlInfo parseSelectSqlInfo(String selectSql) throws JSQLParserException {
|
||||||
if (oConvertUtils.isEmpty(selectSql)) {
|
// if (oConvertUtils.isEmpty(selectSql)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// log.info("解析查询Sql:{}", selectSql);
|
// // log.info("解析查询Sql:{}", selectSql);
|
||||||
// 使用 JSqlParer 解析sql
|
// // 使用 JSqlParer 解析sql
|
||||||
// 1、创建解析器
|
// // 1、创建解析器
|
||||||
CCJSqlParserManager mgr = new CCJSqlParserManager();
|
// CCJSqlParserManager mgr = new CCJSqlParserManager();
|
||||||
// 2、使用解析器解析sql生成具有层次结构的java类
|
// // 2、使用解析器解析sql生成具有层次结构的java类
|
||||||
Statement stmt = mgr.parse(new StringReader(selectSql));
|
// Statement stmt = mgr.parse(new StringReader(selectSql));
|
||||||
if (stmt instanceof Select) {
|
// if (stmt instanceof Select) {
|
||||||
Select selectStatement = (Select) stmt;
|
// Select selectStatement = (Select) stmt;
|
||||||
// 3、解析select查询sql的信息
|
// // 3、解析select查询sql的信息
|
||||||
return JSqlParserUtils.parseBySelectBody(selectStatement.getSelectBody());
|
// return JSqlParserUtils.parseBySelectBody(selectStatement.getSelectBody());
|
||||||
} else {
|
// } else {
|
||||||
// 非 select 查询sql,不做处理
|
// // 非 select 查询sql,不做处理
|
||||||
throw new JeecgBootException("非 select 查询sql,不做处理");
|
// throw new JeecgBootException("非 select 查询sql,不做处理");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 解析 select 查询sql的信息
|
// * 解析 select 查询sql的信息
|
||||||
*
|
// *
|
||||||
* @param selectBody
|
// * @param selectBody
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
private static SelectSqlInfo parseBySelectBody(SelectBody selectBody) {
|
// private static SelectSqlInfo parseBySelectBody(SelectBody selectBody) {
|
||||||
// 判断是否使用了union等操作
|
// // 判断是否使用了union等操作
|
||||||
if (selectBody instanceof SetOperationList) {
|
// if (selectBody instanceof SetOperationList) {
|
||||||
// 如果使用了union等操作,则只解析第一个查询
|
// // 如果使用了union等操作,则只解析第一个查询
|
||||||
List<SelectBody> selectBodyList = ((SetOperationList) selectBody).getSelects();
|
// List<SelectBody> selectBodyList = ((SetOperationList) selectBody).getSelects();
|
||||||
return JSqlParserUtils.parseBySelectBody(selectBodyList.get(0));
|
// return JSqlParserUtils.parseBySelectBody(selectBodyList.get(0));
|
||||||
}
|
// }
|
||||||
// 简单的select查询
|
// // 简单的select查询
|
||||||
if (selectBody instanceof PlainSelect) {
|
// if (selectBody instanceof PlainSelect) {
|
||||||
SelectSqlInfo sqlInfo = new SelectSqlInfo(selectBody);
|
// SelectSqlInfo sqlInfo = new SelectSqlInfo(selectBody);
|
||||||
PlainSelect plainSelect = (PlainSelect) selectBody;
|
// PlainSelect plainSelect = (PlainSelect) selectBody;
|
||||||
FromItem fromItem = plainSelect.getFromItem();
|
// FromItem fromItem = plainSelect.getFromItem();
|
||||||
// 解析 aliasName
|
// // 解析 aliasName
|
||||||
if (fromItem.getAlias() != null) {
|
// if (fromItem.getAlias() != null) {
|
||||||
sqlInfo.setFromTableAliasName(fromItem.getAlias().getName());
|
// sqlInfo.setFromTableAliasName(fromItem.getAlias().getName());
|
||||||
}
|
// }
|
||||||
// 解析 表名
|
// // 解析 表名
|
||||||
if (fromItem instanceof Table) {
|
// if (fromItem instanceof Table) {
|
||||||
// 通过表名的方式from
|
// // 通过表名的方式from
|
||||||
Table fromTable = (Table) fromItem;
|
// Table fromTable = (Table) fromItem;
|
||||||
sqlInfo.setFromTableName(fromTable.getName());
|
// sqlInfo.setFromTableName(fromTable.getName());
|
||||||
} else if (fromItem instanceof SubSelect) {
|
// } else if (fromItem instanceof SubSelect) {
|
||||||
// 通过子查询的方式from
|
// // 通过子查询的方式from
|
||||||
SubSelect fromSubSelect = (SubSelect) fromItem;
|
// SubSelect fromSubSelect = (SubSelect) fromItem;
|
||||||
SelectSqlInfo subSqlInfo = JSqlParserUtils.parseBySelectBody(fromSubSelect.getSelectBody());
|
// SelectSqlInfo subSqlInfo = JSqlParserUtils.parseBySelectBody(fromSubSelect.getSelectBody());
|
||||||
sqlInfo.setFromSubSelect(subSqlInfo);
|
// sqlInfo.setFromSubSelect(subSqlInfo);
|
||||||
}
|
// }
|
||||||
// 解析 selectFields
|
// // 解析 selectFields
|
||||||
List<SelectItem> selectItems = plainSelect.getSelectItems();
|
// List<SelectItem> selectItems = plainSelect.getSelectItems();
|
||||||
for (SelectItem selectItem : selectItems) {
|
// for (SelectItem selectItem : selectItems) {
|
||||||
if (selectItem instanceof AllColumns || selectItem instanceof AllTableColumns) {
|
// if (selectItem instanceof AllColumns || selectItem instanceof AllTableColumns) {
|
||||||
// 全部字段
|
// // 全部字段
|
||||||
sqlInfo.setSelectAll(true);
|
// sqlInfo.setSelectAll(true);
|
||||||
sqlInfo.setSelectFields(null);
|
// sqlInfo.setSelectFields(null);
|
||||||
sqlInfo.setRealSelectFields(null);
|
// sqlInfo.setRealSelectFields(null);
|
||||||
break;
|
// break;
|
||||||
} else if (selectItem instanceof SelectExpressionItem) {
|
// } else if (selectItem instanceof SelectExpressionItem) {
|
||||||
// 获取单个查询字段名
|
// // 获取单个查询字段名
|
||||||
SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem;
|
// SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem;
|
||||||
Expression expression = selectExpressionItem.getExpression();
|
// Expression expression = selectExpressionItem.getExpression();
|
||||||
Alias alias = selectExpressionItem.getAlias();
|
// Alias alias = selectExpressionItem.getAlias();
|
||||||
JSqlParserUtils.handleExpression(sqlInfo, expression, alias);
|
// JSqlParserUtils.handleExpression(sqlInfo, expression, alias);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return sqlInfo;
|
// return sqlInfo;
|
||||||
} else {
|
// } else {
|
||||||
log.warn("暂时尚未处理该类型的 SelectBody: {}", selectBody.getClass().getName());
|
// log.warn("暂时尚未处理该类型的 SelectBody: {}", selectBody.getClass().getName());
|
||||||
throw new JeecgBootException("暂时尚未处理该类型的 SelectBody");
|
// throw new JeecgBootException("暂时尚未处理该类型的 SelectBody");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 处理查询字段表达式
|
// * 处理查询字段表达式
|
||||||
*
|
// *
|
||||||
* @param sqlInfo
|
// * @param sqlInfo
|
||||||
* @param expression
|
// * @param expression
|
||||||
* @param alias 是否有别名,无传null
|
// * @param alias 是否有别名,无传null
|
||||||
*/
|
// */
|
||||||
private static void handleExpression(SelectSqlInfo sqlInfo, Expression expression, Alias alias) {
|
// private static void handleExpression(SelectSqlInfo sqlInfo, Expression expression, Alias alias) {
|
||||||
// 处理函数式字段 CONCAT(name,'(',age,')')
|
// // 处理函数式字段 CONCAT(name,'(',age,')')
|
||||||
if (expression instanceof Function) {
|
// if (expression instanceof Function) {
|
||||||
JSqlParserUtils.handleFunctionExpression((Function) expression, sqlInfo);
|
// JSqlParserUtils.handleFunctionExpression((Function) expression, sqlInfo);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// 处理字段上的子查询
|
// // 处理字段上的子查询
|
||||||
if (expression instanceof SubSelect) {
|
// if (expression instanceof SubSelect) {
|
||||||
SubSelect subSelect = (SubSelect) expression;
|
// SubSelect subSelect = (SubSelect) expression;
|
||||||
SelectSqlInfo subSqlInfo = JSqlParserUtils.parseBySelectBody(subSelect.getSelectBody());
|
// SelectSqlInfo subSqlInfo = JSqlParserUtils.parseBySelectBody(subSelect.getSelectBody());
|
||||||
// 注:字段上的子查询,必须只查询一个字段,否则会报错,所以可以放心合并
|
// // 注:字段上的子查询,必须只查询一个字段,否则会报错,所以可以放心合并
|
||||||
sqlInfo.getSelectFields().addAll(subSqlInfo.getSelectFields());
|
// sqlInfo.getSelectFields().addAll(subSqlInfo.getSelectFields());
|
||||||
sqlInfo.getRealSelectFields().addAll(subSqlInfo.getAllRealSelectFields());
|
// sqlInfo.getRealSelectFields().addAll(subSqlInfo.getAllRealSelectFields());
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// 不处理字面量
|
// // 不处理字面量
|
||||||
if (expression instanceof StringValue ||
|
// if (expression instanceof StringValue ||
|
||||||
expression instanceof NullValue ||
|
// expression instanceof NullValue ||
|
||||||
expression instanceof LongValue ||
|
// expression instanceof LongValue ||
|
||||||
expression instanceof DoubleValue ||
|
// expression instanceof DoubleValue ||
|
||||||
expression instanceof HexValue ||
|
// expression instanceof HexValue ||
|
||||||
expression instanceof DateValue ||
|
// expression instanceof DateValue ||
|
||||||
expression instanceof TimestampValue ||
|
// expression instanceof TimestampValue ||
|
||||||
expression instanceof TimeValue
|
// expression instanceof TimeValue
|
||||||
) {
|
// ) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 查询字段名
|
// // 查询字段名
|
||||||
String selectField = expression.toString();
|
// String selectField = expression.toString();
|
||||||
// 实际查询字段名
|
// // 实际查询字段名
|
||||||
String realSelectField = selectField;
|
// String realSelectField = selectField;
|
||||||
// 判断是否有别名
|
// // 判断是否有别名
|
||||||
if (alias != null) {
|
// if (alias != null) {
|
||||||
selectField = alias.getName();
|
// selectField = alias.getName();
|
||||||
}
|
// }
|
||||||
// 获取真实字段名
|
// // 获取真实字段名
|
||||||
if (expression instanceof Column) {
|
// if (expression instanceof Column) {
|
||||||
Column column = (Column) expression;
|
// Column column = (Column) expression;
|
||||||
realSelectField = column.getColumnName();
|
// realSelectField = column.getColumnName();
|
||||||
}
|
// }
|
||||||
sqlInfo.addSelectField(selectField, realSelectField);
|
// sqlInfo.addSelectField(selectField, realSelectField);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 处理函数式字段
|
// * 处理函数式字段
|
||||||
*
|
// *
|
||||||
* @param functionExp
|
// * @param functionExp
|
||||||
* @param sqlInfo
|
// * @param sqlInfo
|
||||||
*/
|
// */
|
||||||
private static void handleFunctionExpression(Function functionExp, SelectSqlInfo sqlInfo) {
|
// private static void handleFunctionExpression(Function functionExp, SelectSqlInfo sqlInfo) {
|
||||||
List<Expression> expressions = functionExp.getParameters().getExpressions();
|
// List<Expression> expressions = functionExp.getParameters().getExpressions();
|
||||||
for (Expression expression : expressions) {
|
// for (Expression expression : expressions) {
|
||||||
JSqlParserUtils.handleExpression(sqlInfo, expression, null);
|
// JSqlParserUtils.handleExpression(sqlInfo, expression, null);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@ -1,101 +1,101 @@
|
|||||||
package org.jeecg.common.util.sqlparse.vo;
|
//package org.jeecg.common.util.sqlparse.vo;
|
||||||
|
//
|
||||||
import lombok.Data;
|
//import lombok.Data;
|
||||||
import net.sf.jsqlparser.statement.select.SelectBody;
|
//import net.sf.jsqlparser.statement.select.SelectBody;
|
||||||
|
//
|
||||||
import java.util.HashSet;
|
//import java.util.HashSet;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* select 查询 sql 的信息
|
// * select 查询 sql 的信息
|
||||||
*/
|
// */
|
||||||
@Data
|
//@Data
|
||||||
public class SelectSqlInfo {
|
//public class SelectSqlInfo {
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 查询的表名,如果是子查询,则此处为null
|
// * 查询的表名,如果是子查询,则此处为null
|
||||||
*/
|
// */
|
||||||
private String fromTableName;
|
// private String fromTableName;
|
||||||
/**
|
// /**
|
||||||
* 表别名
|
// * 表别名
|
||||||
*/
|
// */
|
||||||
private String fromTableAliasName;
|
// private String fromTableAliasName;
|
||||||
/**
|
// /**
|
||||||
* 通过子查询获取的表信息,例如:select name from (select * from user) u
|
// * 通过子查询获取的表信息,例如:select name from (select * from user) u
|
||||||
* 如果不是子查询,则为null
|
// * 如果不是子查询,则为null
|
||||||
*/
|
// */
|
||||||
private SelectSqlInfo fromSubSelect;
|
// private SelectSqlInfo fromSubSelect;
|
||||||
/**
|
// /**
|
||||||
* 查询的字段集合,如果是 * 则为null,如果设了别名则为别名
|
// * 查询的字段集合,如果是 * 则为null,如果设了别名则为别名
|
||||||
*/
|
// */
|
||||||
private Set<String> selectFields;
|
// private Set<String> selectFields;
|
||||||
/**
|
// /**
|
||||||
* 真实的查询字段集合,如果是 * 则为null,如果设了别名则为原始字段名
|
// * 真实的查询字段集合,如果是 * 则为null,如果设了别名则为原始字段名
|
||||||
*/
|
// */
|
||||||
private Set<String> realSelectFields;
|
// private Set<String> realSelectFields;
|
||||||
/**
|
// /**
|
||||||
* 是否是查询所有字段
|
// * 是否是查询所有字段
|
||||||
*/
|
// */
|
||||||
private boolean selectAll;
|
// private boolean selectAll;
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 解析之后的 SQL (关键字都是大写)
|
// * 解析之后的 SQL (关键字都是大写)
|
||||||
*/
|
// */
|
||||||
private final String parsedSql;
|
// private final String parsedSql;
|
||||||
|
//
|
||||||
public SelectSqlInfo(String parsedSql) {
|
// public SelectSqlInfo(String parsedSql) {
|
||||||
this.parsedSql = parsedSql;
|
// this.parsedSql = parsedSql;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public SelectSqlInfo(SelectBody selectBody) {
|
// public SelectSqlInfo(SelectBody selectBody) {
|
||||||
this.parsedSql = selectBody.toString();
|
// this.parsedSql = selectBody.toString();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void addSelectField(String selectField, String realSelectField) {
|
// public void addSelectField(String selectField, String realSelectField) {
|
||||||
if (this.selectFields == null) {
|
// if (this.selectFields == null) {
|
||||||
this.selectFields = new HashSet<>();
|
// this.selectFields = new HashSet<>();
|
||||||
}
|
// }
|
||||||
if (this.realSelectFields == null) {
|
// if (this.realSelectFields == null) {
|
||||||
this.realSelectFields = new HashSet<>();
|
// this.realSelectFields = new HashSet<>();
|
||||||
}
|
// }
|
||||||
this.selectFields.add(selectField);
|
// this.selectFields.add(selectField);
|
||||||
this.realSelectFields.add(realSelectField);
|
// this.realSelectFields.add(realSelectField);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 获取所有字段,包括子查询里的。
|
// * 获取所有字段,包括子查询里的。
|
||||||
*
|
// *
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
public Set<String> getAllRealSelectFields() {
|
// public Set<String> getAllRealSelectFields() {
|
||||||
Set<String> fields = new HashSet<>();
|
// Set<String> fields = new HashSet<>();
|
||||||
// 递归获取所有字段,起个直观的方法名为:
|
// // 递归获取所有字段,起个直观的方法名为:
|
||||||
this.recursiveGetAllFields(this, fields);
|
// this.recursiveGetAllFields(this, fields);
|
||||||
return fields;
|
// return fields;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 递归获取所有字段
|
// * 递归获取所有字段
|
||||||
*/
|
// */
|
||||||
private void recursiveGetAllFields(SelectSqlInfo sqlInfo, Set<String> fields) {
|
// private void recursiveGetAllFields(SelectSqlInfo sqlInfo, Set<String> fields) {
|
||||||
if (!sqlInfo.isSelectAll() && sqlInfo.getRealSelectFields() != null) {
|
// if (!sqlInfo.isSelectAll() && sqlInfo.getRealSelectFields() != null) {
|
||||||
fields.addAll(sqlInfo.getRealSelectFields());
|
// fields.addAll(sqlInfo.getRealSelectFields());
|
||||||
}
|
// }
|
||||||
if (sqlInfo.getFromSubSelect() != null) {
|
// if (sqlInfo.getFromSubSelect() != null) {
|
||||||
recursiveGetAllFields(sqlInfo.getFromSubSelect(), fields);
|
// recursiveGetAllFields(sqlInfo.getFromSubSelect(), fields);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String toString() {
|
// public String toString() {
|
||||||
return "SelectSqlInfo{" +
|
// return "SelectSqlInfo{" +
|
||||||
"fromTableName='" + fromTableName + '\'' +
|
// "fromTableName='" + fromTableName + '\'' +
|
||||||
", fromSubSelect=" + fromSubSelect +
|
// ", fromSubSelect=" + fromSubSelect +
|
||||||
", aliasName='" + fromTableAliasName + '\'' +
|
// ", aliasName='" + fromTableAliasName + '\'' +
|
||||||
", selectFields=" + selectFields +
|
// ", selectFields=" + selectFields +
|
||||||
", realSelectFields=" + realSelectFields +
|
// ", realSelectFields=" + realSelectFields +
|
||||||
", selectAll=" + selectAll +
|
// ", selectAll=" + selectAll +
|
||||||
"}";
|
// "}";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package org.jeecg.config;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
import org.jeecg.common.api.CommonAPI;
|
import org.jeecg.common.api.CommonAPI;
|
||||||
import org.jeecg.common.system.vo.DictModel;
|
import org.jeecg.common.system.vo.DictModel;
|
||||||
|
|||||||
@ -2,7 +2,9 @@ package org.jeecg.config;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.*;
|
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
|
import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
|
||||||
|
import jakarta.servlet.*;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@ -11,8 +13,6 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
|
||||||
import com.alibaba.druid.util.Utils;
|
import com.alibaba.druid.util.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author eightmonth@qq.com
|
||||||
* 启动程序修改DruidWallConfig配置
|
* 启动程序修改DruidWallConfig配置
|
||||||
* 允许SELECT语句的WHERE子句是一个永真条件
|
* 允许SELECT语句的WHERE子句是一个永真条件
|
||||||
* @author eightmonth
|
* @author eightmonth
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.jeecg.config;
|
package org.jeecg.config;
|
||||||
|
|
||||||
import org.jeecg.config.vo.*;
|
import org.jeecg.config.vo.*;
|
||||||
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Role;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
@ -11,6 +14,7 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Component("jeecgBaseConfig")
|
@Component("jeecgBaseConfig")
|
||||||
@ConfigurationProperties(prefix = "jeecg")
|
@ConfigurationProperties(prefix = "jeecg")
|
||||||
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
public class JeecgBaseConfig {
|
public class JeecgBaseConfig {
|
||||||
/**
|
/**
|
||||||
* 签名密钥串(字典等敏感接口)
|
* 签名密钥串(字典等敏感接口)
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
package org.jeecg.config;
|
||||||
|
|
||||||
|
import io.undertow.server.DefaultByteBufferPool;
|
||||||
|
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
|
||||||
|
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
|
||||||
|
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class UndertowCustomizer implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
|
||||||
|
@Override
|
||||||
|
public void customize(UndertowServletWebServerFactory factory) {
|
||||||
|
factory.addDeploymentInfoCustomizers(deploymentInfo -> {
|
||||||
|
WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
|
||||||
|
webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024));
|
||||||
|
deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,20 +10,23 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
|||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||||
import io.micrometer.prometheus.PrometheusMeterRegistry;
|
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
|
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
|
import org.springframework.boot.autoconfigure.jackson.JacksonProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.http.CacheControl;
|
import org.springframework.http.CacheControl;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
@ -33,7 +36,6 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
|
|||||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package org.jeecg.config.filter;
|
|||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.config.sign.util.BodyReaderHttpServletRequestWrapper;
|
import org.jeecg.config.sign.util.BodyReaderHttpServletRequestWrapper;
|
||||||
|
|
||||||
import javax.servlet.*;
|
import jakarta.servlet.*;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,9 +7,9 @@ import org.jeecg.common.util.SpringContextUtils;
|
|||||||
import org.jeecg.common.util.TokenUtils;
|
import org.jeecg.common.util.TokenUtils;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
|
||||||
import javax.servlet.*;
|
import jakarta.servlet.*;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -6,20 +6,17 @@ import org.apache.shiro.SecurityUtils;
|
|||||||
import org.jeecg.common.api.CommonAPI;
|
import org.jeecg.common.api.CommonAPI;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
import org.jeecg.common.util.CommonUtils;
|
import org.jeecg.common.util.CommonUtils;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.config.JeecgBaseConfig;
|
import org.jeecg.config.JeecgBaseConfig;
|
||||||
import org.jeecg.config.firewall.interceptor.enums.LowCodeUrlsEnum;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.AntPathMatcher;
|
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -70,6 +67,9 @@ public class LowCodeModeInterceptor implements HandlerInterceptor {
|
|||||||
Set<String> hasRoles = null;
|
Set<String> hasRoles = null;
|
||||||
if (loginUser == null) {
|
if (loginUser == null) {
|
||||||
loginUser = commonAPI.getUserByName(JwtUtil.getUserNameByToken(SpringContextUtils.getHttpServletRequest()));
|
loginUser = commonAPI.getUserByName(JwtUtil.getUserNameByToken(SpringContextUtils.getHttpServletRequest()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loginUser != null) {
|
||||||
//当前登录人拥有的角色
|
//当前登录人拥有的角色
|
||||||
hasRoles = commonAPI.queryUserRolesById(loginUser.getId());
|
hasRoles = commonAPI.queryUserRolesById(loginUser.getId());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import java.util.List;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
|
import net.sf.jsqlparser.expression.LongValue;
|
||||||
import org.jeecg.common.config.TenantContext;
|
import org.jeecg.common.config.TenantContext;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.TenantConstant;
|
import org.jeecg.common.constant.TenantConstant;
|
||||||
@ -21,8 +23,6 @@ import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||||
|
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
|
||||||
import net.sf.jsqlparser.expression.LongValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单数据源配置(jeecg.datasource.open = false时生效)
|
* 单数据源配置(jeecg.datasource.open = false时生效)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import org.jeecg.common.util.SpringContextUtils;
|
|||||||
import org.jeecg.config.mybatis.ThreadLocalDataHelper;
|
import org.jeecg.config.mybatis.ThreadLocalDataHelper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态数据源切换拦截器
|
* 动态数据源切换拦截器
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.jeecg.config.oss;
|
package org.jeecg.config.oss;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
@ -26,7 +27,7 @@ public class MinioConfig {
|
|||||||
@Value(value = "${jeecg.minio.bucketName}")
|
@Value(value = "${jeecg.minio.bucketName}")
|
||||||
private String bucketName;
|
private String bucketName;
|
||||||
|
|
||||||
@Bean
|
@PostConstruct
|
||||||
public void initMinio(){
|
public void initMinio(){
|
||||||
if(!minioUrl.startsWith(CommonConstant.STR_HTTP)){
|
if(!minioUrl.startsWith(CommonConstant.STR_HTTP)){
|
||||||
minioUrl = "http://" + minioUrl;
|
minioUrl = "http://" + minioUrl;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.jeecg.config.oss;
|
package org.jeecg.config.oss;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
import org.jeecg.common.util.oss.OssBootUtil;
|
import org.jeecg.common.util.oss.OssBootUtil;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@ -26,7 +27,7 @@ public class OssConfiguration {
|
|||||||
private String staticDomain;
|
private String staticDomain;
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@PostConstruct
|
||||||
public void initOssBootConfiguration() {
|
public void initOssBootConfiguration() {
|
||||||
OssBootUtil.setEndPoint(endpoint);
|
OssBootUtil.setEndPoint(endpoint);
|
||||||
OssBootUtil.setAccessKeyId(accessKeyId);
|
OssBootUtil.setAccessKeyId(accessKeyId);
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package org.jeecg.config.shiro;
|
package org.jeecg.config.shiro;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.DispatcherType;
|
||||||
|
import jakarta.servlet.Filter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||||
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
|
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
|
||||||
@ -8,6 +11,7 @@ import org.apache.shiro.mgt.SecurityManager;
|
|||||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||||
|
import org.apache.shiro.spring.web.ShiroUrlPathHelper;
|
||||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||||
import org.crazycake.shiro.*;
|
import org.crazycake.shiro.*;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
@ -17,25 +21,20 @@ import org.jeecg.config.shiro.filters.CustomShiroFilterFactoryBean;
|
|||||||
import org.jeecg.config.shiro.filters.JwtFilter;
|
import org.jeecg.config.shiro.filters.JwtFilter;
|
||||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
|
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.*;
|
||||||
import org.springframework.core.annotation.AnnotationUtils;
|
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
|
||||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.filter.DelegatingFilterProxy;
|
import org.springframework.web.filter.DelegatingFilterProxy;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
import redis.clients.jedis.HostAndPort;
|
import redis.clients.jedis.HostAndPort;
|
||||||
import redis.clients.jedis.JedisCluster;
|
import redis.clients.jedis.JedisCluster;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.DispatcherType;
|
|
||||||
import javax.servlet.Filter;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,6 +45,7 @@ import java.util.*;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
public class ShiroConfig {
|
public class ShiroConfig {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -353,6 +353,18 @@ public class ShiroConfig {
|
|||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决 ShiroRequestMappingConfig 获取 requestMappingHandlerMapping Bean 冲突
|
||||||
|
* spring-boot-autoconfigure:3.4.5 和 spring-boot-actuator-autoconfigure:3.4.5
|
||||||
|
*/
|
||||||
|
@Primary
|
||||||
|
@Bean
|
||||||
|
public RequestMappingHandlerMapping overridedRequestMappingHandlerMapping() {
|
||||||
|
RequestMappingHandlerMapping mapping = new RequestMappingHandlerMapping();
|
||||||
|
mapping.setUrlPathHelper(new ShiroUrlPathHelper());
|
||||||
|
return mapping;
|
||||||
|
}
|
||||||
|
|
||||||
private List<String> rebuildUrl(String[] bases, String[] uris) {
|
private List<String> rebuildUrl(String[] bases, String[] uris) {
|
||||||
List<String> urls = new ArrayList<>();
|
List<String> urls = new ArrayList<>();
|
||||||
for (String base : bases) {
|
for (String base : bases) {
|
||||||
|
|||||||
@ -20,11 +20,13 @@ import org.jeecg.common.util.SpringContextUtils;
|
|||||||
import org.jeecg.common.util.TokenUtils;
|
import org.jeecg.common.util.TokenUtils;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Role;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,6 +37,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
public class ShiroRealm extends AuthorizingRealm {
|
public class ShiroRealm extends AuthorizingRealm {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import org.apache.shiro.web.servlet.AbstractShiroFilter;
|
|||||||
import org.apache.shiro.mgt.SecurityManager;
|
import org.apache.shiro.mgt.SecurityManager;
|
||||||
import org.springframework.beans.factory.BeanInitializationException;
|
import org.springframework.beans.factory.BeanInitializationException;
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import jakarta.servlet.Filter;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -13,10 +13,10 @@ import org.springframework.http.HttpHeaders;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import jakarta.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import jakarta.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 鉴权登录拦截器
|
* @Description: 鉴权登录拦截器
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package org.jeecg.config.shiro.filters;
|
package org.jeecg.config.shiro.filters;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import jakarta.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import jakarta.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签名 拦截器配置
|
* 签名 拦截器配置
|
||||||
|
|||||||
@ -4,8 +4,8 @@ package org.jeecg.config.sign.interceptor;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package org.jeecg.config.sign.util;
|
package org.jeecg.config.sign.util;
|
||||||
|
|
||||||
import javax.servlet.ReadListener;
|
import jakarta.servlet.ReadListener;
|
||||||
import javax.servlet.ServletInputStream;
|
import jakarta.servlet.ServletInputStream;
|
||||||
import javax.servlet.ServletRequest;
|
import jakarta.servlet.ServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequestWrapper;
|
import jakarta.servlet.http.HttpServletRequestWrapper;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.util.Map;
|
|||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
|
|||||||
@ -14,8 +14,8 @@ import org.jeecg.common.util.SpringContextUtils;
|
|||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
package org.jeecg.test.sqlinjection;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
|
||||||
import org.jeecg.common.util.SqlInjectionUtil;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL注入攻击检查测试
|
|
||||||
* @author: liusq
|
|
||||||
* @date: 2023年09月08日
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class TestInjectWithSqlParser {
|
|
||||||
/**
|
|
||||||
* 注入测试
|
|
||||||
*
|
|
||||||
* @param sql
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isExistSqlInject(String sql) {
|
|
||||||
try {
|
|
||||||
SqlInjectionUtil.specialFilterContentForOnlineReport(sql);
|
|
||||||
return false;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.info("===================================================");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() throws JSQLParserException {
|
|
||||||
//不存在sql注入
|
|
||||||
assertFalse(isExistSqlInject("select * from fm_time where dept_id=:sqlparamsmap.id and time=:sqlparamsmap.time"));
|
|
||||||
assertFalse(isExistSqlInject("select * from test"));
|
|
||||||
assertFalse(isExistSqlInject("select load_file(\"C:\\\\benben.txt\")"));
|
|
||||||
assertFalse(isExistSqlInject("WITH SUB1 AS (SELECT user FROM t1) SELECT * FROM T2 WHERE id > 123 "));
|
|
||||||
|
|
||||||
//存在sql注入
|
|
||||||
assertTrue(isExistSqlInject("or 1= 1 --"));
|
|
||||||
assertTrue(isExistSqlInject("select * from test where sleep(%23)"));
|
|
||||||
assertTrue(isExistSqlInject("select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));"));
|
|
||||||
assertTrue(isExistSqlInject("select * from users;show databases;"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id=1 and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13"));
|
|
||||||
assertTrue(isExistSqlInject("update user set name = '123'"));
|
|
||||||
assertTrue(isExistSqlInject("SELECT * FROM users WHERE username = 'admin' AND password = '123456' OR 1=1;--"));
|
|
||||||
assertTrue(isExistSqlInject("select * from users where id=1 and (select count(*) from information_schema.tables where table_schema='数据库名')>4 %23"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where sleep(5) %23"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id in (select id from other)"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id in (select id from other)"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where 2=2.0 or 2 != 4"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where 1!=2.0"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id=floor(2.0)"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where not true"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where 1 or id > 0"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where 'tom' or id > 0"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where '-2.3' "));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where 2 "));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where (3+2) "));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where -1 IS TRUE"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where 'hello' is null "));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where '2022-10-31' and id > 0"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id > 0 or 1!=2.0 "));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id > 0 or 1 in (1,3,4) "));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device UNION select name from other"));
|
|
||||||
assertTrue(isExistSqlInject("(SELECT 6240 FROM (SELECT(SLEEP(5))and 1=2)vidl)"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
package org.jeecg.test.sqlinjection;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
|
||||||
import org.jeecg.common.util.SqlInjectionUtil;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL注入攻击检查测试
|
|
||||||
* @author: liusq
|
|
||||||
* @date: 2023年09月08日
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class TestSqlInjectForDict {
|
|
||||||
/**
|
|
||||||
* 注入测试
|
|
||||||
*
|
|
||||||
* @param sql
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isExistSqlInject(String sql) {
|
|
||||||
try {
|
|
||||||
SqlInjectionUtil.specialFilterContentForDictSql(sql);
|
|
||||||
return false;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.info("===================================================");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() throws JSQLParserException {
|
|
||||||
//不存在sql注入
|
|
||||||
assertFalse(isExistSqlInject("sys_user,realname,id"));
|
|
||||||
assertFalse(isExistSqlInject("oa_officialdoc_organcode,organ_name,id"));
|
|
||||||
assertFalse(isExistSqlInject("onl_cgform_head where table_type!=3 and copy_type=0,table_txt,table_name"));
|
|
||||||
assertFalse(isExistSqlInject("onl_cgform_head where copy_type = 0,table_txt,table_name"));
|
|
||||||
|
|
||||||
//存在sql注入
|
|
||||||
assertTrue(isExistSqlInject("or 1= 1 --"));
|
|
||||||
assertTrue(isExistSqlInject("select * from test where sleep(%23)"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
package org.jeecg.test.sqlinjection;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
|
||||||
import org.jeecg.common.util.SqlInjectionUtil;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL注入攻击检查测试
|
|
||||||
* @author: liusq
|
|
||||||
* @date: 2023年09月08日
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class TestSqlInjectForOnlineReport {
|
|
||||||
/**
|
|
||||||
* 注入测试
|
|
||||||
*
|
|
||||||
* @param sql
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isExistSqlInject(String sql) {
|
|
||||||
try {
|
|
||||||
SqlInjectionUtil.specialFilterContentForOnlineReport(sql);
|
|
||||||
return false;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.info("===================================================");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() throws JSQLParserException {
|
|
||||||
//不存在sql注入
|
|
||||||
assertFalse(isExistSqlInject("select * from fm_time where dept_id=:sqlparamsmap.id and time=:sqlparamsmap.time"));
|
|
||||||
assertFalse(isExistSqlInject("select * from test"));
|
|
||||||
assertFalse(isExistSqlInject("select load_file(\"C:\\\\benben.txt\")"));
|
|
||||||
assertFalse(isExistSqlInject("select * from dc_device where id in (select id from other)"));
|
|
||||||
assertFalse(isExistSqlInject("select * from dc_device UNION select name from other"));
|
|
||||||
|
|
||||||
//存在sql注入
|
|
||||||
assertTrue(isExistSqlInject("(SELECT 6240 FROM (SELECT(SLEEP(5))and 1=2)vidl)"));
|
|
||||||
assertTrue(isExistSqlInject("or 1= 1 --"));
|
|
||||||
assertTrue(isExistSqlInject("select * from test where sleep(%23)"));
|
|
||||||
assertTrue(isExistSqlInject("select * from test where SLEEP(3)"));
|
|
||||||
assertTrue(isExistSqlInject("select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));"));
|
|
||||||
assertTrue(isExistSqlInject("select * from users;show databases;"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where id=1 and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13"));
|
|
||||||
assertTrue(isExistSqlInject("update user set name = '123'"));
|
|
||||||
assertTrue(isExistSqlInject("SELECT * FROM users WHERE username = 'admin' AND password = '123456' OR 1=1;--"));
|
|
||||||
assertTrue(isExistSqlInject("select * from users where id=1 and (select count(*) from information_schema.tables where table_schema='数据库名')>4 %23"));
|
|
||||||
assertTrue(isExistSqlInject("select * from dc_device where sleep(5) %23"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
package org.jeecg.test.sqlinjection;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlInjectionUtils;
|
|
||||||
import org.jeecg.common.util.SqlInjectionUtil;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: SQL注入测试类
|
|
||||||
* @author: scott
|
|
||||||
* @date: 2023年08月14日 9:55
|
|
||||||
*/
|
|
||||||
public class TestSqlInjection {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表名带别名,同时有html编码字符
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testSpecialSQL() {
|
|
||||||
String tableName = "sys_user t";
|
|
||||||
//解决使用参数tableName=sys_user t&复测,漏洞仍然存在
|
|
||||||
if (tableName.contains(" ")) {
|
|
||||||
tableName = tableName.substring(0, tableName.indexOf(" "));
|
|
||||||
}
|
|
||||||
//【issues/4393】 sys_user , (sys_user), sys_user%20, %60sys_user%60
|
|
||||||
String reg = "\\s+|\\(|\\)|`";
|
|
||||||
tableName = tableName.replaceAll(reg, "");
|
|
||||||
System.out.println(tableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试sql是否含sql注入风险
|
|
||||||
* <p>
|
|
||||||
* mybatis plus的方法
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void sqlInjectionCheck() {
|
|
||||||
String sql = "select * from sys_user";
|
|
||||||
System.out.println(SqlInjectionUtils.check(sql));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试sql是否有SLEEP风险
|
|
||||||
* <p>
|
|
||||||
* mybatisPlus的方法
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void sqlSleepCheck() {
|
|
||||||
SqlInjectionUtil.checkSqlAnnotation("(SELECT 6240 FROM (SELECT(SLEEP(5))and 1=2)vidl)");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试sql是否含sql注入风险
|
|
||||||
* <p>
|
|
||||||
* 自定义方法
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void sqlInjectionCheck2() {
|
|
||||||
String sql = "select * from sys_user";
|
|
||||||
SqlInjectionUtil.specialFilterContentForOnlineReport(sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字段定义只能是是字母 数字 下划线的组合(不允许有空格、转义字符串等)
|
|
||||||
* <p>
|
|
||||||
* 判断字段名是否符合规范
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testFieldSpecification() {
|
|
||||||
List<String> list = new ArrayList();
|
|
||||||
list.add("Hello World!");
|
|
||||||
list.add("Hello%20World!");
|
|
||||||
list.add("HelloWorld!");
|
|
||||||
list.add("Hello World");
|
|
||||||
list.add("age");
|
|
||||||
list.add("user_name");
|
|
||||||
list.add("user_name%20");
|
|
||||||
list.add("user_name%20 ");
|
|
||||||
|
|
||||||
for (String input : list) {
|
|
||||||
boolean containsSpecialChars = isValidString(input);
|
|
||||||
System.out.println("input:" + input + " ,包含空格和特殊字符: " + containsSpecialChars);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字段定义只能是是字母 数字 下划线的组合(不允许有空格、转义字符串等)
|
|
||||||
*
|
|
||||||
* @param input
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static boolean isValidString(String input) {
|
|
||||||
Pattern pattern = Pattern.compile("^[a-zA-Z0-9_]+$");
|
|
||||||
return pattern.matcher(input).matches();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,109 +0,0 @@
|
|||||||
package org.jeecg.test.sqlparse;
|
|
||||||
|
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.common.util.sqlparse.JSqlParserUtils;
|
|
||||||
import org.jeecg.common.util.sqlparse.vo.SelectSqlInfo;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 针对 JSqlParserUtils 的单元测试
|
|
||||||
*/
|
|
||||||
public class JSqlParserUtilsTest {
|
|
||||||
|
|
||||||
private static final String[] sqlList = new String[]{
|
|
||||||
"select * from sys_user",
|
|
||||||
"select u.* from sys_user u",
|
|
||||||
"select u.*, c.name from sys_user u, demo c",
|
|
||||||
"select u.age, c.name from sys_user u, demo c",
|
|
||||||
"select sex, age, c.name from sys_user, demo c",
|
|
||||||
// 别名测试
|
|
||||||
"select username as realname from sys_user",
|
|
||||||
"select username as realname, u.realname as aaa, u.id bbb from sys_user u",
|
|
||||||
// 不存在真实地查询字段
|
|
||||||
"select count(1) from sys_user",
|
|
||||||
// 函数式字段
|
|
||||||
"select max(sex), id from sys_user",
|
|
||||||
// 复杂嵌套函数式字段
|
|
||||||
"select CONCAT(CONCAT(' _ ', sex), ' - ' , birthday) as info, id from sys_user",
|
|
||||||
// 更复杂的嵌套函数式字段
|
|
||||||
"select CONCAT(CONCAT(101,'_',NULL, DATE(create_time),'_',sex),' - ',birthday) as info, id from sys_user",
|
|
||||||
// 子查询SQL
|
|
||||||
"select u.name1 as name2 from (select username as name1 from sys_user) u",
|
|
||||||
// 多层嵌套子查询SQL
|
|
||||||
"select u2.name2 as name3 from (select u1.name1 as name2 from (select username as name1 from sys_user) u1) u2",
|
|
||||||
// 字段子查询SQL
|
|
||||||
"select id, (select username as name1 from sys_user u2 where u1.id = u2.id) as name2 from sys_user u1",
|
|
||||||
// 带条件的SQL(不解析where条件里的字段,但不影响解析查询字段)
|
|
||||||
"select username as name1 from sys_user where realname LIKE '%张%'",
|
|
||||||
// 多重复杂关联表查询解析,包含的表为:sys_user, sys_depart, sys_dict_item, demo
|
|
||||||
"" +
|
|
||||||
"SELECT " +
|
|
||||||
" u.*, d.age, sd.item_text AS sex, (SELECT count(sd.id) FROM sys_depart sd) AS count " +
|
|
||||||
"FROM " +
|
|
||||||
" (SELECT sd.username AS foo, sd.realname FROM sys_user sd) u, " +
|
|
||||||
" demo d " +
|
|
||||||
"LEFT JOIN sys_dict_item AS sd ON d.sex = sd.item_value " +
|
|
||||||
"WHERE sd.dict_id = '3d9a351be3436fbefb1307d4cfb49bf2'",
|
|
||||||
};
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testParseSelectSql() {
|
|
||||||
System.out.println("-----------------------------------------");
|
|
||||||
for (String sql : sqlList) {
|
|
||||||
System.out.println("待测试的sql:" + sql);
|
|
||||||
try {
|
|
||||||
// 解析所有的表名,key=表名,value=解析后的sql信息
|
|
||||||
Map<String, SelectSqlInfo> parsedMap = JSqlParserUtils.parseAllSelectTable(sql);
|
|
||||||
assert parsedMap != null;
|
|
||||||
for (Map.Entry<String, SelectSqlInfo> entry : parsedMap.entrySet()) {
|
|
||||||
System.out.println("表名:" + entry.getKey());
|
|
||||||
this.printSqlInfo(entry.getValue(), 1);
|
|
||||||
}
|
|
||||||
} catch (JSQLParserException e) {
|
|
||||||
System.out.println("SQL解析出现异常:" + e.getMessage());
|
|
||||||
}
|
|
||||||
System.out.println("-----------------------------------------");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printSqlInfo(SelectSqlInfo sqlInfo, int level) {
|
|
||||||
String beforeStr = this.getBeforeStr(level);
|
|
||||||
if (sqlInfo.getFromTableName() == null) {
|
|
||||||
// 子查询
|
|
||||||
System.out.println(beforeStr + "子查询:" + sqlInfo.getFromSubSelect().getParsedSql());
|
|
||||||
this.printSqlInfo(sqlInfo.getFromSubSelect(), level + 1);
|
|
||||||
} else {
|
|
||||||
// 非子查询
|
|
||||||
System.out.println(beforeStr + "查询的表名:" + sqlInfo.getFromTableName());
|
|
||||||
}
|
|
||||||
if (oConvertUtils.isNotEmpty(sqlInfo.getFromTableAliasName())) {
|
|
||||||
System.out.println(beforeStr + "查询的表别名:" + sqlInfo.getFromTableAliasName());
|
|
||||||
}
|
|
||||||
if (sqlInfo.isSelectAll()) {
|
|
||||||
System.out.println(beforeStr + "查询的字段:*");
|
|
||||||
} else {
|
|
||||||
System.out.println(beforeStr + "查询的字段:" + sqlInfo.getSelectFields());
|
|
||||||
System.out.println(beforeStr + "真实的字段:" + sqlInfo.getRealSelectFields());
|
|
||||||
if (sqlInfo.getFromTableName() == null) {
|
|
||||||
System.out.println(beforeStr + "所有的字段(包括子查询):" + sqlInfo.getAllRealSelectFields());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打印前缀,根据层级来打印
|
|
||||||
private String getBeforeStr(int level) {
|
|
||||||
if (level == 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
StringBuilder beforeStr = new StringBuilder();
|
|
||||||
for (int i = 0; i < level; i++) {
|
|
||||||
beforeStr.append(" ");
|
|
||||||
}
|
|
||||||
beforeStr.append("- ");
|
|
||||||
return beforeStr.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-boot-module</artifactId>
|
<artifactId>jeecg-boot-module</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>jeecg-boot-module-airag</artifactId>
|
<artifactId>jeecg-boot-module-airag</artifactId>
|
||||||
@ -54,11 +54,50 @@
|
|||||||
</dependency>-->
|
</dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
<artifactId>jeecg-aiflow-jdk8</artifactId>
|
<artifactId>jeecg-aiflow</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- aiflow 脚本依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>liteflow-script-graaljs</artifactId>
|
||||||
|
<version>${liteflow.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>liteflow-script-groovy</artifactId>
|
||||||
|
<version>${liteflow.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>liteflow-script-kotlin</artifactId>
|
||||||
|
<version>${liteflow.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-scripting-jsr223</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>liteflow-script-aviator</artifactId>
|
||||||
|
<version>${liteflow.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>aviator</artifactId>
|
||||||
|
<groupId>com.googlecode.aviator</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<!-- aiflow 脚本依赖 -->
|
||||||
|
|
||||||
<!-- langChain4j model support -->
|
<!-- langChain4j model support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.langchain4j</groupId>
|
<groupId>dev.langchain4j</groupId>
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@ -14,8 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>jeecg-boot-module</artifactId>
|
<artifactId>jeecg-boot-module</artifactId>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务端提供方——feign接口
|
* 服务端提供方——feign接口
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import org.apache.commons.io.IOUtils;
|
|||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import org.jeecg.modules.demo.mock.vxe.entity.MockEntity;
|
|||||||
import org.jeecg.modules.demo.mock.vxe.websocket.VxeSocket;
|
import org.jeecg.modules.demo.mock.vxe.websocket.VxeSocket;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
|||||||
@ -6,12 +6,12 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.jeecg.common.constant.VxeSocketConst;
|
import org.jeecg.common.constant.VxeSocketConst;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.websocket.OnClose;
|
import jakarta.websocket.OnClose;
|
||||||
import javax.websocket.OnMessage;
|
import jakarta.websocket.OnMessage;
|
||||||
import javax.websocket.OnOpen;
|
import jakarta.websocket.OnOpen;
|
||||||
import javax.websocket.Session;
|
import jakarta.websocket.Session;
|
||||||
import javax.websocket.server.PathParam;
|
import jakarta.websocket.server.PathParam;
|
||||||
import javax.websocket.server.ServerEndpoint;
|
import jakarta.websocket.server.ServerEndpoint;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@ -31,8 +31,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|||||||
@ -10,7 +10,10 @@ import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
|||||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||||
import org.jeecg.modules.demo.test.service.IJeecgDynamicDataService;
|
import org.jeecg.modules.demo.test.service.IJeecgDynamicDataService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import org.jeecg.modules.demo.mock.vxe.websocket.VxeSocket;
|
|||||||
import org.jeecg.modules.dlglong.entity.MockEntity;
|
import org.jeecg.modules.dlglong.entity.MockEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>jeecg-boot-parent</artifactId>
|
<artifactId>jeecg-boot-parent</artifactId>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>jeecg-system-api</artifactId>
|
<artifactId>jeecg-system-api</artifactId>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
//import java.util.List;
|
//import java.util.List;
|
||||||
//import java.util.SortedMap;
|
//import java.util.SortedMap;
|
||||||
//
|
//
|
||||||
//import javax.servlet.http.HttpServletRequest;
|
//import jakarta.servlet.http.HttpServletRequest;
|
||||||
//
|
//
|
||||||
//import org.jeecg.common.config.mqtoken.UserTokenContext;
|
//import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
//import org.jeecg.common.constant.CommonConstant;
|
//import org.jeecg.common.constant.CommonConstant;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>jeecg-system-api</artifactId>
|
<artifactId>jeecg-system-api</artifactId>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>jeecg-module-system</artifactId>
|
<artifactId>jeecg-module-system</artifactId>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-module-system</artifactId>
|
<artifactId>jeecg-module-system</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<artifactId>hibernate-core</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
<artifactId>hibernate-re</artifactId>
|
<artifactId>hibernate-re</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -32,7 +32,13 @@
|
|||||||
<!-- 积木报表 -->
|
<!-- 积木报表 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
<artifactId>jimureport-spring-boot-starter</artifactId>
|
<artifactId>jimureport-spring-boot3-starter-fastjson2</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.github.jsqlparser</groupId>
|
||||||
|
<artifactId>jsqlparser</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
@ -41,7 +47,19 @@
|
|||||||
<!-- 积木BI -->
|
<!-- 积木BI -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
<artifactId>jimubi-spring-boot-starter</artifactId>
|
<artifactId>jimubi-spring-boot3-starter</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.github.jsqlparser</groupId>
|
||||||
|
<artifactId>jsqlparser</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<!-- AI大模型管理 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-module-airag</artifactId>
|
||||||
|
<version>${jeecgboot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@ -4,14 +4,14 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.exception.JeecgSqlInjectionException;
|
import org.jeecg.common.exception.JeecgSqlInjectionException;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.common.util.sqlparse.JSqlParserUtils;
|
|
||||||
import org.jeecg.common.util.sqlparse.vo.SelectSqlInfo;
|
|
||||||
import org.jeecg.config.JeecgBaseConfig;
|
import org.jeecg.config.JeecgBaseConfig;
|
||||||
import org.jeecg.config.firewall.SqlInjection.IDictTableWhiteListHandler;
|
import org.jeecg.config.firewall.SqlInjection.IDictTableWhiteListHandler;
|
||||||
import org.jeecg.config.firewall.interceptor.LowCodeModeInterceptor;
|
import org.jeecg.config.firewall.interceptor.LowCodeModeInterceptor;
|
||||||
import org.jeecg.modules.system.entity.SysTableWhiteList;
|
import org.jeecg.modules.system.entity.SysTableWhiteList;
|
||||||
import org.jeecg.modules.system.security.DictQueryBlackListHandler;
|
import org.jeecg.modules.system.security.DictQueryBlackListHandler;
|
||||||
import org.jeecg.modules.system.service.ISysTableWhiteListService;
|
import org.jeecg.modules.system.service.ISysTableWhiteListService;
|
||||||
|
import org.jeecgframework.minidao.sqlparser.impl.vo.SelectSqlInfo;
|
||||||
|
import org.jeecgframework.minidao.util.MiniDaoUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class DictTableWhiteListHandlerImpl implements IDictTableWhiteListHandler
|
|||||||
public boolean isPassBySql(String sql) {
|
public boolean isPassBySql(String sql) {
|
||||||
Map<String, SelectSqlInfo> parsedMap = null;
|
Map<String, SelectSqlInfo> parsedMap = null;
|
||||||
try {
|
try {
|
||||||
parsedMap = JSqlParserUtils.parseAllSelectTable(sql);
|
parsedMap = MiniDaoUtil.parseAllSelectTable(sql);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("校验sql语句,解析报错:{}", e.getMessage());
|
log.warn("校验sql语句,解析报错:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ public class DictTableWhiteListHandlerImpl implements IDictTableWhiteListHandler
|
|||||||
log.info("字典拼接的查询SQL:{}", sql);
|
log.info("字典拼接的查询SQL:{}", sql);
|
||||||
try {
|
try {
|
||||||
// 进行SQL解析
|
// 进行SQL解析
|
||||||
JSqlParserUtils.parseSelectSqlInfo(sql);
|
MiniDaoUtil.parseSelectSqlInfo(sql);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 如果SQL解析失败,则通过字段名和表名进行校验
|
// 如果SQL解析失败,则通过字段名和表名进行校验
|
||||||
return checkWhiteList(tableName, new HashSet<>(Arrays.asList(fields)));
|
return checkWhiteList(tableName, new HashSet<>(Arrays.asList(fields)));
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -36,11 +36,7 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToken(HttpServletRequest request) {
|
public String getToken(HttpServletRequest request) {
|
||||||
try {
|
return TokenUtils.getTokenByRequest(request);
|
||||||
return TokenUtils.getTokenByRequest(request);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import org.jeecg.modules.system.entity.SysTenantPack;
|
|||||||
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@ package org.jeecg.modules.cas.controller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|||||||
@ -2,8 +2,8 @@ package org.jeecg.modules.message.controller;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package org.jeecg.modules.message.controller;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|||||||
@ -21,8 +21,8 @@ import org.springframework.mail.javamail.JavaMailSender;
|
|||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
import jakarta.mail.MessagingException;
|
||||||
import javax.mail.internet.MimeMessage;
|
import jakarta.mail.internet.MimeMessage;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import org.jeecg.modules.system.mapper.SysAnnouncementSendMapper;
|
|||||||
import org.jeecg.modules.system.mapper.SysUserMapper;
|
import org.jeecg.modules.system.mapper.SysUserMapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@ package org.jeecg.modules.message.websocket;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import javax.websocket.*;
|
import jakarta.websocket.*;
|
||||||
import javax.websocket.server.PathParam;
|
import jakarta.websocket.server.PathParam;
|
||||||
import javax.websocket.server.ServerEndpoint;
|
import jakarta.websocket.server.ServerEndpoint;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.jeecg.common.base.BaseMap;
|
import org.jeecg.common.base.BaseMap;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package org.jeecg.modules.monitor.actuator;
|
package org.jeecg.modules.monitor.actuator;
|
||||||
|
|
||||||
import org.jeecg.modules.monitor.actuator.httptrace.CustomInMemoryHttpTraceRepository;
|
import org.jeecg.modules.monitor.actuator.httptrace.CustomInMemoryHttpTraceRepository;
|
||||||
import org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration;
|
import org.springframework.boot.actuate.autoconfigure.web.exchanges.HttpExchangesAutoConfiguration;
|
||||||
import org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceProperties;
|
import org.springframework.boot.actuate.autoconfigure.web.exchanges.HttpExchangesProperties;
|
||||||
import org.springframework.boot.actuate.trace.http.HttpTraceRepository;
|
import org.springframework.boot.actuate.web.exchanges.HttpExchangeRepository;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@ -18,8 +18,8 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
* @Date: 2024/5/13 17:20
|
* @Date: 2024/5/13 17:20
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(HttpTraceProperties.class)
|
@EnableConfigurationProperties(HttpExchangesProperties.class)
|
||||||
@AutoConfigureBefore(HttpTraceAutoConfiguration.class)
|
@AutoConfigureBefore(HttpExchangesAutoConfiguration.class)
|
||||||
public class CustomActuatorConfig {
|
public class CustomActuatorConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@ public class CustomActuatorConfig {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "management.trace.http", name = "enabled", matchIfMissing = true)
|
@ConditionalOnProperty(prefix = "management.trace.http", name = "enabled", matchIfMissing = true)
|
||||||
@ConditionalOnMissingBean(HttpTraceRepository.class)
|
@ConditionalOnMissingBean(HttpExchangeRepository.class)
|
||||||
public CustomInMemoryHttpTraceRepository traceRepository() {
|
public CustomInMemoryHttpTraceRepository traceRepository() {
|
||||||
return new CustomInMemoryHttpTraceRepository();
|
return new CustomInMemoryHttpTraceRepository();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import lombok.Getter;
|
|||||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||||
import org.springframework.boot.actuate.endpoint.annotation.Selector;
|
import org.springframework.boot.actuate.endpoint.annotation.Selector;
|
||||||
import org.springframework.boot.actuate.trace.http.HttpTrace;
|
import org.springframework.boot.actuate.web.exchanges.HttpExchange;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@ -29,14 +29,14 @@ public class CustomHttpTraceEndpoint{
|
|||||||
|
|
||||||
@ReadOperation
|
@ReadOperation
|
||||||
public HttpTraceDescriptor traces(@Selector(match = ALL_REMAINING) String query) {
|
public HttpTraceDescriptor traces(@Selector(match = ALL_REMAINING) String query) {
|
||||||
return new CustomHttpTraceEndpoint.HttpTraceDescriptor(this.repository.findAll(query));
|
return new HttpTraceDescriptor(this.repository.findAll(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public static final class HttpTraceDescriptor {
|
public static final class HttpTraceDescriptor {
|
||||||
private final List<HttpTrace> traces;
|
private final List<HttpExchange> traces;
|
||||||
|
|
||||||
private HttpTraceDescriptor(List<HttpTrace> traces) {
|
private HttpTraceDescriptor(List<HttpExchange> traces) {
|
||||||
this.traces = traces;
|
this.traces = traces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package org.jeecg.modules.monitor.actuator.httptrace;
|
package org.jeecg.modules.monitor.actuator.httptrace;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.trace.http.HttpTrace;
|
import org.springframework.boot.actuate.web.exchanges.HttpExchange;
|
||||||
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
|
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -12,17 +12,17 @@ import java.util.stream.Stream;
|
|||||||
* @Author: chenrui
|
* @Author: chenrui
|
||||||
* @Date: 2024/5/13 17:02
|
* @Date: 2024/5/13 17:02
|
||||||
*/
|
*/
|
||||||
public class CustomInMemoryHttpTraceRepository extends InMemoryHttpTraceRepository {
|
public class CustomInMemoryHttpTraceRepository extends InMemoryHttpExchangeRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HttpTrace> findAll() {
|
public List<HttpExchange> findAll() {
|
||||||
return super.findAll();
|
return super.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HttpTrace> findAll(String query) {
|
public List<HttpExchange> findAll(String query) {
|
||||||
List<HttpTrace> allTrace = super.findAll();
|
List<HttpExchange> allTrace = super.findAll();
|
||||||
if (null != allTrace && !allTrace.isEmpty()) {
|
if (null != allTrace && !allTrace.isEmpty()) {
|
||||||
Stream<HttpTrace> stream = allTrace.stream();
|
Stream<HttpExchange> stream = allTrace.stream();
|
||||||
String[] params = query.split(",");
|
String[] params = query.split(",");
|
||||||
stream = filter(params, stream);
|
stream = filter(params, stream);
|
||||||
stream = sort(params, stream);
|
stream = sort(params, stream);
|
||||||
@ -31,7 +31,7 @@ public class CustomInMemoryHttpTraceRepository extends InMemoryHttpTraceReposito
|
|||||||
return allTrace;
|
return allTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<HttpTrace> sort(String[] params, Stream<HttpTrace> stream) {
|
private Stream<HttpExchange> sort(String[] params, Stream<HttpExchange> stream) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ public class CustomInMemoryHttpTraceRepository extends InMemoryHttpTraceReposito
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Stream<HttpTrace> filter(String[] params, Stream<HttpTrace> stream) {
|
private static Stream<HttpExchange> filter(String[] params, Stream<HttpExchange> stream) {
|
||||||
if (params.length == 0) {
|
if (params.length == 0) {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,9 @@ public class CustomUndertowMetricsHandler {
|
|||||||
// 获取当前 session,如果不存在则创建
|
// 获取当前 session,如果不存在则创建
|
||||||
Session session = sessionManager.getSession(exchange, sessionConfig);
|
Session session = sessionManager.getSession(exchange, sessionConfig);
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
sessionManager.createSession(exchange, sessionConfig);
|
try {
|
||||||
|
sessionManager.createSession(exchange, sessionConfig);
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行下一个 Handler
|
// 执行下一个 Handler
|
||||||
|
|||||||
@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package org.jeecg.modules.monitor.service.impl;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//package org.jeecg.modules.ngalain.aop;
|
//package org.jeecg.modules.ngalain.aop;
|
||||||
//
|
//
|
||||||
//import javax.servlet.http.HttpServletRequest;
|
//import jakarta.servlet.http.HttpServletRequest;
|
||||||
//
|
//
|
||||||
//import org.aspectj.lang.ProceedingJoinPoint;
|
//import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
//import org.aspectj.lang.annotation.Around;
|
//import org.aspectj.lang.annotation.Around;
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
//import java.util.List;
|
//import java.util.List;
|
||||||
//import java.util.Map;
|
//import java.util.Map;
|
||||||
//
|
//
|
||||||
//import javax.servlet.http.HttpServletRequest;
|
//import jakarta.servlet.http.HttpServletRequest;
|
||||||
//
|
//
|
||||||
//import org.apache.shiro.SecurityUtils;
|
//import org.apache.shiro.SecurityUtils;
|
||||||
//import org.jeecg.common.api.vo.Result;
|
//import org.jeecg.common.api.vo.Result;
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import org.jeecg.modules.openapi.generator.AKSKGenerator;
|
|||||||
import org.jeecg.modules.openapi.service.OpenApiAuthService;
|
import org.jeecg.modules.openapi.service.OpenApiAuthService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package org.jeecg.modules.openapi.controller;
|
package org.jeecg.modules.openapi.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@ -10,14 +12,14 @@ import org.jeecg.common.constant.CommonConstant;
|
|||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.common.util.RedisUtil;
|
||||||
|
import org.jeecg.common.util.RestUtil;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApi;
|
import org.jeecg.modules.openapi.entity.OpenApi;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiAuth;
|
import org.jeecg.modules.openapi.entity.OpenApiAuth;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiHeader;
|
import org.jeecg.modules.openapi.entity.OpenApiHeader;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiParam;
|
import org.jeecg.modules.openapi.entity.OpenApiParam;
|
||||||
import org.jeecg.modules.openapi.generator.PathGenerator;
|
import org.jeecg.modules.openapi.generator.PathGenerator;
|
||||||
import org.jeecg.modules.openapi.service.OpenApiAuthService;
|
import org.jeecg.modules.openapi.service.OpenApiAuthService;
|
||||||
import org.jeecg.modules.openapi.service.OpenApiHeaderService;
|
|
||||||
import org.jeecg.modules.openapi.service.OpenApiParamService;
|
|
||||||
import org.jeecg.modules.openapi.service.OpenApiService;
|
import org.jeecg.modules.openapi.service.OpenApiService;
|
||||||
import org.jeecg.modules.openapi.swagger.*;
|
import org.jeecg.modules.openapi.swagger.*;
|
||||||
import org.jeecg.modules.system.entity.SysUser;
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
@ -26,13 +28,15 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import java.net.URI;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @date 2024/12/10 9:11
|
* @date 2024/12/10 9:11
|
||||||
@ -44,9 +48,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private OpenApiParamService openApiParamService;
|
private RedisUtil redisUtil;
|
||||||
@Autowired
|
|
||||||
private OpenApiHeaderService openApiHeaderService;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -67,10 +69,6 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
QueryWrapper<OpenApi> queryWrapper = QueryGenerator.initQueryWrapper(openApi, req.getParameterMap());
|
QueryWrapper<OpenApi> queryWrapper = QueryGenerator.initQueryWrapper(openApi, req.getParameterMap());
|
||||||
Page<OpenApi> page = new Page<>(pageNo, pageSize);
|
Page<OpenApi> page = new Page<>(pageNo, pageSize);
|
||||||
IPage<OpenApi> pageList = service.page(page, queryWrapper);
|
IPage<OpenApi> pageList = service.page(page, queryWrapper);
|
||||||
for (OpenApi api : pageList.getRecords()) {
|
|
||||||
api.setParams(openApiParamService.findByApiId(api.getId()));
|
|
||||||
api.setHeaders(openApiHeaderService.findByApiId(api.getId()));
|
|
||||||
}
|
|
||||||
return Result.ok(pageList);
|
return Result.ok(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,16 +80,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@RequestBody OpenApi openApi) {
|
public Result<?> add(@RequestBody OpenApi openApi) {
|
||||||
if (service.save(openApi)) {
|
service.save(openApi);
|
||||||
if (!CollectionUtils.isEmpty(openApi.getHeaders())) {
|
|
||||||
openApiHeaderService.saveBatch(openApi.getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(openApi.getParams())) {
|
|
||||||
openApiParamService.saveBatch(openApi.getParams());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.ok("添加成功!");
|
return Result.ok("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,18 +92,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
*/
|
*/
|
||||||
@PutMapping(value = "/edit")
|
@PutMapping(value = "/edit")
|
||||||
public Result<?> edit(@RequestBody OpenApi openApi) {
|
public Result<?> edit(@RequestBody OpenApi openApi) {
|
||||||
if (service.updateById(openApi)) {
|
service.updateById(openApi);
|
||||||
openApiHeaderService.deleteByApiId(openApi.getId());
|
|
||||||
openApiParamService.deleteByApiId(openApi.getId());
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(openApi.getHeaders())) {
|
|
||||||
openApiHeaderService.saveBatch(openApi.getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(openApi.getParams())) {
|
|
||||||
openApiParamService.saveBatch(openApi.getParams());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Result.ok("修改成功!");
|
return Result.ok("修改成功!");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -170,27 +148,72 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
result.put("data", null);
|
result.put("data", null);
|
||||||
return Result.error("失败", result);
|
return Result.error("失败", result);
|
||||||
}
|
}
|
||||||
List<OpenApiHeader> headers = openApiHeaderService.findByApiId(openApi.getId());
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
|
if (StrUtil.isNotEmpty(openApi.getHeadersJson())) {
|
||||||
|
List<OpenApiHeader> headers = JSON.parseArray(openApi.getHeadersJson(),OpenApiHeader.class);
|
||||||
|
if (headers.size()>0) {
|
||||||
|
for (OpenApiHeader header : headers) {
|
||||||
|
httpHeaders.put(header.getHeaderKey(), Lists.newArrayList(request.getHeader(header.getHeaderKey())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String url = openApi.getOriginUrl();
|
String url = openApi.getOriginUrl();
|
||||||
String method = openApi.getRequestMethod();
|
String method = openApi.getRequestMethod();
|
||||||
|
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
for (OpenApiHeader header : headers) {
|
|
||||||
httpHeaders.put(header.getHeaderKey(), Lists.newArrayList(request.getHeader(header.getHeaderKey())));
|
|
||||||
}
|
|
||||||
|
|
||||||
String appkey = request.getHeader("appkey");
|
String appkey = request.getHeader("appkey");
|
||||||
OpenApiAuth openApiAuth = openApiAuthService.getByAppkey(appkey);
|
OpenApiAuth openApiAuth = openApiAuthService.getByAppkey(appkey);
|
||||||
SysUser systemUser = sysUserService.getById(openApiAuth.getSystemUserId());
|
SysUser systemUser = sysUserService.getById(openApiAuth.getSystemUserId());
|
||||||
String token = JwtUtil.sign(systemUser.getUsername(), systemUser.getPassword());
|
String token = this.getToken(systemUser.getUsername(), systemUser.getPassword());
|
||||||
httpHeaders.put("X-Access-Token", Lists.newArrayList(token));
|
httpHeaders.put("X-Access-Token", Lists.newArrayList(token));
|
||||||
|
httpHeaders.put("Content-Type",Lists.newArrayList("application/json"));
|
||||||
HttpEntity<String> httpEntity = new HttpEntity<>(json, httpHeaders);
|
HttpEntity<String> httpEntity = new HttpEntity<>(json, httpHeaders);
|
||||||
|
url = RestUtil.getBaseUrl() + url;
|
||||||
|
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
|
||||||
|
if (HttpMethod.GET.matches(method)
|
||||||
|
|| HttpMethod.DELETE.matches(method)
|
||||||
|
|| HttpMethod.OPTIONS.matches(method)
|
||||||
|
|| HttpMethod.TRACE.matches(method)) {
|
||||||
|
//拼接参数
|
||||||
|
if (!request.getParameterMap().isEmpty()) {
|
||||||
|
if (StrUtil.isNotEmpty(openApi.getParamsJson())) {
|
||||||
|
List<OpenApiParam> params = JSON.parseArray(openApi.getParamsJson(),OpenApiParam.class);
|
||||||
|
if (params.size()>0) {
|
||||||
|
Map<String, OpenApiParam> openApiParamMap = params.stream().collect(Collectors.toMap(p -> p.getParamKey(), p -> p, (e, r) -> e));
|
||||||
|
request.getParameterMap().forEach((k, v) -> {
|
||||||
|
OpenApiParam openApiParam = openApiParamMap.get(k);
|
||||||
|
if (Objects.nonNull(openApiParam)) {
|
||||||
|
if(v==null&&StrUtil.isNotEmpty(openApiParam.getDefaultValue())){
|
||||||
|
builder.queryParam(openApiParam.getParamKey(), openApiParam.getDefaultValue());
|
||||||
|
}
|
||||||
|
if (v!=null){
|
||||||
|
builder.queryParam(openApiParam.getParamKey(), v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return restTemplate.exchange(url, HttpMethod.resolve(method), httpEntity, Result.class, request.getParameterMap()).getBody();
|
}
|
||||||
|
}
|
||||||
|
URI targetUrl = builder.build().encode().toUri();
|
||||||
|
return restTemplate.exchange(targetUrl.toString(), Objects.requireNonNull(HttpMethod.valueOf(method)), httpEntity, Result.class, request.getParameterMap()).getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成接口访问令牌 Token
|
||||||
|
*
|
||||||
|
* @param USERNAME
|
||||||
|
* @param PASSWORD
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getToken(String USERNAME, String PASSWORD) {
|
||||||
|
String token = JwtUtil.sign(USERNAME, PASSWORD);
|
||||||
|
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||||
|
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, 60);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/json")
|
@GetMapping("/json")
|
||||||
public SwaggerModel swaggerModel() {
|
public SwaggerModel swaggerModel() {
|
||||||
|
|
||||||
@ -230,13 +253,16 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
definition.setType("object");
|
definition.setType("object");
|
||||||
Map<String, SwaggerDefinitionProperties> definitionProperties = new HashMap<>();
|
Map<String, SwaggerDefinitionProperties> definitionProperties = new HashMap<>();
|
||||||
definition.setProperties(definitionProperties);
|
definition.setProperties(definitionProperties);
|
||||||
|
if (openApi.getBody()!=null){
|
||||||
JSONObject jsonObject = JSONObject.parseObject(openApi.getBody());
|
JSONObject jsonObject = JSONObject.parseObject(openApi.getBody());
|
||||||
for (Map.Entry<String, Object> properties : jsonObject.entrySet()) {
|
if (jsonObject.size()>0){
|
||||||
SwaggerDefinitionProperties swaggerDefinitionProperties = new SwaggerDefinitionProperties();
|
for (Map.Entry<String, Object> properties : jsonObject.entrySet()) {
|
||||||
swaggerDefinitionProperties.setType("string");
|
SwaggerDefinitionProperties swaggerDefinitionProperties = new SwaggerDefinitionProperties();
|
||||||
swaggerDefinitionProperties.setDescription(properties.getValue()+"");
|
swaggerDefinitionProperties.setType("string");
|
||||||
definitionProperties.put(properties.getKey(), swaggerDefinitionProperties);
|
swaggerDefinitionProperties.setDescription(properties.getValue()+"");
|
||||||
|
definitionProperties.put(properties.getKey(), swaggerDefinitionProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// body的definition构建完成
|
// body的definition构建完成
|
||||||
definitions.put(openApi.getRequestUrl()+"Using"+openApi.getRequestMethod()+"body", definition);
|
definitions.put(openApi.getRequestUrl()+"Using"+openApi.getRequestMethod()+"body", definition);
|
||||||
@ -327,25 +353,28 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
|
|
||||||
private void parameters(SwaggerOperation operation, OpenApi openApi) {
|
private void parameters(SwaggerOperation operation, OpenApi openApi) {
|
||||||
List<SwaggerOperationParameter> parameters = new ArrayList<>();
|
List<SwaggerOperationParameter> parameters = new ArrayList<>();
|
||||||
|
if (openApi.getParamsJson()!=null) {
|
||||||
for (OpenApiParam openApiParam : openApiParamService.findByApiId(openApi.getId())) {
|
List<OpenApiParam> openApiParams = JSON.parseArray(openApi.getParamsJson(), OpenApiParam.class);
|
||||||
SwaggerOperationParameter parameter = new SwaggerOperationParameter();
|
for (OpenApiParam openApiParam : openApiParams) {
|
||||||
parameter.setIn("path");
|
SwaggerOperationParameter parameter = new SwaggerOperationParameter();
|
||||||
parameter.setName(openApiParam.getParamKey());
|
parameter.setIn("path");
|
||||||
parameter.setRequired(openApiParam.getRequired() == 1);
|
parameter.setName(openApiParam.getParamKey());
|
||||||
parameter.setDescription(openApiParam.getNote());
|
parameter.setRequired(openApiParam.getRequired() == 1);
|
||||||
parameters.add(parameter);
|
parameter.setDescription(openApiParam.getNote());
|
||||||
|
parameters.add(parameter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (openApi.getHeadersJson()!=null) {
|
||||||
for (OpenApiHeader openApiHeader : openApiHeaderService.findByApiId(openApi.getId())) {
|
List<OpenApiHeader> openApiHeaders = JSON.parseArray(openApi.getHeadersJson(), OpenApiHeader.class);
|
||||||
SwaggerOperationParameter parameter = new SwaggerOperationParameter();
|
for (OpenApiHeader openApiHeader : openApiHeaders) {
|
||||||
parameter.setIn("header");
|
SwaggerOperationParameter parameter = new SwaggerOperationParameter();
|
||||||
parameter.setName(openApiHeader.getHeaderKey());
|
parameter.setIn("header");
|
||||||
parameter.setRequired(openApiHeader.getRequired() == 1);
|
parameter.setName(openApiHeader.getHeaderKey());
|
||||||
parameter.setDescription(openApiHeader.getNote());
|
parameter.setRequired(openApiHeader.getRequired() == 1);
|
||||||
parameters.add(parameter);
|
parameter.setDescription(openApiHeader.getNote());
|
||||||
|
parameters.add(parameter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
operation.setParameters(parameters);
|
operation.setParameters(parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +382,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
SwaggerInfo info = new SwaggerInfo();
|
SwaggerInfo info = new SwaggerInfo();
|
||||||
|
|
||||||
info.setDescription("OpenAPI 接口列表");
|
info.setDescription("OpenAPI 接口列表");
|
||||||
info.setVersion("3.7.1");
|
info.setVersion("3.8.0");
|
||||||
info.setTitle("OpenAPI 接口列表");
|
info.setTitle("OpenAPI 接口列表");
|
||||||
info.setTermsOfService("https://jeecg.com");
|
info.setTermsOfService("https://jeecg.com");
|
||||||
|
|
||||||
|
|||||||
@ -6,11 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiRecord;
|
import org.jeecg.modules.openapi.entity.OpenApiLog;
|
||||||
import org.jeecg.modules.openapi.service.OpenApiRecordService;
|
import org.jeecg.modules.openapi.service.OpenApiLogService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,47 +18,47 @@ import java.util.Arrays;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/openapi/record")
|
@RequestMapping("/openapi/record")
|
||||||
public class OpenApiRecordController extends JeecgController<OpenApiRecord, OpenApiRecordService> {
|
public class OpenApiLogController extends JeecgController<OpenApiLog, OpenApiLogService> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
* @param openApiRecord
|
* @param OpenApiLog
|
||||||
* @param pageNo
|
* @param pageNo
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<?> queryPageList(OpenApiRecord openApiRecord, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
public Result<?> queryPageList(OpenApiLog OpenApiLog, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||||
QueryWrapper<OpenApiRecord> queryWrapper = QueryGenerator.initQueryWrapper(openApiRecord, req.getParameterMap());
|
QueryWrapper<OpenApiLog> queryWrapper = QueryGenerator.initQueryWrapper(OpenApiLog, req.getParameterMap());
|
||||||
Page<OpenApiRecord> page = new Page<>(pageNo, pageSize);
|
Page<OpenApiLog> page = new Page<>(pageNo, pageSize);
|
||||||
IPage<OpenApiRecord> pageList = service.page(page, queryWrapper);
|
IPage<OpenApiLog> pageList = service.page(page, queryWrapper);
|
||||||
return Result.ok(pageList);
|
return Result.ok(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*
|
*
|
||||||
* @param openApiRecord
|
* @param OpenApiLog
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@RequestBody OpenApiRecord openApiRecord) {
|
public Result<?> add(@RequestBody OpenApiLog OpenApiLog) {
|
||||||
service.save(openApiRecord);
|
service.save(OpenApiLog);
|
||||||
return Result.ok("添加成功!");
|
return Result.ok("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
*
|
||||||
* @param openApiRecord
|
* @param OpenApiLog
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PutMapping(value = "/edit")
|
@PutMapping(value = "/edit")
|
||||||
public Result<?> edit(@RequestBody OpenApiRecord openApiRecord) {
|
public Result<?> edit(@RequestBody OpenApiLog OpenApiLog) {
|
||||||
service.updateById(openApiRecord);
|
service.updateById(OpenApiLog);
|
||||||
return Result.ok("修改成功!");
|
return Result.ok("修改成功!");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ public class OpenApiRecordController extends JeecgController<OpenApiRecord, Open
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
OpenApiRecord openApiRecord = service.getById(id);
|
OpenApiLog OpenApiLog = service.getById(id);
|
||||||
return Result.ok(openApiRecord);
|
return Result.ok(OpenApiLog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user