芋道源码(无遮羞布版)

This commit is contained in:
talkpoin 2024-04-19 00:47:21 +08:00
commit 731f5f2fdc
3584 changed files with 256799 additions and 0 deletions

53
.gitignore vendored Normal file
View File

@ -0,0 +1,53 @@
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml
### JRebel ###
rebel.xml
application-my.yaml
/yudao-ui-app/unpackage/

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 talkpoin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

34
README.md Normal file
View File

@ -0,0 +1,34 @@
***严肃声明:本项目只为了给在校学生和刚刚步入社会又囊中羞涩的年轻人提供一种选择,同时也为了打击中国式伪开源贡献一份力量。***
***如果哪一天芋芋撕掉遮羞布,不割年轻人韭菜,一定不是良心发现或者钱赚够了,只是因为我来过。***
## 不需要199
## 不需要star
## 没有遮羞布
## 后端项目 https://github.com/talkpoin/ruoyi-spring-boot-all
## 前端项目 https://github.com/talkpoin/ruoyi-ui-admin-vue3
## 模块
| 项目 | 说明 |
|-----------------------|--------------------|
| `yudao-dependencies` | Maven 依赖版本管理 |
| `yudao-framework` | Java 框架拓展 |
| `yudao-server` | 管理后台 + 用户 APP 的服务端 |
| `yudao-module-system` | 系统功能的 Module 模块 |
| `yudao-module-member` | 会员中心的 Module 模块 |
| `yudao-module-infra` | 基础设施的 Module 模块 |
| `yudao-module-bpm` | 工作流程的 Module 模块 |
| `yudao-module-pay` | 支付系统的 Module 模块 |
| `yudao-module-mall` | 商城系统的 Module 模块 |
| `yudao-module-erp` | ERP 系统的 Module 模块 |
| `yudao-module-crm` | CRM 系统的 Module 模块 |
| `yudao-module-mp` | 微信公众号的 Module 模块 |
| `yudao-module-report` | 大屏报表 Module 模块 |
> 白天正常上班写代码,晚上有时间就同步文档(无遮羞布)。

324
mysql_script/ruoyi-bpm.sql Normal file
View File

@ -0,0 +1,324 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for bpm_category
-- ----------------------------
DROP TABLE IF EXISTS `bpm_category`;
CREATE TABLE `bpm_category` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '分类名',
`code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '分类标志',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '分类描述',
`status` tinyint NULL DEFAULT NULL COMMENT '分类状态',
`sort` int NULL DEFAULT NULL COMMENT '分类排序',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 116 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 流程分类';
-- ----------------------------
-- Records of bpm_category
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for bpm_form
-- ----------------------------
DROP TABLE IF EXISTS `bpm_form`;
CREATE TABLE `bpm_form` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表单名',
`status` tinyint NOT NULL COMMENT '开启状态',
`conf` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表单的配置',
`fields` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表单项的数组',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 表单定义表';
-- ----------------------------
-- Records of bpm_form
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for bpm_oa_leave
-- ----------------------------
DROP TABLE IF EXISTS `bpm_oa_leave`;
CREATE TABLE `bpm_oa_leave` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '请假表单主键',
`user_id` bigint NOT NULL COMMENT '申请人的用户编号',
`type` tinyint NOT NULL COMMENT '请假类型',
`reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '请假原因',
`start_time` datetime NOT NULL COMMENT '开始时间',
`end_time` datetime NOT NULL COMMENT '结束时间',
`day` tinyint NOT NULL COMMENT '请假天数',
`status` tinyint NOT NULL COMMENT '审批结果',
`process_instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流程实例的编号',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OA 请假申请表';
-- ----------------------------
-- Records of bpm_oa_leave
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for bpm_process_definition_info
-- ----------------------------
DROP TABLE IF EXISTS `bpm_process_definition_info`;
CREATE TABLE `bpm_process_definition_info` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`process_definition_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程定义的编号',
`model_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程模型的编号',
`icon` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图标',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '描述',
`form_type` tinyint NOT NULL COMMENT '表单类型',
`form_id` bigint NULL DEFAULT NULL COMMENT '表单编号',
`form_conf` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '表单的配置',
`form_fields` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '表单项的数组',
`form_custom_create_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '自定义表单的提交路径',
`form_custom_view_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '自定义表单的查看路径',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 241 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 流程定义的信息表';
-- ----------------------------
-- Records of bpm_process_definition_info
-- ----------------------------
BEGIN;
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (141, 'test_return:1:dd6b6e1d-5ac0-11ee-be77-fe3a43e3aa2f', '75452338-5ac0-11ee-be77-fe3a43e3aa2f', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2023-09-24 17:58:09', '1', '2023-09-24 17:58:09', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (142, 'test_return2:1:e2de03c7-5ac2-11ee-9bee-fe3a43e3aa2f', 'ad8d0722-5ac2-11ee-9bee-fe3a43e3aa2f', NULL, 'biubiu', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2023-09-24 18:12:37', '1', '2023-09-24 18:12:37', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (143, 'test_return2:2:320f7403-5ac3-11ee-9bee-fe3a43e3aa2f', 'ad8d0722-5ac2-11ee-9bee-fe3a43e3aa2f', NULL, 'biubiu', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2023-09-24 18:14:50', '1', '2023-09-24 18:14:50', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (144, 'contract-approve:1:057a9d3b-d1ed-11ee-a436-8a9af48de719', '499c96e6-d1ec-11ee-a436-8a9af48de719', NULL, NULL, 20, NULL, NULL, NULL, '1', '/crm/contract/detail', '1', '2024-02-23 09:44:02', '1', '2024-02-23 09:44:02', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (145, 'contract-approve:2:dd644004-d208-11ee-ba3b-5e0431cb568f', '499c96e6-d1ec-11ee-a436-8a9af48de719', NULL, NULL, 20, NULL, NULL, NULL, '/crm/contract/detail2', '/crm/contract/detail2', '1', '2024-02-23 13:03:21', '1', '2024-02-23 13:03:21', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (146, 'contract-approve:3:87c93a24-d212-11ee-ba3b-5e0431cb568f', '499c96e6-d1ec-11ee-a436-8a9af48de719', NULL, NULL, 20, NULL, NULL, NULL, '/crm/contract/detail/index', '/crm/contract/detail/index', '1', '2024-02-23 14:12:32', '1', '2024-02-23 14:12:32', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (147, 'crm-contract-audit:1:a5ec9240-d2a7-11ee-a703-92ff8e2e5a3e', '5b40f87b-d2a7-11ee-a703-92ff8e2e5a3e', NULL, NULL, 20, NULL, NULL, NULL, '/crm/business/detail/index', '/crm/business/detail/index', '1', '2024-02-24 07:59:58', '1', '2024-02-24 07:59:58', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (148, 'crm-contract-audit:2:288f69f6-d2a8-11ee-b20a-8adfac90dc14', '5b40f87b-d2a7-11ee-a703-92ff8e2e5a3e', NULL, NULL, 20, NULL, NULL, NULL, '/crm/contract/detail/index', '/crm/contract/detail/index', '1', '2024-02-24 08:03:37', '1', '2024-02-24 08:03:37', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (149, 'crm-receivable-audit:1:fa8272f3-d3d2-11ee-aa2f-26aa5e0b65cc', '9bc054ce-d3d2-11ee-aa2f-26aa5e0b65cc', NULL, NULL, 20, NULL, NULL, NULL, '/crm/receivable/detail/index', '/crm/receivable/detail/index', '1', '2024-02-25 19:42:39', '1', '2024-02-25 19:42:39', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (150, 'xx:1:4d87fd62-e074-11ee-9b46-0e22e0b61031', '9f50553c-a6b4-11ee-904d-2a0706c917c0', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-12 21:27:42', '1', '2024-03-12 21:27:42', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (151, 'xx:2:eacda6dc-e077-11ee-be9b-f21fd1da61a2', '9f50553c-a6b4-11ee-904d-2a0706c917c0', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-12 21:53:34', '1', '2024-03-12 21:53:34', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (152, 'new-1:1:73f06beb-e13b-11ee-a38f-06b2c2ddc7b1', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-13 21:13:16', '1', '2024-03-13 21:13:16', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (153, 'new-1:2:7f2c569a-e141-11ee-9d86-06b2c2ddc7b1', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-13 21:56:32', '1', '2024-03-13 21:56:32', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (154, 'new-1:3:86ec704e-e141-11ee-9d86-06b2c2ddc7b1', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-13 21:56:45', '1', '2024-03-13 21:56:45', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (155, 'new-1:4:6a258922-e1bc-11ee-9330-feeee51d4267', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 12:36:25', '1', '2024-03-14 12:36:25', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (156, 'new-1:5:a48c8e16-e1bc-11ee-9330-feeee51d4267', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 12:38:03', '1', '2024-03-14 12:38:03', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (157, 'new-1:6:ab7ad8da-e1bc-11ee-9330-feeee51d4267', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 12:38:14', '1', '2024-03-14 12:38:14', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (158, 'new-1:7:d7595072-e1bc-11ee-9b9f-feeee51d4267', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 12:39:28', '1', '2024-03-14 12:39:28', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (159, 'new-1:8:75b9842a-e205-11ee-aac1-66c23f24ce2b', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 21:19:17', '1', '2024-03-14 21:19:17', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (160, 'new-1:9:9dcaa07e-e205-11ee-aac1-66c23f24ce2b', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 21:20:25', '1', '2024-03-14 21:20:25', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (161, 'new-1:10:9f5a6842-e205-11ee-aac1-66c23f24ce2b', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 21:20:27', '1', '2024-03-14 21:20:27', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (162, 'new-1:11:f2499f4b-e20c-11ee-beae-46aa22562164', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-14 22:12:53', '1', '2024-03-14 22:12:53', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (163, 'new-2:1:7fc84238-e2c1-11ee-ad8d-9216688a4b8f', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-15 19:45:20', '1', '2024-03-15 19:45:20', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (164, 'new-2:2:18c21844-e2c2-11ee-ad8d-9216688a4b8f', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-15 19:49:36', '1', '2024-03-15 19:49:36', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (165, 'new-2:3:2a67c3b8-e2c2-11ee-ad8d-9216688a4b8f', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-15 19:50:06', '1', '2024-03-15 19:50:06', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (166, 'new-2:4:4bdfb93e-e2c2-11ee-ad8d-9216688a4b8f', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-15 19:51:02', '1', '2024-03-15 19:51:02', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (167, 'new-2:5:aca8925e-e2e9-11ee-83a1-0e2aa205f435', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 00:32:55', '1', '2024-03-16 00:32:55', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (168, 'new-2:6:634784f8-e2ea-11ee-b183-0e2aa205f435', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 00:38:01', '1', '2024-03-16 00:38:01', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (169, 'new-2:7:8167c4f2-e2ea-11ee-b183-0e2aa205f435', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', NULL, '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 00:38:52', '1', '2024-03-16 00:38:52', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (170, 'test:1:9c4cac8d-e360-11ee-9498-6aca1e3be435', '7077f888-e360-11ee-9498-6aca1e3be435', NULL, 'biubiubiu', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 14:44:17', '1', '2024-03-16 14:44:17', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (171, 'test:2:99e30b8e-e370-11ee-a1a2-0ebfd53b3c91', '7077f888-e360-11ee-9498-6aca1e3be435', NULL, 'biubiubiu', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 16:38:45', '1', '2024-03-16 16:38:45', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (172, 'test:3:9befa472-e370-11ee-a1a2-0ebfd53b3c91', '7077f888-e360-11ee-9498-6aca1e3be435', NULL, 'biubiubiu', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 16:38:49', '1', '2024-03-16 16:38:49', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (173, 'huoqian:1:e95f383c-e37e-11ee-a889-0ebfd53b3c91', 'd139e257-e37e-11ee-a889-0ebfd53b3c91', NULL, '123321', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 18:21:12', '1', '2024-03-16 18:21:12', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (174, 'bohui:1:5b1ab874-e384-11ee-9e7b-aab4713d012e', '35963a6f-e384-11ee-9e7b-aab4713d012e', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-16 19:00:10', '1', '2024-03-16 19:00:10', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (175, 'bohui:2:929c1199-e5ca-11ee-9e7b-3e9a6d6b4cd2', '35963a6f-e384-11ee-9e7b-aab4713d012e', NULL, '测试', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 16:27:50', '1', '2024-03-19 16:27:50', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (176, 'bohui:3:2e6a6c9d-e5e2-11ee-9e7b-3e9a6d6b4cd2', '35963a6f-e384-11ee-9e7b-aab4713d012e', NULL, '测试', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 19:16:50', '1', '2024-03-19 19:16:50', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (177, 'huoqian:2:3081daf1-e5e2-11ee-9e7b-3e9a6d6b4cd2', 'd139e257-e37e-11ee-a889-0ebfd53b3c91', NULL, '312321', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 19:16:53', '1', '2024-03-19 19:16:53', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (178, 'test:4:31c77a55-e5e2-11ee-9e7b-3e9a6d6b4cd2', '7077f888-e360-11ee-9498-6aca1e3be435', NULL, 'biubiubiu', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 19:16:56', '1', '2024-03-19 19:16:56', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (179, 'new-1:12:32ec9969-e5e2-11ee-9e7b-3e9a6d6b4cd2', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 19:16:57', '1', '2024-03-19 19:16:57', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (180, 'new-1:13:8612ea4d-e5e2-11ee-9e7b-3e9a6d6b4cd2', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 19:19:17', '1', '2024-03-19 19:19:17', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (181, 'crm-receivable-audit:2:87747621-e5e2-11ee-9e7b-3e9a6d6b4cd2', '9bc054ce-d3d2-11ee-aa2f-26aa5e0b65cc', NULL, NULL, 20, NULL, NULL, NULL, '/crm/receivable/detail/index', '/crm/receivable/detail/index', '1', '2024-03-19 19:19:19', '1', '2024-03-19 19:19:19', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (182, 'huoqian:3:a0f2f365-e5e2-11ee-9e7b-3e9a6d6b4cd2', 'd139e257-e37e-11ee-a889-0ebfd53b3c91', NULL, '312321', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 19:20:02', '1', '2024-03-19 19:20:02', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (183, 'bohui:4:0ae36c02-e607-11ee-95fc-76ce04f8068a', '35963a6f-e384-11ee-9e7b-aab4713d012e', NULL, '测试', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-19 23:40:42', '1', '2024-03-19 23:40:42', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (184, 'bohui:5:cc1ecb1f-e60c-11ee-9a09-76ce04f8068a', '35963a6f-e384-11ee-9e7b-aab4713d012e', NULL, '测试', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 00:21:53', '1', '2024-03-20 00:21:53', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (185, 'bohui:6:cd95b3b3-e60c-11ee-9a09-76ce04f8068a', '35963a6f-e384-11ee-9e7b-aab4713d012e', NULL, '测试', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 00:21:56', '1', '2024-03-20 00:21:56', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (186, 'huoqian:4:e4f8f217-e60c-11ee-9a09-76ce04f8068a', 'd139e257-e37e-11ee-a889-0ebfd53b3c91', NULL, '312321', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 00:22:35', '1', '2024-03-20 00:22:35', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (187, 'huoqian:5:e87101db-e60c-11ee-9a09-76ce04f8068a', 'd139e257-e37e-11ee-a889-0ebfd53b3c91', NULL, '312321', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 00:22:41', '1', '2024-03-20 00:22:41', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (188, 'new-test:1:c94e33b3-e60e-11ee-b246-76ce04f8068a', '89f1f488-e60e-11ee-9a09-76ce04f8068a', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 00:36:08', '1', '2024-03-20 00:36:08', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (189, 'new-test:2:09735826-e66a-11ee-9c22-4aafd11823fb', '89f1f488-e60e-11ee-9a09-76ce04f8068a', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 11:29:19', '1', '2024-03-20 11:29:19', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (190, 'new-test:3:0abe009a-e66a-11ee-9c22-4aafd11823fb', '89f1f488-e60e-11ee-9a09-76ce04f8068a', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 11:29:22', '1', '2024-03-20 11:29:22', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (191, 'hhhh:1:8b313806-e698-11ee-8b05-52c6ce924391', '155910bd-e698-11ee-aeba-aa5b9845b3dd', NULL, '444', 10, 24, NULL, NULL, NULL, NULL, '1', '2024-03-20 17:02:14', '1', '2024-03-20 17:02:14', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (192, 'hhhh:2:b96ff12b-e699-11ee-a9b4-52c6ce924391', '155910bd-e698-11ee-aeba-aa5b9845b3dd', NULL, '444', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-20 17:10:41', '1', '2024-03-20 17:10:41', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (193, 'oa_leave:1:7f7be21c-e6b8-11ee-9cdc-4a23a0fa7ecb', '5a910c07-e6b8-11ee-9cdc-4a23a0fa7ecb', NULL, NULL, 20, NULL, NULL, NULL, '/bpm/oa/leave/create', '/bpm/oa/leave/detail', '1', '2024-03-20 20:50:58', '1', '2024-03-20 20:50:58', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (194, 'oa_leave:2:dc565ee3-e841-11ee-a5e7-525da23008fe', '5a910c07-e6b8-11ee-9cdc-4a23a0fa7ecb', NULL, NULL, 20, NULL, NULL, NULL, '/bpm/oa/leave/create', '/bpm/oa/leave/detail', '1', '2024-03-22 19:46:46', '1', '2024-03-22 19:46:46', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (195, 'hhhh:3:c1e2dce5-e842-11ee-90ce-4a385f3b4f1a', '155910bd-e698-11ee-aeba-aa5b9845b3dd', NULL, '444', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-22 19:53:11', '1', '2024-03-22 19:53:11', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (196, 'hhhh:4:d27088a9-e842-11ee-90ce-4a385f3b4f1a', '155910bd-e698-11ee-aeba-aa5b9845b3dd', NULL, '444', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-22 19:53:39', '1', '2024-03-22 19:53:39', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (197, 'oa_leave:3:ec4b0352-e85f-11ee-a915-fef401dd8c67', '5a910c07-e6b8-11ee-9cdc-4a23a0fa7ecb', NULL, NULL, 20, NULL, NULL, NULL, '/bpm/oa/leave/create', '/bpm/oa/leave/detail', '1', '2024-03-22 23:21:58', '1', '2024-03-22 23:21:58', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (198, 'hhhh:5:f8052e06-e85f-11ee-a915-fef401dd8c67', '155910bd-e698-11ee-aeba-aa5b9845b3dd', NULL, '444', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-22 23:22:18', '1', '2024-03-22 23:22:18', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (199, 'hhhh:6:f9c52d8a-e85f-11ee-a915-fef401dd8c67', '155910bd-e698-11ee-aeba-aa5b9845b3dd', NULL, '444', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-22 23:22:21', '1', '2024-03-22 23:22:21', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (200, 'oa_leave:4:405a9670-e86a-11ee-9962-52c5f2f50e3f', '5a910c07-e6b8-11ee-9cdc-4a23a0fa7ecb', NULL, NULL, 20, NULL, NULL, NULL, '/bpm/oa/leave/create', '/bpm/oa/leave/detail', '1', '2024-03-23 00:35:54', '1', '2024-03-23 00:35:54', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (201, 'test-execute-listener:1:53f38c0e-e8c7-11ee-a81e-aa3623b10f85', '63ad6275-e8c6-11ee-a81e-aa3623b10f85', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 11:42:10', '1', '2024-03-23 11:42:10', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (202, 'test-execute-listener:2:a385e0a9-e8c7-11ee-aad0-aa3623b10f85', '63ad6275-e8c6-11ee-a81e-aa3623b10f85', NULL, NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 11:44:23', '1', '2024-03-23 11:44:23', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (203, 'jiandan:1:9303634e-e8c8-11ee-afed-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 11:51:05', '1', '2024-03-23 11:51:05', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (204, 'jiandan:2:a188dba5-e8cb-11ee-90b0-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:12:58', '1', '2024-03-23 12:12:58', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (205, 'jiandan:3:a365b1f9-e8cb-11ee-90b0-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:13:01', '1', '2024-03-23 12:13:01', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (206, 'jiandan:4:cd840373-e8cb-11ee-90b0-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:14:12', '1', '2024-03-23 12:14:12', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (207, 'jiandan:5:eaa4117f-e8cb-11ee-90b0-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:15:01', '1', '2024-03-23 12:15:01', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (208, 'jiandan:6:86693c4b-e8cc-11ee-90b0-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:19:22', '1', '2024-03-23 12:19:22', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (209, 'jiandan:7:05a77968-e8cf-11ee-817e-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:37:15', '1', '2024-03-23 12:37:15', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (210, 'jiandan:8:40e137b4-e8cf-11ee-817e-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:38:54', '1', '2024-03-23 12:38:54', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (211, 'jiandan:9:5df007b3-e8cf-11ee-817e-aa3623b10f85', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 12:39:43', '1', '2024-03-23 12:39:43', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (212, 'jiandan:10:86a7834f-e904-11ee-868e-769cf7027e4a', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:00:14', '1', '2024-03-23 19:00:14', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (213, 'jiandan:11:ae58a559-e904-11ee-868e-769cf7027e4a', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:01:21', '1', '2024-03-23 19:01:21', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (214, 'jiandan:12:b021305d-e904-11ee-868e-769cf7027e4a', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:01:24', '1', '2024-03-23 19:01:24', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (215, 'jiandan:13:3d5f2d56-e905-11ee-9c2f-cacdb29edc0f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:05:21', '1', '2024-03-23 19:05:21', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (216, 'jiandan:14:911254cd-e905-11ee-b8a7-cacdb29edc0f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:07:41', '1', '2024-03-23 19:07:41', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (217, 'jiandan:15:d171abcd-e905-11ee-b8a7-cacdb29edc0f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:09:29', '1', '2024-03-23 19:09:29', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (218, 'jiandan:16:12cd3d1d-e906-11ee-b8a7-cacdb29edc0f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:11:19', '1', '2024-03-23 19:11:19', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (219, 'jiandan:17:14ffd491-e906-11ee-b8a7-cacdb29edc0f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:11:23', '1', '2024-03-23 19:11:23', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (220, 'jiandan:18:a37d1331-e907-11ee-ad58-cacdb29edc0f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 19:22:31', '1', '2024-03-23 19:22:31', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (221, 'jiandan:19:c0a44484-e915-11ee-9b58-4ad6071fe8cb', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 21:03:33', '1', '2024-03-23 21:03:33', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (222, 'jiandan:20:d94ad861-e915-11ee-9b58-4ad6071fe8cb', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 21:04:14', '1', '2024-03-23 21:04:14', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (223, 'jiandan:21:ebf8cc15-e915-11ee-9b58-4ad6071fe8cb', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 21:04:46', '1', '2024-03-23 21:04:46', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (224, 'jiandan:22:f303eda9-e915-11ee-9b58-4ad6071fe8cb', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 21:04:58', '1', '2024-03-23 21:04:58', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (225, 'jiandan:23:1f51a246-e916-11ee-9b58-4ad6071fe8cb', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 21:06:12', '1', '2024-03-23 21:06:12', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (226, 'jiandan:24:2143602a-e916-11ee-9b58-4ad6071fe8cb', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-23 21:06:15', '1', '2024-03-23 21:06:15', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (227, 'jiandan:25:fe687100-e97f-11ee-98a3-7248bcbce76f', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 09:44:03', '1', '2024-03-24 09:44:03', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (228, 'jiandan:26:e9f49fcc-e981-11ee-b9f2-daad0f82ed42', '31b0d649-e8c8-11ee-afed-aa3623b10f85', NULL, '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 09:57:48', '1', '2024-03-24 09:57:48', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (229, 'jiandan:27:1fdd973f-e982-11ee-85e4-0ae4354b692e', '31b0d649-e8c8-11ee-afed-aa3623b10f85', 'http://test.yudao.iocoder.cn/a2b3603cf8797447c26a22f18256df94562d5e00bcbdc2a523098119c50a6efa.png', '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 09:59:19', '1', '2024-03-24 09:59:19', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (230, 'jiandan:28:4eaa2e83-e982-11ee-85e4-0ae4354b692e', '31b0d649-e8c8-11ee-afed-aa3623b10f85', 'http://test.yudao.iocoder.cn/a2b3603cf8797447c26a22f18256df94562d5e00bcbdc2a523098119c50a6efa.png', '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 10:00:45', '1', '2024-03-24 10:00:45', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (231, 'crm-receivable-audit:3:a7ef6c37-e982-11ee-85e4-0ae4354b692e', '9bc054ce-d3d2-11ee-aa2f-26aa5e0b65cc', 'http://test.yudao.iocoder.cn/4c38186a52a6796d998f4e826178e1c24bee0eb722f8751e9ffb4d8eaea9b5cf.png', NULL, 20, NULL, NULL, NULL, '/crm/receivable/detail/index', '/crm/receivable/detail/index', '1', '2024-03-24 10:03:07', '1', '2024-03-24 10:03:07', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (232, 'new-1:14:bddcd37b-e982-11ee-85e4-0ae4354b692e', '341a1b12-e13b-11ee-a38f-06b2c2ddc7b1', NULL, '2222', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 10:03:44', '1', '2024-03-24 10:03:44', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (233, 'crm-receivable-audit:4:bf5cbcbf-e982-11ee-85e4-0ae4354b692e', '9bc054ce-d3d2-11ee-aa2f-26aa5e0b65cc', 'http://test.yudao.iocoder.cn/4c38186a52a6796d998f4e826178e1c24bee0eb722f8751e9ffb4d8eaea9b5cf.png', NULL, 20, NULL, NULL, NULL, '/crm/receivable/detail/index', '/crm/receivable/detail/index', '1', '2024-03-24 10:03:46', '1', '2024-03-24 10:03:46', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (234, 'crm-contract-audit:3:c0998283-e982-11ee-85e4-0ae4354b692e', '5b40f87b-d2a7-11ee-a703-92ff8e2e5a3e', 'http://test.yudao.iocoder.cn/10d745dfe02082351f86c28ed2f3a7e0da8bbf6858f1d4a02e409930b3670d63.png', NULL, 20, NULL, NULL, NULL, '/crm/contract/detail/index', '/crm/contract/detail/index', '1', '2024-03-24 10:03:48', '1', '2024-03-24 10:03:48', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (235, 'jiandan:29:04a89a9e-e983-11ee-8309-e2652d1d3e17', '31b0d649-e8c8-11ee-afed-aa3623b10f85', 'http://test.yudao.iocoder.cn/a2b3603cf8797447c26a22f18256df94562d5e00bcbdc2a523098119c50a6efa.png', '31', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 10:05:42', '1', '2024-03-24 10:05:42', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (236, 'test-execute-listener:3:05563fc2-e983-11ee-8309-e2652d1d3e17', '63ad6275-e8c6-11ee-a81e-aa3623b10f85', 'http://test.yudao.iocoder.cn/9bb3c5ced2acdd50e303db8d719900ac20a3a8fab2f2002c56fc8da41b74c204.png', NULL, 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 10:05:43', '1', '2024-03-24 10:05:43', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (237, 'oa_leave:5:06357c36-e983-11ee-8309-e2652d1d3e17', '5a910c07-e6b8-11ee-9cdc-4a23a0fa7ecb', 'http://test.yudao.iocoder.cn/628560c644de0ae9120114509227ffb90a32e23dfc9afc2bd63763cd781ece8f.png', NULL, 20, NULL, NULL, NULL, '/bpm/oa/leave/create', '/bpm/oa/leave/detail', '1', '2024-03-24 10:05:45', '1', '2024-03-24 10:05:45', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (238, 'new-2:8:072f458a-e983-11ee-8309-e2652d1d3e17', '096c61cd-e2c0-11ee-ad8d-9216688a4b8f', 'http://test.yudao.iocoder.cn/6857d7b2e57f514629c0f1aa937c5fc6c551460851975bc3ea15b5a56ce4bdea.png', '123', 10, 24, '{\"form\":{\"labelPosition\":\"right\",\"size\":\"small\",\"labelWidth\":\"125px\",\"hideRequiredAsterisk\":false,\"showMessage\":true,\"inlineMessage\":false},\"submitBtn\":{\"show\":true,\"innerText\":\"提交\"},\"resetBtn\":{\"show\":false,\"innerText\":\"重置\"}}', '[\"{\\\"type\\\":\\\"input\\\",\\\"field\\\":\\\"Fjph60d8vlrl9\\\",\\\"title\\\":\\\"输入框\\\",\\\"info\\\":\\\"\\\",\\\"$required\\\":false,\\\"_fc_drag_tag\\\":\\\"input\\\",\\\"hidden\\\":false,\\\"display\\\":true}\"]', NULL, NULL, '1', '2024-03-24 10:05:47', '1', '2024-03-24 10:05:47', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (239, 'crm-receivable-audit:5:0828729e-e983-11ee-8309-e2652d1d3e17', '9bc054ce-d3d2-11ee-aa2f-26aa5e0b65cc', 'http://test.yudao.iocoder.cn/4c38186a52a6796d998f4e826178e1c24bee0eb722f8751e9ffb4d8eaea9b5cf.png', NULL, 20, NULL, NULL, NULL, '/crm/receivable/detail/index', '/crm/receivable/detail/index', '1', '2024-03-24 10:05:48', '1', '2024-03-24 10:05:48', b'0', 1);
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (240, 'crm-contract-audit:4:09a0e1d2-e983-11ee-8309-e2652d1d3e17', '5b40f87b-d2a7-11ee-a703-92ff8e2e5a3e', 'http://test.yudao.iocoder.cn/10d745dfe02082351f86c28ed2f3a7e0da8bbf6858f1d4a02e409930b3670d63.png', NULL, 20, NULL, NULL, NULL, '/crm/contract/detail/index', '/crm/contract/detail/index', '1', '2024-03-24 10:05:51', '1', '2024-03-24 10:05:51', b'0', 1);
COMMIT;
-- ----------------------------
-- Table structure for bpm_process_expression
-- ----------------------------
DROP TABLE IF EXISTS `bpm_process_expression`;
CREATE TABLE `bpm_process_expression` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表达式名字',
`status` tinyint NOT NULL COMMENT '表达式状态',
`expression` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表达式',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 120 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 流程表达式表';
-- ----------------------------
-- Records of bpm_process_expression
-- ----------------------------
BEGIN;
INSERT INTO `bpm_process_expression` (`id`, `name`, `status`, `expression`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (116, '测试表达式', 0, 'cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.exection.DemoDelegateClassExecutionListener', '1', '2024-03-23 15:13:20', '1', '2024-03-09 22:37:51', b'1', 1);
INSERT INTO `bpm_process_expression` (`id`, `name`, `status`, `expression`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (118, '测试任务监听器', 0, 'cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.task.DemoDelegateClassTaskListener', '1', '2024-03-23 19:13:15', '1', '2024-03-09 22:36:44', b'1', 1);
COMMIT;
-- ----------------------------
-- Table structure for bpm_process_instance_copy
-- ----------------------------
DROP TABLE IF EXISTS `bpm_process_instance_copy`;
CREATE TABLE `bpm_process_instance_copy` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`user_id` bigint NOT NULL DEFAULT 0 COMMENT '用户编号,被抄送人',
`start_user_id` bigint NOT NULL DEFAULT 0 COMMENT '发起流程的用户编号',
`process_instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '流程实例的id',
`process_instance_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '流程实例的名字',
`category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程定义的分类',
`task_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '发起抄送的任务编号',
`task_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '任务的名字',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 流程实例抄送表';
-- ----------------------------
-- Records of bpm_process_instance_copy
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for bpm_process_listener
-- ----------------------------
DROP TABLE IF EXISTS `bpm_process_listener`;
CREATE TABLE `bpm_process_listener` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '监听器名字',
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '监听器类型',
`status` tinyint NOT NULL COMMENT '监听器状态',
`event` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '监听事件',
`value_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '监听器值类型',
`value` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '监听器值',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 119 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 流程监听器表';
-- ----------------------------
-- Records of bpm_process_listener
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for bpm_user_group
-- ----------------------------
DROP TABLE IF EXISTS `bpm_user_group`;
CREATE TABLE `bpm_user_group` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '组名',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述',
`user_ids` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '成员编号数组',
`status` tinyint NOT NULL COMMENT '状态(0正常 1停用)',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 114 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'BPM 用户组表';
-- ----------------------------
-- Records of bpm_user_group
-- ----------------------------
BEGIN;
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

591
mysql_script/ruoyi-crm.sql Normal file

File diff suppressed because one or more lines are too long

1062
mysql_script/ruoyi-erp.sql Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1807
mysql_script/ruoyi-mall.sql Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

392
mysql_script/ruoyi-pay.sql Normal file
View File

@ -0,0 +1,392 @@
/*
Navicat Premium Data Transfer
Source Server : 127.0.0.1 MySQL
Source Server Type : MySQL
Source Server Version : 80200 (8.2.0)
Source Host : 127.0.0.1:3306
Source Schema : ruoyi-vue-pro
Target Server Type : MySQL
Target Server Version : 80200 (8.2.0)
File Encoding : 65001
Date: 05/01/2024 07:33:53
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for pay_app
-- ----------------------------
DROP TABLE IF EXISTS `pay_app`;
CREATE TABLE `pay_app` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '应用编号',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用名',
`status` tinyint NOT NULL COMMENT '开启状态',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
`order_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付结果的回调地址',
`refund_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款结果的回调地址',
`transfer_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '转账结果的回调地址',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付应用信息';
-- ----------------------------
-- Records of pay_app
-- ----------------------------
BEGIN;
INSERT INTO `pay_app` (`id`, `name`, `status`, `remark`, `order_notify_url`, `refund_notify_url`, `transfer_notify_url`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '商城应用', 0, NULL, 'http://127.0.0.1:48080/app-api/trade/order/update-paid', 'http://127.0.0.1:48080/admin-api/trade/after-sale/update-refunded', '', '1', '2023-02-11 21:20:54', '1', '2023-08-18 14:54:15', b'0', 1), (7, '示例应用', 0, NULL, 'http://127.0.0.1:48080/admin-api/pay/demo-order/update-paid', 'http://127.0.0.1:48080/admin-api/pay/demo-order/update-refunded', '', '1', '2023-02-11 21:20:54', '1', '2023-07-17 16:37:28', b'0', 1), (8, '会员钱包', 0, NULL, 'http://127.0.0.1:48080/admin-api/pay/wallet-recharge/update-paid', 'http://127.0.0.1:48080/admin-api/pay/wallet-recharge/update-refunded', '', '1', '2023-09-30 18:43:09', '1', '2023-09-30 18:51:27', b'0', 1);
COMMIT;
-- ----------------------------
-- Table structure for pay_channel
-- ----------------------------
DROP TABLE IF EXISTS `pay_channel`;
CREATE TABLE `pay_channel` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '商户编号',
`code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
`status` tinyint NOT NULL COMMENT '开启状态',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
`fee_rate` double NOT NULL DEFAULT 0 COMMENT '渠道费率,单位:百分比',
`app_id` bigint NOT NULL COMMENT '应用编号',
`config` varchar(8192) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付渠道\n';
-- ----------------------------
-- Records of pay_channel
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_demo_order
-- ----------------------------
DROP TABLE IF EXISTS `pay_demo_order`;
CREATE TABLE `pay_demo_order` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号',
`user_id` bigint UNSIGNED NOT NULL COMMENT '用户编号',
`spu_id` bigint NOT NULL COMMENT '商品编号',
`spu_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '商品名字',
`price` int NOT NULL COMMENT '价格,单位:分',
`pay_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]',
`pay_order_id` bigint NULL DEFAULT NULL COMMENT '支付订单编号',
`pay_channel_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '支付成功的支付渠道',
`pay_time` datetime NULL DEFAULT NULL COMMENT '订单支付时间',
`pay_refund_id` bigint NULL DEFAULT NULL COMMENT '退款订单编号',
`refund_price` int NOT NULL DEFAULT 0 COMMENT '退款金额,单位:分',
`refund_time` datetime NULL DEFAULT NULL COMMENT '退款时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 180 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '示例订单\n';
-- ----------------------------
-- Records of pay_demo_order
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_notify_log
-- ----------------------------
DROP TABLE IF EXISTS `pay_notify_log`;
CREATE TABLE `pay_notify_log` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志编号',
`task_id` bigint NOT NULL COMMENT '通知任务编号',
`notify_times` tinyint NOT NULL COMMENT '第几次被通知',
`response` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '请求参数',
`status` tinyint NOT NULL COMMENT '通知状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 372148 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付通知 App 的日志';
-- ----------------------------
-- Records of pay_notify_log
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_notify_task
-- ----------------------------
DROP TABLE IF EXISTS `pay_notify_task`;
CREATE TABLE `pay_notify_task` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号',
`app_id` bigint NOT NULL COMMENT '应用编号',
`type` tinyint NOT NULL COMMENT '通知类型',
`data_id` bigint NOT NULL COMMENT '数据编号',
`status` tinyint NOT NULL COMMENT '通知状态',
`merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商户订单编号',
`merchant_transfer_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商户转账单编号',
`next_notify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '下一次通知时间',
`last_execute_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次执行时间',
`notify_times` tinyint NOT NULL COMMENT '当前通知次数',
`max_notify_times` tinyint NOT NULL COMMENT '最大可通知次数',
`notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知地址',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 328 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商户支付、退款等的通知\n';
-- ----------------------------
-- Records of pay_notify_task
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_order
-- ----------------------------
DROP TABLE IF EXISTS `pay_order`;
CREATE TABLE `pay_order` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付订单编号',
`app_id` bigint NOT NULL COMMENT '应用编号',
`channel_id` bigint NULL DEFAULT NULL COMMENT '渠道编号',
`channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道编码',
`merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号',
`subject` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品标题',
`body` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品描述',
`notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知地址',
`price` bigint NOT NULL COMMENT '支付金额,单位:分',
`channel_fee_rate` double NULL DEFAULT 0 COMMENT '渠道手续费,单位:百分比',
`channel_fee_price` bigint NULL DEFAULT 0 COMMENT '渠道手续金额,单位:分',
`status` tinyint NOT NULL COMMENT '支付状态',
`user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP',
`expire_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单失效时间',
`success_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单支付成功时间',
`extension_id` bigint NULL DEFAULT NULL COMMENT '支付成功的订单拓展单编号',
`no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付订单号',
`refund_price` bigint NOT NULL COMMENT '退款总金额,单位:分',
`channel_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道用户编号',
`channel_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道订单号',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 394 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付订单\n';
-- ----------------------------
-- Records of pay_order
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_order_extension
-- ----------------------------
DROP TABLE IF EXISTS `pay_order_extension`;
CREATE TABLE `pay_order_extension` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付订单编号',
`no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付订单号',
`order_id` bigint NOT NULL COMMENT '支付订单编号',
`channel_id` bigint NOT NULL COMMENT '渠道编号',
`channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
`user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP',
`status` tinyint NOT NULL COMMENT '支付状态',
`channel_extras` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道的额外参数',
`channel_error_code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误码',
`channel_error_msg` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误信息',
`channel_notify_data` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道异步通知的内容',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 950 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付订单\n';
-- ----------------------------
-- Records of pay_order_extension
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_refund
-- ----------------------------
DROP TABLE IF EXISTS `pay_refund`;
CREATE TABLE `pay_refund` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付退款编号',
`no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款单号',
`app_id` bigint NOT NULL COMMENT '应用编号',
`channel_id` bigint NOT NULL COMMENT '渠道编号',
`channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
`order_id` bigint NOT NULL COMMENT '支付订单编号 pay_order 表id',
`order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付订单 no',
`merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号(商户系统生成)',
`merchant_refund_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户退款订单号(商户系统生成)',
`notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知商户地址',
`status` tinyint NOT NULL COMMENT '退款状态',
`pay_price` bigint NOT NULL COMMENT '支付金额,单位分',
`refund_price` bigint NOT NULL COMMENT '退款金额,单位分',
`reason` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款原因',
`user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户 IP',
`channel_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道订单号,pay_order 中的 channel_order_no 对应',
`channel_refund_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道退款单号,渠道返回',
`success_time` datetime NULL DEFAULT NULL COMMENT '退款成功时间',
`channel_error_code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误码',
`channel_error_msg` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误信息',
`channel_notify_data` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道异步通知的内容',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 97 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '退款订单';
-- ----------------------------
-- Records of pay_refund
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_wallet
-- ----------------------------
DROP TABLE IF EXISTS `pay_wallet`;
CREATE TABLE `pay_wallet` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`user_id` bigint NOT NULL COMMENT '用户编号',
`user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型',
`balance` int NOT NULL DEFAULT 0 COMMENT '余额,单位分',
`total_expense` int NOT NULL DEFAULT 0 COMMENT '累计支出,单位分',
`total_recharge` int NOT NULL DEFAULT 0 COMMENT '累计充值,单位分',
`freeze_price` int NOT NULL DEFAULT 0 COMMENT '冻结金额,单位分',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包表';
-- ----------------------------
-- Records of pay_wallet
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_wallet_recharge
-- ----------------------------
DROP TABLE IF EXISTS `pay_wallet_recharge`;
CREATE TABLE `pay_wallet_recharge` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`wallet_id` bigint NOT NULL COMMENT '会员钱包 id',
`total_price` int NOT NULL COMMENT '用户实际到账余额,例如充 100 送 20,则该值是 120',
`pay_price` int NOT NULL COMMENT '实际支付金额',
`bonus_price` int NOT NULL COMMENT '钱包赠送金额',
`package_id` bigint NULL DEFAULT NULL COMMENT '充值套餐编号',
`pay_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]',
`pay_order_id` bigint NULL DEFAULT NULL COMMENT '支付订单编号',
`pay_channel_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付成功的支付渠道',
`pay_time` datetime NULL DEFAULT NULL COMMENT '订单支付时间',
`pay_refund_id` bigint NULL DEFAULT NULL COMMENT '支付退款单编号',
`refund_total_price` int NOT NULL DEFAULT 0 COMMENT '退款金额,包含赠送金额',
`refund_pay_price` int NOT NULL DEFAULT 0 COMMENT '退款支付金额',
`refund_bonus_price` int NOT NULL DEFAULT 0 COMMENT '退款钱包赠送金额',
`refund_time` datetime NULL DEFAULT NULL COMMENT '退款时间',
`refund_status` int NOT NULL DEFAULT 0 COMMENT '退款状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值';
-- ----------------------------
-- Records of pay_wallet_recharge
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_wallet_recharge_package
-- ----------------------------
DROP TABLE IF EXISTS `pay_wallet_recharge_package`;
CREATE TABLE `pay_wallet_recharge_package` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '套餐名',
`pay_price` int NOT NULL COMMENT '支付金额',
`bonus_price` int NOT NULL COMMENT '赠送金额',
`status` tinyint NOT NULL COMMENT '状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '充值套餐表';
-- ----------------------------
-- Records of pay_wallet_recharge_package
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for pay_wallet_transaction
-- ----------------------------
DROP TABLE IF EXISTS `pay_wallet_transaction`;
CREATE TABLE `pay_wallet_transaction` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`wallet_id` bigint NOT NULL COMMENT '会员钱包 id',
`biz_type` tinyint NOT NULL COMMENT '关联类型',
`biz_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关联业务编号',
`no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流水号',
`title` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流水标题',
`price` int NOT NULL COMMENT '交易金额, 单位分',
`balance` int NOT NULL COMMENT '余额, 单位分',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包流水表';
-- ----------------------------
-- Records of pay_wallet_transaction
-- ----------------------------
BEGIN;
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

File diff suppressed because it is too large Load Diff

149
pom.xml Normal file
View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<modules>
<module>yudao-dependencies</module>
<module>yudao-framework</module>
<!-- Server 主项目 -->
<module>yudao-server</module>
<!-- 各种 module 拓展 -->
<module>yudao-module-system</module>
<module>yudao-module-infra</module>
<!-- <module>yudao-module-member</module>-->
<!-- <module>yudao-module-bpm</module>-->
<!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>-->
<!-- <module>yudao-module-pay</module>-->
<!-- <module>yudao-module-mall</module>-->
<!-- <module>yudao-module-crm</module>-->
<!-- <module>yudao-module-erp</module>-->
<!-- 示例项目 -->
<!-- <module>yudao-example</module>-->
</modules>
<name>${project.artifactId}</name>
<description>芋道项目基础脚手架</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<revision>2.0.1-jdk8-snapshot</revision>
<!-- Maven 相关 -->
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<!-- 看看咋放到 bom 里 -->
<lombok.version>1.18.30</lombok.version>
<spring.boot.version>2.7.18</spring.boot.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-dependencies</artifactId>
<version>${revision}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- maven-surefire-plugin 插件,用于运行单元测试。 -->
<!-- 注意,需要使用 3.0.X+,因为要支持 Junit 5 版本 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<!-- maven-compiler-plugin 插件,解决 spring-boot-configuration-processor + Lombok + MapStruct 组合 -->
<!-- https://stackoverflow.com/questions/33483697/re-run-spring-boot-configuration-annotation-processor-to-update-generated-metada -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${spring.boot.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- 统一 revision 版本 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
<updatePomFile>true</updatePomFile>
</configuration>
<executions>
<execution>
<goals>
<goal>flatten</goal>
</goals>
<id>flatten</id>
<phase>process-resources</phase>
</execution>
<execution>
<goals>
<goal>clean</goal>
</goals>
<id>flatten.clean</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- 使用 huawei / aliyun 的 Maven 源,提升下载速度 -->
<repositories>
<repository>
<id>huaweicloud</id>
<name>huawei</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</repository>
<repository>
<id>aliyunmaven</id>
<name>aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>
</project>

657
yudao-dependencies/pom.xml Normal file
View File

@ -0,0 +1,657 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-dependencies</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>基础 bom 文件,管理整个项目的依赖版本</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<revision>2.0.1-jdk8-snapshot</revision>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<!-- 统一依赖管理 -->
<spring.boot.version>2.7.18</spring.boot.version>
<!-- Web 相关 -->
<springdoc.version>1.6.15</springdoc.version>
<knife4j.version>4.3.0</knife4j.version>
<servlet.versoin>2.5</servlet.versoin>
<!-- DB 相关 -->
<druid.version>1.2.21</druid.version>
<mybatis-plus.version>3.5.5</mybatis-plus.version>
<mybatis-plus-generator.version>3.5.5</mybatis-plus-generator.version>
<dynamic-datasource.version>4.3.0</dynamic-datasource.version>
<mybatis-plus-join.version>1.4.10</mybatis-plus-join.version>
<easy-trans.version>2.2.11</easy-trans.version>
<redisson.version>3.18.0</redisson.version> <!-- Spring Boot 2.X 最多使用 3.18.0 版本,否则会报 Tuple NoClassDefFoundError -->
<dm8.jdbc.version>8.1.3.62</dm8.jdbc.version>
<!-- 消息队列 -->
<rocketmq-spring.version>2.2.3</rocketmq-spring.version>
<!-- 服务保障相关 -->
<lock4j.version>2.2.7</lock4j.version>
<!-- 监控相关 -->
<skywalking.version>8.12.0</skywalking.version>
<spring-boot-admin.version>2.7.15</spring-boot-admin.version>
<opentracing.version>0.33.0</opentracing.version>
<!-- Test 测试相关 -->
<podam.version>7.2.11.RELEASE</podam.version> <!-- Spring Boot 2.X 最多使用 7.2.11 版本 -->
<jedis-mock.version>1.0.13</jedis-mock.version>
<mockito-inline.version>4.11.0</mockito-inline.version>
<!-- Bpm 工作流相关 -->
<flowable.version>6.8.0</flowable.version>
<!-- 工具类相关 -->
<captcha-plus.version>1.0.10</captcha-plus.version>
<jsoup.version>1.17.2</jsoup.version>
<lombok.version>1.18.30</lombok.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<hutool.version>5.8.25</hutool.version>
<easyexcel.verion>3.3.3</easyexcel.verion>
<velocity.version>2.3</velocity.version>
<screw.version>1.0.5</screw.version>
<fastjson.version>1.2.83</fastjson.version>
<guava.version>33.0.0-jre</guava.version>
<guice.version>5.1.0</guice.version>
<transmittable-thread-local.version>2.14.5</transmittable-thread-local.version>
<commons-net.version>3.10.0</commons-net.version>
<jsch.version>0.1.55</jsch.version>
<tika-core.version>2.9.1</tika-core.version>
<ip2region.version>2.7.0</ip2region.version>
<bizlog-sdk.version>3.0.6</bizlog-sdk.version>
<!-- 三方云服务相关 -->
<okio.version>3.5.0</okio.version>
<okhttp3.version>4.11.0</okhttp3.version>
<commons-io.version>2.15.1</commons-io.version>
<minio.version>8.5.7</minio.version>
<aliyun-java-sdk-core.version>4.6.4</aliyun-java-sdk-core.version>
<aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version>
<tencentcloud-sdk-java.version>3.1.880</tencentcloud-sdk-java.version>
<justauth.version>1.0.8</justauth.version>
<jimureport.version>1.6.6</jimureport.version>
<xercesImpl.version>2.12.2</xercesImpl.version>
<weixin-java.version>4.6.0</weixin-java.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- 统一依赖管理 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>io.github.mouzt</groupId>
<artifactId>bizlog-sdk</artifactId>
<version>${bizlog-sdk.version}</version>
<exclusions>
<exclusion> <!-- 排除掉springboot依赖使用项目的 -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
<version>${revision}</version>
</dependency>
<!-- Spring 核心 -->
<dependency>
<!-- 用于生成自定义的 Spring @ConfigurationProperties 配置类的说明文件 -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-websocket</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId> <!-- 代码生成器,使用它解析表结构 -->
<version>${mybatis-plus-generator.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 -->
<version>${dynamic-datasource.version}</version>
</dependency>
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId> <!-- MyBatis 联表查询 -->
<version>${mybatis-plus-join.version}</version>
</dependency>
<dependency>
<groupId>com.fhs-opensource</groupId> <!-- VO 数据翻译 -->
<artifactId>easy-trans-spring-boot-starter</artifactId>
<version>${easy-trans.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fhs-opensource</groupId>
<artifactId>easy-trans-mybatis-plus-extend</artifactId>
<version>${easy-trans.version}</version>
</dependency>
<dependency>
<groupId>com.fhs-opensource</groupId>
<artifactId>easy-trans-anno</artifactId>
<version>${easy-trans.version}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>${redisson.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>${dm8.jdbc.version}</version>
</dependency>
<!-- Job 定时任务相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-job</artifactId>
<version>${revision}</version>
</dependency>
<!-- 消息队列相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mq</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>${rocketmq-spring.version}</version>
</dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-protection</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
<version>${lock4j.version}</version>
<exclusions>
<exclusion>
<artifactId>redisson-spring-boot-starter</artifactId>
<groupId>org.redisson</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-opentracing</artifactId>
<version>${skywalking.version}</version>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <artifactId>opentracing-api</artifactId>-->
<!-- <groupId>io.opentracing</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>opentracing-util</artifactId>-->
<!-- <groupId>io.opentracing</groupId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-util</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-noop</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
<version>${spring-boot-admin.version}</version>
<exclusions>
<exclusion>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-cloud</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
<version>${spring-boot-admin.version}</version>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
<version>${revision}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito-inline.version}</version> <!-- 支持 Mockito 的 final 类与 static 方法的 mock -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.fppt</groupId> <!-- 单元测试,我们采用内嵌的 Redis 数据库 -->
<artifactId>jedis-mock</artifactId>
<version>${jedis-mock.version}</version>
</dependency>
<dependency>
<groupId>uk.co.jemos.podam</groupId> <!-- 单元测试,随机生成 POJO 类 -->
<artifactId>podam</artifactId>
<version>${podam.version}</version>
</dependency>
<!-- 工作流相关 -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-process</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-actuator</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- 工作流相关结束 -->
<!-- 工具类相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.verion}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId> <!-- 文件类型的识别 -->
<version>${tika-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId> <!-- 实现数据库文档 -->
<version>${screw.version}</version>
<exclusions>
<exclusion>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId> <!-- 移除 Freemarker 依赖,采用 Velocity 作为模板引擎 -->
</exclusion>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <!-- 最新版screw-core1.0.5依赖fastjson1.2.73存在漏洞,移除。 -->
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId> <!-- 解决 ThreadLocal 父子线程的传值问题 -->
<version>${transmittable-thread-local.version}</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId> <!-- 解决 ftp 连接 -->
<version>${commons-net.version}</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId> <!-- 解决 sftp 连接 -->
<version>${jsch.version}</version>
</dependency>
<dependency>
<groupId>com.xingyuv</groupId>
<artifactId>spring-boot-starter-captcha-plus</artifactId>
<version>${captcha-plus.version}</version>
</dependency>
<dependency>
<groupId>org.lionsoul</groupId>
<artifactId>ip2region</artifactId>
<version>${ip2region.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<!-- 三方云服务相关 -->
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>${okio.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp3.version}</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>${minio.version}</version>
</dependency>
<!-- SMS SDK begin -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>${aliyun-java-sdk-core.version}</version>
<exclusions>
<exclusion>
<artifactId>opentracing-api</artifactId>
<groupId>io.opentracing</groupId>
</exclusion>
<exclusion>
<artifactId>opentracing-util</artifactId>
<groupId>io.opentracing</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>${aliyun-java-sdk-dysmsapi.version}</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java-sms</artifactId>
<version>${tencentcloud-sdk-java.version}</version>
</dependency>
<!-- SMS SDK end -->
<dependency>
<groupId>com.xingyuv</groupId>
<artifactId>spring-boot-starter-justauth</artifactId> <!-- 社交登陆(例如说,个人微信、企业微信等等) -->
<version>${justauth.version}</version>
<exclusions>
<exclusion>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
<version>${weixin-java.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
<version>${weixin-java.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId>
<version>${weixin-java.version}</version>
</dependency>
<!-- 积木报表-->
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
<version>${jimureport.version}</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xercesImpl.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<!-- 统一 revision 版本 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
<updatePomFile>true</updatePomFile>
</configuration>
<executions>
<execution>
<goals>
<goal>flatten</goal>
</goals>
<id>flatten</id>
<phase>process-resources</phase>
</execution>
<execution>
<goals>
<goal>clean</goal>
</goals>
<id>flatten.clean</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

22
yudao-example/pom.xml Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 由于方便大家拷贝,使用不使用 yudao 作为 Maven parent -->
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-example</artifactId>
<version>1.0.0-snapshot</version>
<packaging>pom</packaging>
<modules>
<module>yudao-sso-demo-by-code</module>
<module>yudao-sso-demo-by-password</module>
</modules>
<name>${project.artifactId}</name>
<description>提供各种示例,例如说:SSO 单点登录</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
</project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 由于方便大家拷贝,使用不使用 yudao 作为 Maven parent -->
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-sso-demo-by-code</artifactId>
<version>1.0.0-snapshot</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>基于授权码模式,如何实现 SSO 单点登录?</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<!-- Maven 相关 -->
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 统一依赖管理 -->
<spring.boot.version>2.7.18</spring.boot.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- 统一依赖管理 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Web 相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.22</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.ssodemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SSODemoApplication {
public static void main(String[] args) {
SpringApplication.run(SSODemoApplication.class, args);
}
}

View File

@ -0,0 +1,157 @@
package cn.iocoder.yudao.ssodemo.client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2AccessTokenRespDTO;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2CheckTokenRespDTO;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.Base64Utils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
/**
* OAuth 2.0 客户端
*
* 对应调用 OAuth2OpenController 接口
*/
@Component
public class OAuth2Client {
private static final String BASE_URL = "http://127.0.0.1:48080/admin-api/system/oauth2";
/**
* 租户编号
*
* 默认使用 1;如果使用别的租户,可以调整
*/
public static final Long TENANT_ID = 1L;
private static final String CLIENT_ID = "yudao-sso-demo-by-code";
private static final String CLIENT_SECRET = "test";
// @Resource // 可优化,注册一个 RestTemplate Bean,然后注入
private final RestTemplate restTemplate = new RestTemplate();
/**
* 使用 code 授权码,获得访问令牌
*
* @param code 授权码
* @param redirectUri 重定向 URI
* @return 访问令牌
*/
public CommonResult<OAuth2AccessTokenRespDTO> postAccessToken(String code, String redirectUri) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("grant_type", "authorization_code");
body.add("code", code);
body.add("redirect_uri", redirectUri);
// body.add("state", ""); // 选填;填了会校验
// 2. 执行请求
ResponseEntity<CommonResult<OAuth2AccessTokenRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/token",
HttpMethod.POST,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<OAuth2AccessTokenRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
/**
* 校验访问令牌,并返回它的基本信息
*
* @param token 访问令牌
* @return 访问令牌的基本信息
*/
public CommonResult<OAuth2CheckTokenRespDTO> checkToken(String token) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("token", token);
// 2. 执行请求
ResponseEntity<CommonResult<OAuth2CheckTokenRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/check-token",
HttpMethod.POST,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<OAuth2CheckTokenRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
/**
* 使用刷新令牌,获得(刷新)访问令牌
*
* @param refreshToken 刷新令牌
* @return 访问令牌
*/
public CommonResult<OAuth2AccessTokenRespDTO> refreshToken(String refreshToken) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("grant_type", "refresh_token");
body.add("refresh_token", refreshToken);
// 2. 执行请求
ResponseEntity<CommonResult<OAuth2AccessTokenRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/token",
HttpMethod.POST,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<OAuth2AccessTokenRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
/**
* 删除访问令牌
*
* @param token 访问令牌
* @return 成功
*/
public CommonResult<Boolean> revokeToken(String token) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("token", token);
// 2. 执行请求
ResponseEntity<CommonResult<Boolean>> exchange = restTemplate.exchange(
BASE_URL + "/token",
HttpMethod.DELETE,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<Boolean>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
private static void addClientHeader(HttpHeaders headers) {
// client 拼接,需要 BASE64 编码
String client = CLIENT_ID + ":" + CLIENT_SECRET;
client = Base64Utils.encodeToString(client.getBytes(StandardCharsets.UTF_8));
headers.add("Authorization", "Basic " + client);
}
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.ssodemo.client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserInfoRespDTO;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserUpdateReqDTO;
import cn.iocoder.yudao.ssodemo.framework.core.LoginUser;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
/**
* 用户 User 信息的客户端
*
* 对应调用 OAuth2UserController 接口
*/
@Component
public class UserClient {
private static final String BASE_URL = "http://127.0.0.1:48080/admin-api//system/oauth2/user";
// @Resource // 可优化,注册一个 RestTemplate Bean,然后注入
private final RestTemplate restTemplate = new RestTemplate();
public CommonResult<UserInfoRespDTO> getUser() {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", OAuth2Client.TENANT_ID.toString());
addTokenHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
// 2. 执行请求
ResponseEntity<CommonResult<UserInfoRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/get",
HttpMethod.GET,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<UserInfoRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
public CommonResult<Boolean> updateUser(UserUpdateReqDTO updateReqDTO) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("tenant-id", OAuth2Client.TENANT_ID.toString());
addTokenHeader(headers);
// 1.2 构建请求参数
// 使用 updateReqDTO 即可
// 2. 执行请求
ResponseEntity<CommonResult<Boolean>> exchange = restTemplate.exchange(
BASE_URL + "/update",
HttpMethod.PUT,
new HttpEntity<>(updateReqDTO, headers),
new ParameterizedTypeReference<CommonResult<Boolean>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
private static void addTokenHeader(HttpHeaders headers) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Assert.notNull(loginUser, "登录用户不能为空");
headers.add("Authorization", "Bearer " + loginUser.getAccessToken());
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.ssodemo.client.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 通用返回
*
* @param <T> 数据泛型
*/
@Data
public class CommonResult<T> implements Serializable {
/**
* 错误码
*/
private Integer code;
/**
* 返回数据
*/
private T data;
/**
* 错误提示,用户可阅读
*/
private String msg;
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.ssodemo.client.dto.oauth2;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 访问令牌 Response DTO
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OAuth2AccessTokenRespDTO {
/**
* 访问令牌
*/
@JsonProperty("access_token")
private String accessToken;
/**
* 刷新令牌
*/
@JsonProperty("refresh_token")
private String refreshToken;
/**
* 令牌类型
*/
@JsonProperty("token_type")
private String tokenType;
/**
* 过期时间;单位:秒
*/
@JsonProperty("expires_in")
private Long expiresIn;
/**
* 授权范围;如果多个授权范围,使用空格分隔
*/
private String scope;
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.ssodemo.client.dto.oauth2;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 校验令牌 Response DTO
*
* @author 芋道源码
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OAuth2CheckTokenRespDTO {
/**
* 用户编号
*/
@JsonProperty("user_id")
private Long userId;
/**
* 用户类型
*/
@JsonProperty("user_type")
private Integer userType;
/**
* 租户编号
*/
@JsonProperty("tenant_id")
private Long tenantId;
/**
* 客户端编号
*/
@JsonProperty("client_id")
private String clientId;
/**
* 授权范围
*/
private List<String> scopes;
/**
* 访问令牌
*/
@JsonProperty("access_token")
private String accessToken;
/**
* 过期时间
*
* 时间戳 / 1000,即单位:秒
*/
private Long exp;
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.ssodemo.client.dto.user;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 获得用户基本信息 Response dto
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoRespDTO {
/**
* 用户编号
*/
private Long id;
/**
* 用户账号
*/
private String username;
/**
* 用户昵称
*/
private String nickname;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String mobile;
/**
* 用户性别
*/
private Integer sex;
/**
* 用户头像
*/
private String avatar;
/**
* 所在部门
*/
private Dept dept;
/**
* 所属岗位数组
*/
private List<Post> posts;
/**
* 部门
*/
@Data
public static class Dept {
/**
* 部门编号
*/
private Long id;
/**
* 部门名称
*/
private String name;
}
/**
* 岗位
*/
@Data
public static class Post {
/**
* 岗位编号
*/
private Long id;
/**
* 岗位名称
*/
private String name;
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.ssodemo.client.dto.user;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 更新用户基本信息 Request DTO
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserUpdateReqDTO {
/**
* 用户昵称
*/
private String nickname;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String mobile;
/**
* 用户性别
*/
private Integer sex;
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.ssodemo.controller;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.ssodemo.client.OAuth2Client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2AccessTokenRespDTO;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/auth")
public class AuthController {
@Resource
private OAuth2Client oauth2Client;
/**
* 使用 code 访问令牌,获得访问令牌
*
* @param code 授权码
* @param redirectUri 重定向 URI
* @return 访问令牌;注意,实际项目中,最好创建对应的 ResponseVO 类,只返回必要的字段
*/
@PostMapping("/login-by-code")
public CommonResult<OAuth2AccessTokenRespDTO> loginByCode(@RequestParam("code") String code,
@RequestParam("redirectUri") String redirectUri) {
return oauth2Client.postAccessToken(code, redirectUri);
}
/**
* 使用刷新令牌,获得(刷新)访问令牌
*
* @param refreshToken 刷新令牌
* @return 访问令牌;注意,实际项目中,最好创建对应的 ResponseVO 类,只返回必要的字段
*/
@PostMapping("/refresh-token")
public CommonResult<OAuth2AccessTokenRespDTO> refreshToken(@RequestParam("refreshToken") String refreshToken) {
return oauth2Client.refreshToken(refreshToken);
}
/**
* 退出登录
*
* @param request 请求
* @return 成功
*/
@PostMapping("/logout")
public CommonResult<Boolean> logout(HttpServletRequest request) {
String token = SecurityUtils.obtainAuthorization(request, "Authorization");
if (StrUtil.isNotBlank(token)) {
return oauth2Client.revokeToken(token);
}
// 返回成功
return new CommonResult<>();
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.ssodemo.controller;
import cn.iocoder.yudao.ssodemo.client.UserClient;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserInfoRespDTO;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserUpdateReqDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/user")
public class UserController {
@Resource
private UserClient userClient;
/**
* 获得当前登录用户的基本信息
*
* @return 用户信息;注意,实际项目中,最好创建对应的 ResponseVO 类,只返回必要的字段
*/
@GetMapping("/get")
public CommonResult<UserInfoRespDTO> getUser() {
return userClient.getUser();
}
/**
* 更新当前登录用户的昵称
*
* @param nickname 昵称
* @return 成功
*/
@PutMapping("/update")
public CommonResult<Boolean> updateUser(@RequestParam("nickname") String nickname) {
UserUpdateReqDTO updateReqDTO = new UserUpdateReqDTO(nickname, null, null, null);
return userClient.updateUser(updateReqDTO);
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.ssodemo.framework.config;
import cn.iocoder.yudao.ssodemo.framework.core.filter.TokenAuthenticationFilter;
import cn.iocoder.yudao.ssodemo.framework.core.handler.AccessDeniedHandlerImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.annotation.Resource;
@Configuration(proxyBeanMethods = false)
@EnableWebSecurity
public class SecurityConfiguration{
@Resource
private TokenAuthenticationFilter tokenAuthenticationFilter;
@Resource
private AccessDeniedHandlerImpl accessDeniedHandler;
@Resource
private AuthenticationEntryPoint authenticationEntryPoint;
@Bean
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
// 设置 URL 安全权限
httpSecurity.csrf().disable() // 禁用 CSRF 保护
.authorizeRequests()
// 1. 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
// 2. 登录相关的接口,可匿名访问
.antMatchers("/auth/login-by-code").permitAll()
.antMatchers("/auth/refresh-token").permitAll()
.antMatchers("/auth/logout").permitAll()
// last. 兜底规则,必须认证
.and().authorizeRequests()
.anyRequest().authenticated();
// 设置处理器
httpSecurity.exceptionHandling().accessDeniedHandler(accessDeniedHandler)
.authenticationEntryPoint(authenticationEntryPoint);
// 添加 Token Filter
httpSecurity.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
return httpSecurity.build();
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.ssodemo.framework.core;
import lombok.Data;
import java.util.List;
/**
* 登录用户信息
*
* @author 芋道源码
*/
@Data
public class LoginUser {
/**
* 用户编号
*/
private Long id;
/**
* 用户类型
*/
private Integer userType;
/**
* 租户编号
*/
private Long tenantId;
/**
* 授权范围
*/
private List<String> scopes;
/**
* 访问令牌
*/
private String accessToken;
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.ssodemo.framework.core.filter;
import cn.iocoder.yudao.ssodemo.client.OAuth2Client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2CheckTokenRespDTO;
import cn.iocoder.yudao.ssodemo.framework.core.LoginUser;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.annotation.Resource;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Token 过滤器,验证 token 的有效性
* 验证通过后,获得 {@link LoginUser} 信息,并加入到 Spring Security 上下文
*
* @author 芋道源码
*/
@Component
public class TokenAuthenticationFilter extends OncePerRequestFilter {
@Resource
private OAuth2Client oauth2Client;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
// 1. 获得访问令牌
String token = SecurityUtils.obtainAuthorization(request, "Authorization");
if (StringUtils.hasText(token)) {
// 2. 基于 token 构建登录用户
LoginUser loginUser = buildLoginUserByToken(token);
// 3. 设置当前用户
if (loginUser != null) {
SecurityUtils.setLoginUser(loginUser, request);
}
}
// 继续过滤链
filterChain.doFilter(request, response);
}
private LoginUser buildLoginUserByToken(String token) {
try {
CommonResult<OAuth2CheckTokenRespDTO> accessTokenResult = oauth2Client.checkToken(token);
OAuth2CheckTokenRespDTO accessToken = accessTokenResult.getData();
if (accessToken == null) {
return null;
}
// 构建登录用户
return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType())
.setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes())
.setAccessToken(accessToken.getAccessToken());
} catch (Exception exception) {
// 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可
return null;
}
}
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.ssodemo.framework.core.handler;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
import cn.iocoder.yudao.ssodemo.framework.core.util.ServletUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.security.web.access.ExceptionTranslationFilter;
import org.springframework.stereotype.Component;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 访问一个需要认证的 URL 资源,已经认证(登录)但是没有权限的情况下,返回 {@link GlobalErrorCodeConstants#FORBIDDEN} 错误码。
*
* 补充:Spring Security 通过 {@link ExceptionTranslationFilter#handleAccessDeniedException(HttpServletRequest, HttpServletResponse, FilterChain, AccessDeniedException)} 方法,调用当前类
*
* @author 芋道源码
*/
@Component
@SuppressWarnings("JavadocReference")
@Slf4j
public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e)
throws IOException, ServletException {
// 打印 warn 的原因是,不定期合并 warn,看看有没恶意破坏
log.warn("[commence][访问 URL({}) 时,用户({}) 权限不够]", request.getRequestURI(),
SecurityUtils.getLoginUserId(), e);
// 返回 403
CommonResult<Object> result = new CommonResult<>();
result.setCode(HttpStatus.FORBIDDEN.value());
result.setMsg("没有该操作权限");
ServletUtils.writeJSON(response, result);
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.ssodemo.framework.core.handler;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.framework.core.util.ServletUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.ExceptionTranslationFilter;
import org.springframework.stereotype.Component;
import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 访问一个需要认证的 URL 资源,但是此时自己尚未认证(登录)的情况下,返回 {@link GlobalErrorCodeConstants#UNAUTHORIZED} 错误码,从而使前端重定向到登录页
*
* 补充:Spring Security 通过 {@link ExceptionTranslationFilter#sendStartAuthentication(HttpServletRequest, HttpServletResponse, FilterChain, AuthenticationException)} 方法,调用当前类
*/
@Component
@Slf4j
@SuppressWarnings("JavadocReference") // 忽略文档引用报错
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e);
// 返回 401
CommonResult<Object> result = new CommonResult<>();
result.setCode(HttpStatus.UNAUTHORIZED.value());
result.setMsg("账号未登录");
ServletUtils.writeJSON(response, result);
}
}

View File

@ -0,0 +1,103 @@
package cn.iocoder.yudao.ssodemo.framework.core.util;
import cn.iocoder.yudao.ssodemo.framework.core.LoginUser;
import org.springframework.lang.Nullable;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
/**
* 安全服务工具类
*
* @author 芋道源码
*/
public class SecurityUtils {
public static final String AUTHORIZATION_BEARER = "Bearer";
private SecurityUtils() {}
/**
* 从请求中,获得认证 Token
*
* @param request 请求
* @param header 认证 Token 对应的 Header 名字
* @return 认证 Token
*/
public static String obtainAuthorization(HttpServletRequest request, String header) {
String authorization = request.getHeader(header);
if (!StringUtils.hasText(authorization)) {
return null;
}
int index = authorization.indexOf(AUTHORIZATION_BEARER + " ");
if (index == -1) { // 未找到
return null;
}
return authorization.substring(index + 7).trim();
}
/**
* 获得当前认证信息
*
* @return 认证信息
*/
public static Authentication getAuthentication() {
SecurityContext context = SecurityContextHolder.getContext();
if (context == null) {
return null;
}
return context.getAuthentication();
}
/**
* 获取当前用户
*
* @return 当前用户
*/
@Nullable
public static LoginUser getLoginUser() {
Authentication authentication = getAuthentication();
if (authentication == null) {
return null;
}
return authentication.getPrincipal() instanceof LoginUser ? (LoginUser) authentication.getPrincipal() : null;
}
/**
* 获得当前用户的编号,从上下文中
*
* @return 用户编号
*/
@Nullable
public static Long getLoginUserId() {
LoginUser loginUser = getLoginUser();
return loginUser != null ? loginUser.getId() : null;
}
/**
* 设置当前用户
*
* @param loginUser 登录用户
* @param request 请求
*/
public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) {
// 创建 Authentication,并设置到上下文
Authentication authentication = buildAuthentication(loginUser, request);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
private static Authentication buildAuthentication(LoginUser loginUser, HttpServletRequest request) {
// 创建 UsernamePasswordAuthenticationToken 对象
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
loginUser, null, Collections.emptyList());
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
return authenticationToken;
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.ssodemo.framework.core.util;
import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.json.JSONUtil;
import org.springframework.http.MediaType;
import javax.servlet.http.HttpServletResponse;
/**
* 客户端工具类
*
* @author 芋道源码
*/
public class ServletUtils {
/**
* 返回 JSON 字符串
*
* @param response 响应
* @param object 对象,会序列化成 JSON 字符串
*/
@SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码
public static void writeJSON(HttpServletResponse response, Object object) {
String content = JSONUtil.toJsonStr(object);
ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE);
}
public static void write(HttpServletResponse response, String text, String contentType) {
ServletUtil.write(response, text, contentType);
}
}

View File

@ -0,0 +1,2 @@
server:
port: 18080

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SSO 授权后的回调页</title>
<!-- jQuery:操作 dom、发起请求等 -->
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.2/jquery.min.js" type="application/javascript"></script>
<!-- 工具类 -->
<script type="application/javascript">
(function ($) {
/**
* 获得 URL 的指定参数的值
*
* @param name 参数名
* @returns 参数值
*/
$.getUrlParam = function (name) {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
const r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
})(jQuery);
</script>
<script type="application/javascript">
$(function () {
// 获得 code 授权码
const code = $.getUrlParam('code');
if (!code) {
alert('获取不到 code 参数,请排查!')
return;
}
// 提交
const redirectUri = 'http://127.0.0.1:18080/callback.html'; // 需要修改成,你回调的地址,就是在 index.html 拼接的 redirectUri
$.ajax({
url: "http://127.0.0.1:18080/auth/login-by-code?code=" + code
+ '&redirectUri=' + redirectUri,
method: 'POST',
success: function( result ) {
if (result.code !== 0) {
alert('获得访问令牌失败,原因:' + result.msg)
return;
}
alert('获得访问令牌成功!点击确认,跳转回首页')
// 设置到 localStorage 中
localStorage.setItem('ACCESS-TOKEN', result.data.access_token);
localStorage.setItem('REFRESH-TOKEN', result.data.refresh_token);
// 跳转回首页
window.location.href = '/index.html';
}
})
})
</script>
</head>
<body>
正在使用 code 授权码,进行 accessToken 访问令牌的获取
</body>
</html>

View File

@ -0,0 +1,159 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>首页</title>
<!-- jQuery:操作 dom、发起请求等 -->
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.2/jquery.min.js" type="application/javascript"></script>
<script type="application/javascript">
/**
* 跳转单点登录
*/
function ssoLogin() {
const clientId = 'yudao-sso-demo-by-code'; // 可以改写成,你的 clientId
const redirectUri = encodeURIComponent('http://127.0.0.1:18080/callback.html'); // 注意,需要使用 encodeURIComponent 编码地址
const responseType = 'code'; // 1)授权码模式,对应 code;2)简化模式,对应 token
window.location.href = 'http://127.0.0.1:1024/sso?client_id=' + clientId
+ '&redirect_uri=' + redirectUri
+ '&response_type=' + responseType;
}
/**
* 修改昵称
*/
function updateNickname() {
const nickname = prompt("请输入新的昵称", "");
if (!nickname) {
return;
}
// 更新用户的昵称
const accessToken = localStorage.getItem('ACCESS-TOKEN');
$.ajax({
url: "http://127.0.0.1:18080/user/update?nickname=" + nickname,
method: 'PUT',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function (result) {
if (result.code !== 0) {
alert('更新昵称失败,原因:' + result.msg)
return;
}
alert('更新昵称成功!');
$('#nicknameSpan').html(nickname);
}
});
}
/**
* 刷新令牌
*/
function refreshToken() {
const refreshToken = localStorage.getItem('REFRESH-TOKEN');
if (!refreshToken) {
alert("获取不到刷新令牌");
return;
}
$.ajax({
url: "http://127.0.0.1:18080/auth/refresh-token?refreshToken=" + refreshToken,
method: 'POST',
success: function (result) {
if (result.code !== 0) {
alert('刷新访问令牌失败,原因:' + result.msg)
return;
}
alert('更新访问令牌成功!');
$('#accessTokenSpan').html(result.data.access_token);
// 设置到 localStorage 中
localStorage.setItem('ACCESS-TOKEN', result.data.access_token);
localStorage.setItem('REFRESH-TOKEN', result.data.refresh_token);
}
});
}
/**
* 登出,删除访问令牌
*/
function logout() {
const accessToken = localStorage.getItem('ACCESS-TOKEN');
if (!accessToken) {
location.reload();
return;
}
$.ajax({
url: "http://127.0.0.1:18080/auth/logout",
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function (result) {
if (result.code !== 0) {
alert('退出登录失败,原因:' + result.msg)
return;
}
alert('退出登录成功!');
// 删除 localStorage 中
localStorage.removeItem('ACCESS-TOKEN');
localStorage.removeItem('REFRESH-TOKEN');
location.reload();
}
});
}
$(function () {
const accessToken = localStorage.getItem('ACCESS-TOKEN');
// 情况一:未登录
if (!accessToken) {
$('#noLoginDiv').css("display", "block");
return;
}
// 情况二:已登录
$('#yesLoginDiv').css("display", "block");
$('#accessTokenSpan').html(accessToken);
// 获得登录用户的信息
$.ajax({
url: "http://127.0.0.1:18080/user/get",
method: 'GET',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function (result) {
if (result.code !== 0) {
alert('获得个人信息失败,原因:' + result.msg)
return;
}
$('#nicknameSpan').html(result.data.nickname);
}
});
})
</script>
</head>
<body>
<!-- 情况一:未登录:1)跳转 ruoyi-vue-pro 的 SSO 登录页 -->
<div id="noLoginDiv" style="display: none">
您未登录,点击 <a href="#" onclick="ssoLogin()">跳转 </a> SSO 单点登录
</div>
<!-- 情况二:已登录:1)展示用户信息;2)刷新访问令牌;3)退出登录 -->
<div id="yesLoginDiv" style="display: none">
您已登录!<button onclick="logout()">退出登录</button> <br />
昵称:<span id="nicknameSpan"> 加载中... </span> <button onclick="updateNickname()">修改昵称</button> <br />
访问令牌:<span id="accessTokenSpan"> 加载中... </span> <button onclick="refreshToken()">刷新令牌</button> <br />
</div>
</body>
<style>
body { /** 页面居中 */
border-radius: 20px;
height: 350px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
</style>
</html>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 由于方便大家拷贝,使用不使用 yudao 作为 Maven parent -->
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-sso-demo-by-password</artifactId>
<version>1.0.0-snapshot</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>基于密码模式,如何实现 SSO 单点登录?</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<!-- Maven 相关 -->
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 统一依赖管理 -->
<spring.boot.version>2.7.18</spring.boot.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- 统一依赖管理 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Web 相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.22</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.ssodemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SSODemoApplication {
public static void main(String[] args) {
SpringApplication.run(SSODemoApplication.class, args);
}
}

View File

@ -0,0 +1,127 @@
package cn.iocoder.yudao.ssodemo.client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2AccessTokenRespDTO;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2CheckTokenRespDTO;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.Base64Utils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
/**
* OAuth 2.0 客户端
*
* 对应调用 OAuth2OpenController 接口
*/
@Component
public class OAuth2Client {
private static final String BASE_URL = "http://127.0.0.1:48080/admin-api/system/oauth2";
/**
* 租户编号
*
* 默认使用 1;如果使用别的租户,可以调整
*/
public static final Long TENANT_ID = 1L;
private static final String CLIENT_ID = "yudao-sso-demo-by-password";
private static final String CLIENT_SECRET = "test";
// @Resource // 可优化,注册一个 RestTemplate Bean,然后注入
private final RestTemplate restTemplate = new RestTemplate();
/**
* 校验访问令牌,并返回它的基本信息
*
* @param token 访问令牌
* @return 访问令牌的基本信息
*/
public CommonResult<OAuth2CheckTokenRespDTO> checkToken(String token) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("token", token);
// 2. 执行请求
ResponseEntity<CommonResult<OAuth2CheckTokenRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/check-token",
HttpMethod.POST,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<OAuth2CheckTokenRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
/**
* 使用刷新令牌,获得(刷新)访问令牌
*
* @param refreshToken 刷新令牌
* @return 访问令牌
*/
public CommonResult<OAuth2AccessTokenRespDTO> refreshToken(String refreshToken) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("grant_type", "refresh_token");
body.add("refresh_token", refreshToken);
// 2. 执行请求
ResponseEntity<CommonResult<OAuth2AccessTokenRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/token",
HttpMethod.POST,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<OAuth2AccessTokenRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
/**
* 删除访问令牌
*
* @param token 访问令牌
* @return 成功
*/
public CommonResult<Boolean> revokeToken(String token) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", TENANT_ID.toString());
addClientHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("token", token);
// 2. 执行请求
ResponseEntity<CommonResult<Boolean>> exchange = restTemplate.exchange(
BASE_URL + "/token",
HttpMethod.DELETE,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<Boolean>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
private static void addClientHeader(HttpHeaders headers) {
// client 拼接,需要 BASE64 编码
String client = CLIENT_ID + ":" + CLIENT_SECRET;
client = Base64Utils.encodeToString(client.getBytes(StandardCharsets.UTF_8));
headers.add("Authorization", "Basic " + client);
}
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.ssodemo.client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserInfoRespDTO;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserUpdateReqDTO;
import cn.iocoder.yudao.ssodemo.framework.core.LoginUser;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
/**
* 用户 User 信息的客户端
*
* 对应调用 OAuth2UserController 接口
*/
@Component
public class UserClient {
private static final String BASE_URL = "http://127.0.0.1:48080/admin-api//system/oauth2/user";
// @Resource // 可优化,注册一个 RestTemplate Bean,然后注入
private final RestTemplate restTemplate = new RestTemplate();
public CommonResult<UserInfoRespDTO> getUser() {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("tenant-id", OAuth2Client.TENANT_ID.toString());
addTokenHeader(headers);
// 1.2 构建请求参数
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
// 2. 执行请求
ResponseEntity<CommonResult<UserInfoRespDTO>> exchange = restTemplate.exchange(
BASE_URL + "/get",
HttpMethod.GET,
new HttpEntity<>(body, headers),
new ParameterizedTypeReference<CommonResult<UserInfoRespDTO>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
public CommonResult<Boolean> updateUser(UserUpdateReqDTO updateReqDTO) {
// 1.1 构建请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("tenant-id", OAuth2Client.TENANT_ID.toString());
addTokenHeader(headers);
// 1.2 构建请求参数
// 使用 updateReqDTO 即可
// 2. 执行请求
ResponseEntity<CommonResult<Boolean>> exchange = restTemplate.exchange(
BASE_URL + "/update",
HttpMethod.PUT,
new HttpEntity<>(updateReqDTO, headers),
new ParameterizedTypeReference<CommonResult<Boolean>>() {}); // 解决 CommonResult 的泛型丢失
Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
return exchange.getBody();
}
private static void addTokenHeader(HttpHeaders headers) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Assert.notNull(loginUser, "登录用户不能为空");
headers.add("Authorization", "Bearer " + loginUser.getAccessToken());
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.ssodemo.client.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 通用返回
*
* @param <T> 数据泛型
*/
@Data
public class CommonResult<T> implements Serializable {
/**
* 错误码
*/
private Integer code;
/**
* 返回数据
*/
private T data;
/**
* 错误提示,用户可阅读
*/
private String msg;
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.ssodemo.client.dto.oauth2;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 访问令牌 Response DTO
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OAuth2AccessTokenRespDTO {
/**
* 访问令牌
*/
@JsonProperty("access_token")
private String accessToken;
/**
* 刷新令牌
*/
@JsonProperty("refresh_token")
private String refreshToken;
/**
* 令牌类型
*/
@JsonProperty("token_type")
private String tokenType;
/**
* 过期时间;单位:秒
*/
@JsonProperty("expires_in")
private Long expiresIn;
/**
* 授权范围;如果多个授权范围,使用空格分隔
*/
private String scope;
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.ssodemo.client.dto.oauth2;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 校验令牌 Response DTO
*
* @author 芋道源码
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OAuth2CheckTokenRespDTO {
/**
* 用户编号
*/
@JsonProperty("user_id")
private Long userId;
/**
* 用户类型
*/
@JsonProperty("user_type")
private Integer userType;
/**
* 租户编号
*/
@JsonProperty("tenant_id")
private Long tenantId;
/**
* 客户端编号
*/
@JsonProperty("client_id")
private String clientId;
/**
* 授权范围
*/
private List<String> scopes;
/**
* 访问令牌
*/
@JsonProperty("access_token")
private String accessToken;
/**
* 过期时间
*
* 时间戳 / 1000,即单位:秒
*/
private Long exp;
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.ssodemo.client.dto.user;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 获得用户基本信息 Response dto
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoRespDTO {
/**
* 用户编号
*/
private Long id;
/**
* 用户账号
*/
private String username;
/**
* 用户昵称
*/
private String nickname;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String mobile;
/**
* 用户性别
*/
private Integer sex;
/**
* 用户头像
*/
private String avatar;
/**
* 所在部门
*/
private Dept dept;
/**
* 所属岗位数组
*/
private List<Post> posts;
/**
* 部门
*/
@Data
public static class Dept {
/**
* 部门编号
*/
private Long id;
/**
* 部门名称
*/
private String name;
}
/**
* 岗位
*/
@Data
public static class Post {
/**
* 岗位编号
*/
private Long id;
/**
* 岗位名称
*/
private String name;
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.ssodemo.client.dto.user;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 更新用户基本信息 Request DTO
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserUpdateReqDTO {
/**
* 用户昵称
*/
private String nickname;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String mobile;
/**
* 用户性别
*/
private Integer sex;
}

View File

@ -0,0 +1,50 @@
package cn.iocoder.yudao.ssodemo.controller;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.ssodemo.client.OAuth2Client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2AccessTokenRespDTO;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/auth")
public class AuthController {
@Resource
private OAuth2Client oauth2Client;
/**
* 使用刷新令牌,获得(刷新)访问令牌
*
* @param refreshToken 刷新令牌
* @return 访问令牌;注意,实际项目中,最好创建对应的 ResponseVO 类,只返回必要的字段
*/
@PostMapping("/refresh-token")
public CommonResult<OAuth2AccessTokenRespDTO> refreshToken(@RequestParam("refreshToken") String refreshToken) {
return oauth2Client.refreshToken(refreshToken);
}
/**
* 退出登录
*
* @param request 请求
* @return 成功
*/
@PostMapping("/logout")
public CommonResult<Boolean> logout(HttpServletRequest request) {
String token = SecurityUtils.obtainAuthorization(request, "Authorization");
if (StrUtil.isNotBlank(token)) {
return oauth2Client.revokeToken(token);
}
// 返回成功
return new CommonResult<>();
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.ssodemo.controller;
import cn.iocoder.yudao.ssodemo.client.UserClient;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserInfoRespDTO;
import cn.iocoder.yudao.ssodemo.client.dto.user.UserUpdateReqDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/user")
public class UserController {
@Resource
private UserClient userClient;
/**
* 获得当前登录用户的基本信息
*
* @return 用户信息;注意,实际项目中,最好创建对应的 ResponseVO 类,只返回必要的字段
*/
@GetMapping("/get")
public CommonResult<UserInfoRespDTO> getUser() {
return userClient.getUser();
}
/**
* 更新当前登录用户的昵称
*
* @param nickname 昵称
* @return 成功
*/
@PutMapping("/update")
public CommonResult<Boolean> updateUser(@RequestParam("nickname") String nickname) {
UserUpdateReqDTO updateReqDTO = new UserUpdateReqDTO(nickname, null, null, null);
return userClient.updateUser(updateReqDTO);
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.ssodemo.framework.config;
import cn.iocoder.yudao.ssodemo.framework.core.filter.TokenAuthenticationFilter;
import cn.iocoder.yudao.ssodemo.framework.core.handler.AccessDeniedHandlerImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.annotation.Resource;
@Configuration(proxyBeanMethods = false)
@EnableWebSecurity
public class SecurityConfiguration {
@Resource
private TokenAuthenticationFilter tokenAuthenticationFilter;
@Resource
private AccessDeniedHandlerImpl accessDeniedHandler;
@Resource
private AuthenticationEntryPoint authenticationEntryPoint;
@Bean
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
// 设置 URL 安全权限
httpSecurity.csrf().disable() // 禁用 CSRF 保护
.authorizeRequests()
// 1. 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
// 2. 登录相关的接口,可匿名访问
.antMatchers("/auth/login-by-code").permitAll()
.antMatchers("/auth/refresh-token").permitAll()
.antMatchers("/auth/logout").permitAll()
// last. 兜底规则,必须认证
.and().authorizeRequests()
.anyRequest().authenticated();
// 设置处理器
httpSecurity.exceptionHandling().accessDeniedHandler(accessDeniedHandler)
.authenticationEntryPoint(authenticationEntryPoint);
// 添加 Token Filter
httpSecurity.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
return httpSecurity.build();
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.ssodemo.framework.core;
import lombok.Data;
import java.util.List;
/**
* 登录用户信息
*
* @author 芋道源码
*/
@Data
public class LoginUser {
/**
* 用户编号
*/
private Long id;
/**
* 用户类型
*/
private Integer userType;
/**
* 租户编号
*/
private Long tenantId;
/**
* 授权范围
*/
private List<String> scopes;
/**
* 访问令牌
*/
private String accessToken;
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.ssodemo.framework.core.filter;
import cn.iocoder.yudao.ssodemo.client.OAuth2Client;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.client.dto.oauth2.OAuth2CheckTokenRespDTO;
import cn.iocoder.yudao.ssodemo.framework.core.LoginUser;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.annotation.Resource;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Token 过滤器,验证 token 的有效性
* 验证通过后,获得 {@link LoginUser} 信息,并加入到 Spring Security 上下文
*
* @author 芋道源码
*/
@Component
public class TokenAuthenticationFilter extends OncePerRequestFilter {
@Resource
private OAuth2Client oauth2Client;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
// 1. 获得访问令牌
String token = SecurityUtils.obtainAuthorization(request, "Authorization");
if (StringUtils.hasText(token)) {
// 2. 基于 token 构建登录用户
LoginUser loginUser = buildLoginUserByToken(token);
// 3. 设置当前用户
if (loginUser != null) {
SecurityUtils.setLoginUser(loginUser, request);
}
}
// 继续过滤链
filterChain.doFilter(request, response);
}
private LoginUser buildLoginUserByToken(String token) {
try {
CommonResult<OAuth2CheckTokenRespDTO> accessTokenResult = oauth2Client.checkToken(token);
OAuth2CheckTokenRespDTO accessToken = accessTokenResult.getData();
if (accessToken == null) {
return null;
}
// 构建登录用户
return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType())
.setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes())
.setAccessToken(accessToken.getAccessToken());
} catch (Exception exception) {
// 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可
return null;
}
}
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.ssodemo.framework.core.handler;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.framework.core.util.SecurityUtils;
import cn.iocoder.yudao.ssodemo.framework.core.util.ServletUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.security.web.access.ExceptionTranslationFilter;
import org.springframework.stereotype.Component;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 访问一个需要认证的 URL 资源,已经认证(登录)但是没有权限的情况下,返回 {@link GlobalErrorCodeConstants#FORBIDDEN} 错误码。
*
* 补充:Spring Security 通过 {@link ExceptionTranslationFilter#handleAccessDeniedException(HttpServletRequest, HttpServletResponse, FilterChain, AccessDeniedException)} 方法,调用当前类
*
* @author 芋道源码
*/
@Component
@SuppressWarnings("JavadocReference")
@Slf4j
public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e)
throws IOException, ServletException {
// 打印 warn 的原因是,不定期合并 warn,看看有没恶意破坏
log.warn("[commence][访问 URL({}) 时,用户({}) 权限不够]", request.getRequestURI(),
SecurityUtils.getLoginUserId(), e);
// 返回 403
CommonResult<Object> result = new CommonResult<>();
result.setCode(HttpStatus.FORBIDDEN.value());
result.setMsg("没有该操作权限");
ServletUtils.writeJSON(response, result);
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.ssodemo.framework.core.handler;
import cn.iocoder.yudao.ssodemo.client.dto.CommonResult;
import cn.iocoder.yudao.ssodemo.framework.core.util.ServletUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.ExceptionTranslationFilter;
import org.springframework.stereotype.Component;
import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 访问一个需要认证的 URL 资源,但是此时自己尚未认证(登录)的情况下,返回 {@link GlobalErrorCodeConstants#UNAUTHORIZED} 错误码,从而使前端重定向到登录页
*
* 补充:Spring Security 通过 {@link ExceptionTranslationFilter#sendStartAuthentication(HttpServletRequest, HttpServletResponse, FilterChain, AuthenticationException)} 方法,调用当前类
*/
@Component
@Slf4j
@SuppressWarnings("JavadocReference") // 忽略文档引用报错
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e);
// 返回 401
CommonResult<Object> result = new CommonResult<>();
result.setCode(HttpStatus.UNAUTHORIZED.value());
result.setMsg("账号未登录");
ServletUtils.writeJSON(response, result);
}
}

View File

@ -0,0 +1,103 @@
package cn.iocoder.yudao.ssodemo.framework.core.util;
import cn.iocoder.yudao.ssodemo.framework.core.LoginUser;
import org.springframework.lang.Nullable;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
/**
* 安全服务工具类
*
* @author 芋道源码
*/
public class SecurityUtils {
public static final String AUTHORIZATION_BEARER = "Bearer";
private SecurityUtils() {}
/**
* 从请求中,获得认证 Token
*
* @param request 请求
* @param header 认证 Token 对应的 Header 名字
* @return 认证 Token
*/
public static String obtainAuthorization(HttpServletRequest request, String header) {
String authorization = request.getHeader(header);
if (!StringUtils.hasText(authorization)) {
return null;
}
int index = authorization.indexOf(AUTHORIZATION_BEARER + " ");
if (index == -1) { // 未找到
return null;
}
return authorization.substring(index + 7).trim();
}
/**
* 获得当前认证信息
*
* @return 认证信息
*/
public static Authentication getAuthentication() {
SecurityContext context = SecurityContextHolder.getContext();
if (context == null) {
return null;
}
return context.getAuthentication();
}
/**
* 获取当前用户
*
* @return 当前用户
*/
@Nullable
public static LoginUser getLoginUser() {
Authentication authentication = getAuthentication();
if (authentication == null) {
return null;
}
return authentication.getPrincipal() instanceof LoginUser ? (LoginUser) authentication.getPrincipal() : null;
}
/**
* 获得当前用户的编号,从上下文中
*
* @return 用户编号
*/
@Nullable
public static Long getLoginUserId() {
LoginUser loginUser = getLoginUser();
return loginUser != null ? loginUser.getId() : null;
}
/**
* 设置当前用户
*
* @param loginUser 登录用户
* @param request 请求
*/
public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) {
// 创建 Authentication,并设置到上下文
Authentication authentication = buildAuthentication(loginUser, request);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
private static Authentication buildAuthentication(LoginUser loginUser, HttpServletRequest request) {
// 创建 UsernamePasswordAuthenticationToken 对象
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
loginUser, null, Collections.emptyList());
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
return authenticationToken;
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.ssodemo.framework.core.util;
import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.json.JSONUtil;
import org.springframework.http.MediaType;
import javax.servlet.http.HttpServletResponse;
/**
* 客户端工具类
*
* @author 芋道源码
*/
public class ServletUtils {
/**
* 返回 JSON 字符串
*
* @param response 响应
* @param object 对象,会序列化成 JSON 字符串
*/
@SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码
public static void writeJSON(HttpServletResponse response, Object object) {
String content = JSONUtil.toJsonStr(object);
ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE);
}
public static void write(HttpServletResponse response, String text, String contentType) {
ServletUtil.write(response, text, contentType);
}
}

View File

@ -0,0 +1,2 @@
server:
port: 18080

View File

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>首页</title>
<!-- jQuery:操作 dom、发起请求等 -->
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.2/jquery.min.js" type="application/javascript"></script>
<script type="application/javascript">
/**
* 跳转单点登录
*/
function passwordLogin() {
window.location.href = '/login.html'
}
/**
* 修改昵称
*/
function updateNickname() {
const nickname = prompt("请输入新的昵称", "");
if (!nickname) {
return;
}
// 更新用户的昵称
const accessToken = localStorage.getItem('ACCESS-TOKEN');
$.ajax({
url: "http://127.0.0.1:18080/user/update?nickname=" + nickname,
method: 'PUT',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function (result) {
if (result.code !== 0) {
alert('更新昵称失败,原因:' + result.msg)
return;
}
alert('更新昵称成功!');
$('#nicknameSpan').html(nickname);
}
});
}
/**
* 刷新令牌
*/
function refreshToken() {
const refreshToken = localStorage.getItem('REFRESH-TOKEN');
if (!refreshToken) {
alert("获取不到刷新令牌");
return;
}
$.ajax({
url: "http://127.0.0.1:18080/auth/refresh-token?refreshToken=" + refreshToken,
method: 'POST',
success: function (result) {
if (result.code !== 0) {
alert('刷新访问令牌失败,原因:' + result.msg)
return;
}
alert('更新访问令牌成功!');
$('#accessTokenSpan').html(result.data.access_token);
// 设置到 localStorage 中
localStorage.setItem('ACCESS-TOKEN', result.data.access_token);
localStorage.setItem('REFRESH-TOKEN', result.data.refresh_token);
}
});
}
/**
* 登出,删除访问令牌
*/
function logout() {
const accessToken = localStorage.getItem('ACCESS-TOKEN');
if (!accessToken) {
location.reload();
return;
}
$.ajax({
url: "http://127.0.0.1:18080/auth/logout",
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function (result) {
if (result.code !== 0) {
alert('退出登录失败,原因:' + result.msg)
return;
}
alert('退出登录成功!');
// 删除 localStorage 中
localStorage.removeItem('ACCESS-TOKEN');
localStorage.removeItem('REFRESH-TOKEN');
location.reload();
}
});
}
$(function () {
const accessToken = localStorage.getItem('ACCESS-TOKEN');
// 情况一:未登录
if (!accessToken) {
$('#noLoginDiv').css("display", "block");
return;
}
// 情况二:已登录
$('#yesLoginDiv').css("display", "block");
$('#accessTokenSpan').html(accessToken);
// 获得登录用户的信息
$.ajax({
url: "http://127.0.0.1:18080/user/get",
method: 'GET',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function (result) {
if (result.code !== 0) {
alert('获得个人信息失败,原因:' + result.msg)
return;
}
$('#nicknameSpan').html(result.data.nickname);
}
});
})
</script>
</head>
<body>
<!-- 情况一:未登录:1)跳转 ruoyi-vue-pro 的 SSO 登录页 -->
<div id="noLoginDiv" style="display: none">
您未登录,点击 <a href="#" onclick="passwordLogin()">跳转 </a> 账号密码登录
</div>
<!-- 情况二:已登录:1)展示用户信息;2)刷新访问令牌;3)退出登录 -->
<div id="yesLoginDiv" style="display: none">
您已登录!<button onclick="logout()">退出登录</button> <br />
昵称:<span id="nicknameSpan"> 加载中... </span> <button onclick="updateNickname()">修改昵称</button> <br />
访问令牌:<span id="accessTokenSpan"> 加载中... </span> <button onclick="refreshToken()">刷新令牌</button> <br />
</div>
</body>
<style>
body { /** 页面居中 */
border-radius: 20px;
height: 350px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
</style>
</html>

View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录</title>
<!-- jQuery:操作 dom、发起请求等 -->
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.2/jquery.min.js" type="application/javascript"></script>
<script type="application/javascript">
/**
* 账号密码登录
*/
function login() {
const clientId = 'yudao-sso-demo-by-password'; // 可以改写成,你的 clientId
const clientSecret = 'test'; // 可以改写成,你的 clientSecret
const grantType = 'password'; // 密码模式
// 账号 + 密码
const username = $('#username').val();
const password = $('#password').val();
if (username.length === 0 || password.length === 0) {
alert('账号或密码未输入');
return;
}
// 发起请求
$.ajax({
url: "http://127.0.0.1:48080/admin-api/system/oauth2/token?"
// 客户端
+ "client_id=" + clientId
+ "&client_secret=" + clientSecret
// 密码模式的参数
+ "&grant_type=" + grantType
+ "&username=" + username
+ "&password=" + password
+ '&scope=user.read user.write',
method: 'POST',
headers: {
'tenant-id': '1', // 多租户编号,写死
},
success: function (result) {
if (result.code !== 0) {
alert('登录失败,原因:' + result.msg)
return;
}
// 设置到 localStorage 中
localStorage.setItem('ACCESS-TOKEN', result.data.access_token);
localStorage.setItem('REFRESH-TOKEN', result.data.refresh_token);
// 提示登录成功
alert('登录成功!点击确认,跳转回首页');
window.location.href = '/index.html';
}
});
}
</script>
</head>
<body>
账号:<input id="username" value="admin" /> <br />
密码:<input id="password" value="admin123" > <br />
<button style="float: right; margin-top: 5px;" onclick="login()">登录</button>
</body>
<style>
body { /** 页面居中 */
border-radius: 20px;
height: 350px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
</style>
</html>

46
yudao-framework/pom.xml Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>yudao</artifactId>
<groupId>cn.iocoder.boot</groupId>
<version>${revision}</version>
</parent>
<packaging>pom</packaging>
<modules>
<module>yudao-common</module>
<module>yudao-spring-boot-starter-mybatis</module>
<module>yudao-spring-boot-starter-redis</module>
<module>yudao-spring-boot-starter-web</module>
<module>yudao-spring-boot-starter-security</module>
<module>yudao-spring-boot-starter-websocket</module>
<module>yudao-spring-boot-starter-monitor</module>
<module>yudao-spring-boot-starter-protection</module>
<module>yudao-spring-boot-starter-job</module>
<module>yudao-spring-boot-starter-mq</module>
<module>yudao-spring-boot-starter-excel</module>
<module>yudao-spring-boot-starter-test</module>
<module>yudao-spring-boot-starter-biz-tenant</module>
<module>yudao-spring-boot-starter-biz-data-permission</module>
<module>yudao-spring-boot-starter-biz-ip</module>
</modules>
<artifactId>yudao-framework</artifactId>
<description>
该包是技术组件,每个子包,代表一个组件。每个组件包括两部分:
1. core 包:是该组件的核心封装
2. config 包:是该组件基于 Spring 的配置
技术组件,也分成两类:
1. 框架组件:和我们熟悉的 MyBatis、Redis 等等的拓展
2. 业务组件:和业务相关的组件的封装,例如说数据字典、操作日志等等。
如果是业务组件,Maven 名字会包含 biz
</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
</project>

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-framework</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-common</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>定义基础 pojo 类、枚举、工具类等等</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<dependencies>
<!-- Spring 核心 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<!-- 用于生成自定义的 Spring @ConfigurationProperties 配置类的说明文件 -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 -->
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 -->
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
<dependency>
<groupId>com.fhs-opensource</groupId> <!-- VO 数据翻译 -->
<artifactId>easy-trans-anno</artifactId> <!-- 默认引入的原因,方便 xxx-module-api 包使用 -->
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.framework.common.core;
/**
* 可生成 Int 数组的接口
*
* @author 芋道源码
*/
public interface IntArrayValuable {
/**
* @return int 数组
*/
int[] array();
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.framework.common.core;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Key Value 的键值对
*
* @author 芋道源码
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class KeyValue<K, V> implements Serializable {
private K key;
private V value;
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.framework.common.enums;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 通用状态枚举
*
* @author 芋道源码
*/
@Getter
@AllArgsConstructor
public enum CommonStatusEnum implements IntArrayValuable {
ENABLE(0, "开启"),
DISABLE(1, "关闭");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CommonStatusEnum::getStatus).toArray();
/**
* 状态值
*/
private final Integer status;
/**
* 状态名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
public static boolean isEnable(Integer status) {
return ObjUtil.equal(ENABLE.status, status);
}
public static boolean isDisable(Integer status) {
return ObjUtil.equal(DISABLE.status, status);
}
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.framework.common.enums;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 时间间隔的枚举
*
* @author dhb52
*/
@Getter
@AllArgsConstructor
public enum DateIntervalEnum implements IntArrayValuable {
DAY(1, "天"),
WEEK(2, "周"),
MONTH(3, "月"),
QUARTER(4, "季度"),
YEAR(5, "年")
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DateIntervalEnum::getInterval).toArray();
/**
* 类型
*/
private final Integer interval;
/**
* 名称
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
public static DateIntervalEnum valueOf(Integer interval) {
return ArrayUtil.firstMatch(item -> item.getInterval().equals(interval), DateIntervalEnum.values());
}
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.framework.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 文档地址
*
* @author 芋道源码
*/
@Getter
@AllArgsConstructor
public enum DocumentEnum {
REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"),
TENANT("https://doc.iocoder.cn", "SaaS 多租户文档");
private final String url;
private final String memo;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.framework.common.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 终端的枚举
*
* @author 芋道源码
*/
@RequiredArgsConstructor
@Getter
public enum TerminalEnum implements IntArrayValuable {
UNKNOWN(0, "未知"), // 目的:在无法解析到 terminal 时,使用它
WECHAT_MINI_PROGRAM(10, "微信小程序"),
WECHAT_WAP(11, "微信公众号"),
H5(20, "H5 网页"),
APP(31, "手机 App"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TerminalEnum::getTerminal).toArray();
/**
* 终端
*/
private final Integer terminal;
/**
* 终端名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.framework.common.enums;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 全局用户类型枚举
*/
@AllArgsConstructor
@Getter
public enum UserTypeEnum implements IntArrayValuable {
MEMBER(1, "会员"), // 面向 c 端,普通用户
ADMIN(2, "管理员"); // 面向 b 端,管理后台
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(UserTypeEnum::getValue).toArray();
/**
* 类型
*/
private final Integer value;
/**
* 类型名
*/
private final String name;
public static UserTypeEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), UserTypeEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.framework.common.enums;
/**
* Web 过滤器顺序的枚举类,保证过滤器按照符合我们的预期
*
* 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 enums 包下
*
* @author 芋道源码
*/
public interface WebFilterOrderEnum {
int CORS_FILTER = Integer.MIN_VALUE;
int TRACE_FILTER = CORS_FILTER + 1;
int REQUEST_BODY_CACHE_FILTER = Integer.MIN_VALUE + 500;
// OrderedRequestContextFilter 默认为 -105,用于国际化上下文等等
int TENANT_CONTEXT_FILTER = - 104; // 需要保证在 ApiAccessLogFilter 前面
int API_ACCESS_LOG_FILTER = -103; // 需要保证在 RequestBodyCacheFilter 后面
int XSS_FILTER = -102; // 需要保证在 RequestBodyCacheFilter 后面
// Spring Security Filter 默认为 -100,可见 org.springframework.boot.autoconfigure.security.SecurityProperties 配置属性类
int TENANT_SECURITY_FILTER = -99; // 需要保证在 Spring Security 过滤器后面
int FLOWABLE_FILTER = -98; // 需要保证在 Spring Security 过滤后面
int DEMO_FILTER = Integer.MAX_VALUE;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.framework.common.exception;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import cn.iocoder.yudao.framework.common.exception.enums.ServiceErrorCodeRange;
import lombok.Data;
/**
* 错误码对象
*
* 全局错误码,占用 [0, 999], 参见 {@link GlobalErrorCodeConstants}
* 业务异常错误码,占用 [1 000 000 000, +∞),参见 {@link ServiceErrorCodeRange}
*
* TODO 错误码设计成对象的原因,为未来的 i18 国际化做准备
*/
@Data
public class ErrorCode {
/**
* 错误码
*/
private final Integer code;
/**
* 错误提示
*/
private final String msg;
public ErrorCode(Integer code, String message) {
this.code = code;
this.msg = message;
}
}

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.framework.common.exception;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 服务器异常 Exception
*/
@Data
@EqualsAndHashCode(callSuper = true)
public final class ServerException extends RuntimeException {
/**
* 全局错误码
*
* @see GlobalErrorCodeConstants
*/
private Integer code;
/**
* 错误提示
*/
private String message;
/**
* 空构造方法,避免反序列化问题
*/
public ServerException() {
}
public ServerException(ErrorCode errorCode) {
this.code = errorCode.getCode();
this.message = errorCode.getMsg();
}
public ServerException(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public ServerException setCode(Integer code) {
this.code = code;
return this;
}
@Override
public String getMessage() {
return message;
}
public ServerException setMessage(String message) {
this.message = message;
return this;
}
}

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.framework.common.exception;
import cn.iocoder.yudao.framework.common.exception.enums.ServiceErrorCodeRange;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 业务逻辑异常 Exception
*/
@Data
@EqualsAndHashCode(callSuper = true)
public final class ServiceException extends RuntimeException {
/**
* 业务错误码
*
* @see ServiceErrorCodeRange
*/
private Integer code;
/**
* 错误提示
*/
private String message;
/**
* 空构造方法,避免反序列化问题
*/
public ServiceException() {
}
public ServiceException(ErrorCode errorCode) {
this.code = errorCode.getCode();
this.message = errorCode.getMsg();
}
public ServiceException(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public ServiceException setCode(Integer code) {
this.code = code;
return this;
}
@Override
public String getMessage() {
return message;
}
public ServiceException setMessage(String message) {
this.message = message;
return this;
}
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.framework.common.exception.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* 全局错误码枚举
* 0-999 系统异常编码保留
*
* 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
* 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的
* 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。
*
* @author 芋道源码
*/
public interface GlobalErrorCodeConstants {
ErrorCode SUCCESS = new ErrorCode(0, "成功");
// ========== 客户端错误段 ==========
ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确");
ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录");
ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限");
ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到");
ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确");
ErrorCode LOCKED = new ErrorCode(423, "请求失败,请稍后重试"); // 并发请求,不允许
ErrorCode TOO_MANY_REQUESTS = new ErrorCode(429, "请求过于频繁,请稍后重试");
// ========== 服务端错误段 ==========
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常");
ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启");
ErrorCode ERROR_CONFIGURATION = new ErrorCode(502, "错误的配置项");
// ========== 自定义错误段 ==========
ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求
ErrorCode DEMO_DENY = new ErrorCode(901, "演示模式,禁止写操作");
ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.framework.common.exception.enums;
/**
* 业务异常的错误码区间,解决:解决各模块错误码定义,避免重复,在此只声明不做实际使用
*
* 一共 10 位,分成四段
*
* 第一段,1 位,类型
* 1 - 业务级别异常
* x - 预留
* 第二段,3 位,系统类型
* 001 - 用户系统
* 002 - 商品系统
* 003 - 订单系统
* 004 - 支付系统
* 005 - 优惠劵系统
* ... - ...
* 第三段,3 位,模块
* 不限制规则。
* 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子:
* 001 - OAuth2 模块
* 002 - User 模块
* 003 - MobileCode 模块
* 第四段,3 位,错误码
* 不限制规则。
* 一般建议,每个模块自增。
*
* @author 芋道源码
*/
public class ServiceErrorCodeRange {
// 模块 infra 错误码区间 [1-001-000-000 ~ 1-002-000-000)
// 模块 system 错误码区间 [1-002-000-000 ~ 1-003-000-000)
// 模块 report 错误码区间 [1-003-000-000 ~ 1-004-000-000)
// 模块 member 错误码区间 [1-004-000-000 ~ 1-005-000-000)
// 模块 mp 错误码区间 [1-006-000-000 ~ 1-007-000-000)
// 模块 pay 错误码区间 [1-007-000-000 ~ 1-008-000-000)
// 模块 bpm 错误码区间 [1-009-000-000 ~ 1-010-000-000)
// 模块 product 错误码区间 [1-008-000-000 ~ 1-009-000-000)
// 模块 trade 错误码区间 [1-011-000-000 ~ 1-012-000-000)
// 模块 promotion 错误码区间 [1-013-000-000 ~ 1-014-000-000)
// 模块 crm 错误码区间 [1-020-000-000 ~ 1-021-000-000)
}

View File

@ -0,0 +1,127 @@
package cn.iocoder.yudao.framework.common.exception.util;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* {@link ServiceException} 工具类
*
* 目的在于,格式化异常信息提示。
* 考虑到 String.format 在参数不正确时会报错,因此使用 {} 作为占位符,并使用 {@link #doFormat(int, String, Object...)} 方法来格式化
*
* 因为 {@link #MESSAGES} 里面默认是没有异常信息提示的模板的,所以需要使用方自己初始化进去。目前想到的有几种方式:
*
* 1. 异常提示信息,写在枚举类中,例如说,cn.iocoder.oceans.user.api.constants.ErrorCodeEnum 类 + ServiceExceptionConfiguration
* 2. 异常提示信息,写在 .properties 等等配置文件
* 3. 异常提示信息,写在 Apollo 等等配置中心中,从而实现可动态刷新
* 4. 异常提示信息,存储在 db 等等数据库中,从而实现可动态刷新
*/
@Slf4j
public class ServiceExceptionUtil {
/**
* 错误码提示模板
*/
private static final ConcurrentMap<Integer, String> MESSAGES = new ConcurrentHashMap<>();
public static void putAll(Map<Integer, String> messages) {
ServiceExceptionUtil.MESSAGES.putAll(messages);
}
public static void put(Integer code, String message) {
ServiceExceptionUtil.MESSAGES.put(code, message);
}
public static void delete(Integer code, String message) {
ServiceExceptionUtil.MESSAGES.remove(code, message);
}
// ========== 和 ServiceException 的集成 ==========
public static ServiceException exception(ErrorCode errorCode) {
String messagePattern = MESSAGES.getOrDefault(errorCode.getCode(), errorCode.getMsg());
return exception0(errorCode.getCode(), messagePattern);
}
public static ServiceException exception(ErrorCode errorCode, Object... params) {
String messagePattern = MESSAGES.getOrDefault(errorCode.getCode(), errorCode.getMsg());
return exception0(errorCode.getCode(), messagePattern, params);
}
/**
* 创建指定编号的 ServiceException 的异常
*
* @param code 编号
* @return 异常
*/
public static ServiceException exception(Integer code) {
return exception0(code, MESSAGES.get(code));
}
/**
* 创建指定编号的 ServiceException 的异常
*
* @param code 编号
* @param params 消息提示的占位符对应的参数
* @return 异常
*/
public static ServiceException exception(Integer code, Object... params) {
return exception0(code, MESSAGES.get(code), params);
}
public static ServiceException exception0(Integer code, String messagePattern, Object... params) {
String message = doFormat(code, messagePattern, params);
return new ServiceException(code, message);
}
public static ServiceException invalidParamException(String messagePattern, Object... params) {
return exception0(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), messagePattern, params);
}
// ========== 格式化方法 ==========
/**
* 将错误编号对应的消息使用 params 进行格式化。
*
* @param code 错误编号
* @param messagePattern 消息模版
* @param params 参数
* @return 格式化后的提示
*/
@VisibleForTesting
public static String doFormat(int code, String messagePattern, Object... params) {
StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50);
int i = 0;
int j;
int l;
for (l = 0; l < params.length; l++) {
j = messagePattern.indexOf("{}", i);
if (j == -1) {
log.error("[doFormat][参数过多:错误码({})|错误内容({})|参数({})", code, messagePattern, params);
if (i == 0) {
return messagePattern;
} else {
sbuf.append(messagePattern.substring(i));
return sbuf.toString();
}
} else {
sbuf.append(messagePattern, i, j);
sbuf.append(params[l]);
i = j + 2;
}
}
if (messagePattern.indexOf("{}", i) != -1) {
log.error("[doFormat][参数过少:错误码({})|错误内容({})|参数({})", code, messagePattern, params);
}
sbuf.append(messagePattern.substring(i));
return sbuf.toString();
}
}

View File

@ -0,0 +1,6 @@
/**
* 基础的通用类,和框架无关
*
* 例如说,CommonResult 为通用返回
*/
package cn.iocoder.yudao.framework.common;

View File

@ -0,0 +1,112 @@
package cn.iocoder.yudao.framework.common.pojo;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.Assert;
import java.io.Serializable;
import java.util.Objects;
/**
* 通用返回
*
* @param <T> 数据泛型
*/
@Data
public class CommonResult<T> implements Serializable {
/**
* 错误码
*
* @see ErrorCode#getCode()
*/
private Integer code;
/**
* 返回数据
*/
private T data;
/**
* 错误提示,用户可阅读
*
* @see ErrorCode#getMsg() ()
*/
private String msg;
/**
* 将传入的 result 对象,转换成另外一个泛型结果的对象
*
* 因为 A 方法返回的 CommonResult 对象,不满足调用其的 B 方法的返回,所以需要进行转换。
*
* @param result 传入的 result 对象
* @param <T> 返回的泛型
* @return 新的 CommonResult 对象
*/
public static <T> CommonResult<T> error(CommonResult<?> result) {
return error(result.getCode(), result.getMsg());
}
public static <T> CommonResult<T> error(Integer code, String message) {
Assert.isTrue(!GlobalErrorCodeConstants.SUCCESS.getCode().equals(code), "code 必须是错误的!");
CommonResult<T> result = new CommonResult<>();
result.code = code;
result.msg = message;
return result;
}
public static <T> CommonResult<T> error(ErrorCode errorCode) {
return error(errorCode.getCode(), errorCode.getMsg());
}
public static <T> CommonResult<T> success(T data) {
CommonResult<T> result = new CommonResult<>();
result.code = GlobalErrorCodeConstants.SUCCESS.getCode();
result.data = data;
result.msg = "";
return result;
}
public static boolean isSuccess(Integer code) {
return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
}
@JsonIgnore // 避免 jackson 序列化
public boolean isSuccess() {
return isSuccess(code);
}
@JsonIgnore // 避免 jackson 序列化
public boolean isError() {
return !isSuccess();
}
// ========= 和 Exception 异常体系集成 =========
/**
* 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常
*/
public void checkError() throws ServiceException {
if (isSuccess()) {
return;
}
// 业务异常
throw new ServiceException(code, msg);
}
/**
* 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常
* 如果没有,则返回 {@link #data} 数据
*/
@JsonIgnore // 避免 jackson 序列化
public T getCheckedData() {
checkError();
return data;
}
public static <T> CommonResult<T> error(ServiceException serviceException) {
return error(serviceException.getCode(), serviceException.getMessage());
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.framework.common.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Schema(description="分页参数")
@Data
public class PageParam implements Serializable {
private static final Integer PAGE_NO = 1;
private static final Integer PAGE_SIZE = 10;
/**
* 每页条数 - 不分页
*
* 例如说,导出接口,可以设置 {@link #pageSize} 为 -1 不分页,查询所有数据。
*/
public static final Integer PAGE_SIZE_NONE = -1;
@Schema(description = "页码,从 1 开始", requiredMode = Schema.RequiredMode.REQUIRED,example = "1")
@NotNull(message = "页码不能为空")
@Min(value = 1, message = "页码最小值为 1")
private Integer pageNo = PAGE_NO;
@Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@NotNull(message = "每页条数不能为空")
@Min(value = 1, message = "每页条数最小值为 1")
@Max(value = 100, message = "每页条数最大值为 100")
private Integer pageSize = PAGE_SIZE;
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.framework.common.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Schema(description = "分页结果")
@Data
public final class PageResult<T> implements Serializable {
@Schema(description = "数据", requiredMode = Schema.RequiredMode.REQUIRED)
private List<T> list;
@Schema(description = "总量", requiredMode = Schema.RequiredMode.REQUIRED)
private Long total;
public PageResult() {
}
public PageResult(List<T> list, Long total) {
this.list = list;
this.total = total;
}
public PageResult(Long total) {
this.list = new ArrayList<>();
this.total = total;
}
public static <T> PageResult<T> empty() {
return new PageResult<>(0L);
}
public static <T> PageResult<T> empty(Long total) {
return new PageResult<>(total);
}
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.framework.common.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.List;
@Schema(description = "可排序的分页参数")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class SortablePageParam extends PageParam {
@Schema(description = "排序字段")
private List<SortingField> sortingFields;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.framework.common.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 排序字段 DTO
*
* 类名加了 ing 的原因是,避免和 ES SortField 重名。
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SortingField implements Serializable {
/**
* 顺序 - 升序
*/
public static final String ORDER_ASC = "asc";
/**
* 顺序 - 降序
*/
public static final String ORDER_DESC = "desc";
/**
* 字段
*/
private String field;
/**
* 顺序
*/
private String order;
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.framework.common.util.cache;
import com.alibaba.ttl.threadpool.TtlExecutors;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import java.time.Duration;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Cache 工具类
*
* @author 芋道源码
*/
public class CacheUtils {
public static <K, V> LoadingCache<K, V> buildAsyncReloadingCache(Duration duration, CacheLoader<K, V> loader) {
// 1. 使用 TTL 包装 ExecutorService,实现 ThreadLocal 的透传
// https://github.com/YunaiV/ruoyi-vue-pro/issues/432
ExecutorService executorService = Executors.newCachedThreadPool(); // TODO 芋艿:可能要思考下,未来要不要做成可配置
Executor executor = TtlExecutors.getTtlExecutorService(executorService);
// 2. 创建 Guava LoadingCache
return CacheBuilder.newBuilder()
// 只阻塞当前数据加载线程,其他线程返回旧值
.refreshAfterWrite(duration)
// 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程
.build(CacheLoader.asyncReloading(loader, executor));
}
}

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.framework.common.util.collection;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.IterUtil;
import cn.hutool.core.util.ArrayUtil;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.function.Function;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
/**
* Array 工具类
*
* @author 芋道源码
*/
public class ArrayUtils {
/**
* 将 object 和 newElements 合并成一个数组
*
* @param object 对象
* @param newElements 数组
* @param <T> 泛型
* @return 结果数组
*/
@SafeVarargs
public static <T> Consumer<T>[] append(Consumer<T> object, Consumer<T>... newElements) {
if (object == null) {
return newElements;
}
Consumer<T>[] result = ArrayUtil.newArray(Consumer.class, 1 + newElements.length);
result[0] = object;
System.arraycopy(newElements, 0, result, 1, newElements.length);
return result;
}
public static <T, V> V[] toArray(Collection<T> from, Function<T, V> mapper) {
return toArray(convertList(from, mapper));
}
@SuppressWarnings("unchecked")
public static <T> T[] toArray(Collection<T> from) {
if (CollectionUtil.isEmpty(from)) {
return (T[]) (new Object[0]);
}
return ArrayUtil.toArray(from, (Class<T>) IterUtil.getElementType(from.iterator()));
}
public static <T> T get(T[] array, int index) {
if (null == array || index >= array.length) {
return null;
}
return array[index];
}
}

View File

@ -0,0 +1,318 @@
package cn.iocoder.yudao.framework.common.util.collection;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import com.google.common.collect.ImmutableMap;
import java.util.*;
import java.util.function.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
/**
* Collection 工具类
*
* @author 芋道源码
*/
public class CollectionUtils {
public static boolean containsAny(Object source, Object... targets) {
return asList(targets).contains(source);
}
public static boolean isAnyEmpty(Collection<?>... collections) {
return Arrays.stream(collections).anyMatch(CollectionUtil::isEmpty);
}
public static <T> boolean anyMatch(Collection<T> from, Predicate<T> predicate) {
return from.stream().anyMatch(predicate);
}
public static <T> List<T> filterList(Collection<T> from, Predicate<T> predicate) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return from.stream().filter(predicate).collect(Collectors.toList());
}
public static <T, R> List<T> distinct(Collection<T> from, Function<T, R> keyMapper) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return distinct(from, keyMapper, (t1, t2) -> t1);
}
public static <T, R> List<T> distinct(Collection<T> from, Function<T, R> keyMapper, BinaryOperator<T> cover) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return new ArrayList<>(convertMap(from, keyMapper, Function.identity(), cover).values());
}
public static <T, U> List<U> convertList(T[] from, Function<T, U> func) {
if (ArrayUtil.isEmpty(from)) {
return new ArrayList<>();
}
return convertList(Arrays.asList(from), func);
}
public static <T, U> List<U> convertList(Collection<T> from, Function<T, U> func) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toList());
}
public static <T, U> List<U> convertList(Collection<T> from, Function<T, U> func, Predicate<T> filter) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toList());
}
public static <T, U> List<U> convertListByFlatMap(Collection<T> from,
Function<T, ? extends Stream<? extends U>> func) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return from.stream().filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList());
}
public static <T, U, R> List<R> convertListByFlatMap(Collection<T> from,
Function<? super T, ? extends U> mapper,
Function<U, ? extends Stream<? extends R>> func) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
}
return from.stream().map(mapper).filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList());
}
public static <K, V> List<V> mergeValuesFromMap(Map<K, List<V>> map) {
return map.values()
.stream()
.flatMap(List::stream)
.collect(Collectors.toList());
}
public static <T, U> Set<U> convertSet(Collection<T> from, Function<T, U> func) {
if (CollUtil.isEmpty(from)) {
return new HashSet<>();
}
return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toSet());
}
public static <T, U> Set<U> convertSet(Collection<T> from, Function<T, U> func, Predicate<T> filter) {
if (CollUtil.isEmpty(from)) {
return new HashSet<>();
}
return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toSet());
}
public static <T, K> Map<K, T> convertMapByFilter(Collection<T> from, Predicate<T> filter, Function<T, K> keyFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return from.stream().filter(filter).collect(Collectors.toMap(keyFunc, v -> v));
}
public static <T, U> Set<U> convertSetByFlatMap(Collection<T> from,
Function<T, ? extends Stream<? extends U>> func) {
if (CollUtil.isEmpty(from)) {
return new HashSet<>();
}
return from.stream().filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet());
}
public static <T, U, R> Set<R> convertSetByFlatMap(Collection<T> from,
Function<? super T, ? extends U> mapper,
Function<U, ? extends Stream<? extends R>> func) {
if (CollUtil.isEmpty(from)) {
return new HashSet<>();
}
return from.stream().map(mapper).filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet());
}
public static <T, K> Map<K, T> convertMap(Collection<T> from, Function<T, K> keyFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return convertMap(from, keyFunc, Function.identity());
}
public static <T, K> Map<K, T> convertMap(Collection<T> from, Function<T, K> keyFunc, Supplier<? extends Map<K, T>> supplier) {
if (CollUtil.isEmpty(from)) {
return supplier.get();
}
return convertMap(from, keyFunc, Function.identity(), supplier);
}
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return convertMap(from, keyFunc, valueFunc, (v1, v2) -> v1);
}
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc, BinaryOperator<V> mergeFunction) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return convertMap(from, keyFunc, valueFunc, mergeFunction, HashMap::new);
}
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc, Supplier<? extends Map<K, V>> supplier) {
if (CollUtil.isEmpty(from)) {
return supplier.get();
}
return convertMap(from, keyFunc, valueFunc, (v1, v2) -> v1, supplier);
}
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K, V>> supplier) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return from.stream().collect(Collectors.toMap(keyFunc, valueFunc, mergeFunction, supplier));
}
public static <T, K> Map<K, List<T>> convertMultiMap(Collection<T> from, Function<T, K> keyFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(t -> t, Collectors.toList())));
}
public static <T, K, V> Map<K, List<V>> convertMultiMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return from.stream()
.collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toList())));
}
// 暂时没想好名字,先以 2 结尾噶
public static <T, K, V> Map<K, Set<V>> convertMultiMap2(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
}
return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toSet())));
}
public static <T, K> Map<K, T> convertImmutableMap(Collection<T> from, Function<T, K> keyFunc) {
if (CollUtil.isEmpty(from)) {
return Collections.emptyMap();
}
ImmutableMap.Builder<K, T> builder = ImmutableMap.builder();
from.forEach(item -> builder.put(keyFunc.apply(item), item));
return builder.build();
}
/**
* 对比老、新两个列表,找出新增、修改、删除的数据
*
* @param oldList 老列表
* @param newList 新列表
* @param sameFunc 对比函数,返回 true 表示相同,返回 false 表示不同
* 注意,same 是通过每个元素的“标识”,判断它们是不是同一个数据
* @return [新增列表、修改列表、删除列表]
*/
public static <T> List<List<T>> diffList(Collection<T> oldList, Collection<T> newList,
BiFunction<T, T, Boolean> sameFunc) {
List<T> createList = new LinkedList<>(newList); // 默认都认为是新增的,后续会进行移除
List<T> updateList = new ArrayList<>();
List<T> deleteList = new ArrayList<>();
// 通过以 oldList 为主遍历,找出 updateList 和 deleteList
for (T oldObj : oldList) {
// 1. 寻找是否有匹配的
T foundObj = null;
for (Iterator<T> iterator = createList.iterator(); iterator.hasNext(); ) {
T newObj = iterator.next();
// 1.1 不匹配,则直接跳过
if (!sameFunc.apply(oldObj, newObj)) {
continue;
}
// 1.2 匹配,则移除,并结束寻找
iterator.remove();
foundObj = newObj;
break;
}
// 2. 匹配添加到 updateList;不匹配则添加到 deleteList 中
if (foundObj != null) {
updateList.add(foundObj);
} else {
deleteList.add(oldObj);
}
}
return asList(createList, updateList, deleteList);
}
public static boolean containsAny(Collection<?> source, Collection<?> candidates) {
return org.springframework.util.CollectionUtils.containsAny(source, candidates);
}
public static <T> T getFirst(List<T> from) {
return !CollectionUtil.isEmpty(from) ? from.get(0) : null;
}
public static <T> T findFirst(Collection<T> from, Predicate<T> predicate) {
return findFirst(from, predicate, Function.identity());
}
public static <T, U> U findFirst(Collection<T> from, Predicate<T> predicate, Function<T, U> func) {
if (CollUtil.isEmpty(from)) {
return null;
}
return from.stream().filter(predicate).findFirst().map(func).orElse(null);
}
public static <T, V extends Comparable<? super V>> V getMaxValue(Collection<T> from, Function<T, V> valueFunc) {
if (CollUtil.isEmpty(from)) {
return null;
}
assert !from.isEmpty(); // 断言,避免告警
T t = from.stream().max(Comparator.comparing(valueFunc)).get();
return valueFunc.apply(t);
}
public static <T, V extends Comparable<? super V>> V getMinValue(List<T> from, Function<T, V> valueFunc) {
if (CollUtil.isEmpty(from)) {
return null;
}
assert from.size() > 0; // 断言,避免告警
T t = from.stream().min(Comparator.comparing(valueFunc)).get();
return valueFunc.apply(t);
}
public static <T, V extends Comparable<? super V>> V getSumValue(List<T> from, Function<T, V> valueFunc,
BinaryOperator<V> accumulator) {
return getSumValue(from, valueFunc, accumulator, null);
}
public static <T, V extends Comparable<? super V>> V getSumValue(Collection<T> from, Function<T, V> valueFunc,
BinaryOperator<V> accumulator, V defaultValue) {
if (CollUtil.isEmpty(from)) {
return defaultValue;
}
assert !from.isEmpty(); // 断言,避免告警
return from.stream().map(valueFunc).filter(Objects::nonNull).reduce(accumulator).orElse(defaultValue);
}
public static <T> void addIfNotNull(Collection<T> coll, T item) {
if (item == null) {
return;
}
coll.add(item);
}
public static <T> Collection<T> singleton(T obj) {
return obj == null ? Collections.emptyList() : Collections.singleton(obj);
}
public static <T> List<T> newArrayList(List<List<T>> list) {
return list.stream().flatMap(Collection::stream).collect(Collectors.toList());
}
}

View File

@ -0,0 +1,68 @@
package cn.iocoder.yudao.framework.common.util.collection;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
/**
* Map 工具类
*
* @author 芋道源码
*/
public class MapUtils {
/**
* 从哈希表表中,获得 keys 对应的所有 value 数组
*
* @param multimap 哈希表
* @param keys keys
* @return value 数组
*/
public static <K, V> List<V> getList(Multimap<K, V> multimap, Collection<K> keys) {
List<V> result = new ArrayList<>();
keys.forEach(k -> {
Collection<V> values = multimap.get(k);
if (CollectionUtil.isEmpty(values)) {
return;
}
result.addAll(values);
});
return result;
}
/**
* 从哈希表查找到 key 对应的 value,然后进一步处理
* key 为 null 时, 不处理
* 注意,如果查找到的 value 为 null 时,不进行处理
*
* @param map 哈希表
* @param key key
* @param consumer 进一步处理的逻辑
*/
public static <K, V> void findAndThen(Map<K, V> map, K key, Consumer<V> consumer) {
if (ObjUtil.isNull(key) || CollUtil.isEmpty(map)) {
return;
}
V value = map.get(key);
if (value == null) {
return;
}
consumer.accept(value);
}
public static <K, V> Map<K, V> convertMap(List<KeyValue<K, V>> keyValues) {
Map<K, V> map = Maps.newLinkedHashMapWithExpectedSize(keyValues.size());
keyValues.forEach(keyValue -> map.put(keyValue.getKey(), keyValue.getValue()));
return map;
}
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.framework.common.util.collection;
import cn.hutool.core.collection.CollUtil;
import java.util.Set;
/**
* Set 工具类
*
* @author 芋道源码
*/
public class SetUtils {
@SafeVarargs
public static <T> Set<T> asSet(T... objs) {
return CollUtil.newHashSet(objs);
}
}

View File

@ -0,0 +1,149 @@
package cn.iocoder.yudao.framework.common.util.date;
import cn.hutool.core.date.LocalDateTimeUtil;
import java.time.*;
import java.util.Calendar;
import java.util.Date;
/**
* 时间工具类
*
* @author 芋道源码
*/
public class DateUtils {
/**
* 时区 - 默认
*/
public static final String TIME_ZONE_DEFAULT = "GMT+8";
/**
* 秒转换成毫秒
*/
public static final long SECOND_MILLIS = 1000;
public static final String FORMAT_YEAR_MONTH_DAY = "yyyy-MM-dd";
public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss";
/**
* 将 LocalDateTime 转换成 Date
*
* @param date LocalDateTime
* @return LocalDateTime
*/
public static Date of(LocalDateTime date) {
if (date == null) {
return null;
}
// 将此日期时间与时区相结合以创建 ZonedDateTime
ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault());
// 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳
Instant instant = zonedDateTime.toInstant();
// UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间
return Date.from(instant);
}
/**
* 将 Date 转换成 LocalDateTime
*
* @param date Date
* @return LocalDateTime
*/
public static LocalDateTime of(Date date) {
if (date == null) {
return null;
}
// 转为时间戳
Instant instant = date.toInstant();
// UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间
return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
}
public static Date addTime(Duration duration) {
return new Date(System.currentTimeMillis() + duration.toMillis());
}
public static boolean isExpired(LocalDateTime time) {
LocalDateTime now = LocalDateTime.now();
return now.isAfter(time);
}
/**
* 创建指定时间
*
* @param year 年
* @param mouth 月
* @param day 日
* @return 指定时间
*/
public static Date buildTime(int year, int mouth, int day) {
return buildTime(year, mouth, day, 0, 0, 0);
}
/**
* 创建指定时间
*
* @param year 年
* @param mouth 月
* @param day 日
* @param hour 小时
* @param minute 分钟
* @param second 秒
* @return 指定时间
*/
public static Date buildTime(int year, int mouth, int day,
int hour, int minute, int second) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, mouth - 1);
calendar.set(Calendar.DAY_OF_MONTH, day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
calendar.set(Calendar.MILLISECOND, 0); // 一般情况下,都是 0 毫秒
return calendar.getTime();
}
public static Date max(Date a, Date b) {
if (a == null) {
return b;
}
if (b == null) {
return a;
}
return a.compareTo(b) > 0 ? a : b;
}
public static LocalDateTime max(LocalDateTime a, LocalDateTime b) {
if (a == null) {
return b;
}
if (b == null) {
return a;
}
return a.isAfter(b) ? a : b;
}
/**
* 是否今天
*
* @param date 日期
* @return 是否
*/
public static boolean isToday(LocalDateTime date) {
return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now());
}
/**
* 是否昨天
*
* @param date 日期
* @return 是否
*/
public static boolean isYesterday(LocalDateTime date) {
return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now().minusDays(1));
}
}

View File

@ -0,0 +1,309 @@
package cn.iocoder.yudao.framework.common.util.date;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.enums.DateIntervalEnum;
import java.time.*;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.List;
/**
* 时间工具类,用于 {@link java.time.LocalDateTime}
*
* @author 芋道源码
*/
public class LocalDateTimeUtils {
/**
* 空的 LocalDateTime 对象,主要用于 DB 唯一索引的默认值
*/
public static LocalDateTime EMPTY = buildTime(1970, 1, 1);
/**
* 解析时间
*
* 相比 {@link LocalDateTimeUtil#parse(CharSequence)} 方法来说,会尽量去解析,直到成功
*
* @param time 时间
* @return 时间字符串
*/
public static LocalDateTime parse(String time) {
try {
return LocalDateTimeUtil.parse(time, DatePattern.NORM_DATE_PATTERN);
} catch (DateTimeParseException e) {
return LocalDateTimeUtil.parse(time);
}
}
public static LocalDateTime addTime(Duration duration) {
return LocalDateTime.now().plus(duration);
}
public static LocalDateTime minusTime(Duration duration) {
return LocalDateTime.now().minus(duration);
}
public static boolean beforeNow(LocalDateTime date) {
return date.isBefore(LocalDateTime.now());
}
public static boolean afterNow(LocalDateTime date) {
return date.isAfter(LocalDateTime.now());
}
/**
* 创建指定时间
*
* @param year 年
* @param mouth 月
* @param day 日
* @return 指定时间
*/
public static LocalDateTime buildTime(int year, int mouth, int day) {
return LocalDateTime.of(year, mouth, day, 0, 0, 0);
}
public static LocalDateTime[] buildBetweenTime(int year1, int mouth1, int day1,
int year2, int mouth2, int day2) {
return new LocalDateTime[]{buildTime(year1, mouth1, day1), buildTime(year2, mouth2, day2)};
}
/**
* 判指定断时间,是否在该时间范围内
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param time 指定时间
* @return 是否
*/
public static boolean isBetween(LocalDateTime startTime, LocalDateTime endTime, String time) {
if (startTime == null || endTime == null || time == null) {
return false;
}
return LocalDateTimeUtil.isIn(parse(time), startTime, endTime);
}
/**
* 判断当前时间是否在该时间范围内
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 是否
*/
public static boolean isBetween(LocalDateTime startTime, LocalDateTime endTime) {
if (startTime == null || endTime == null) {
return false;
}
return LocalDateTimeUtil.isIn(LocalDateTime.now(), startTime, endTime);
}
/**
* 判断当前时间是否在该时间范围内
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 是否
*/
public static boolean isBetween(String startTime, String endTime) {
if (startTime == null || endTime == null) {
return false;
}
LocalDate nowDate = LocalDate.now();
return LocalDateTimeUtil.isIn(LocalDateTime.now(),
LocalDateTime.of(nowDate, LocalTime.parse(startTime)),
LocalDateTime.of(nowDate, LocalTime.parse(endTime)));
}
/**
* 判断时间段是否重叠
*
* @param startTime1 开始 time1
* @param endTime1 结束 time1
* @param startTime2 开始 time2
* @param endTime2 结束 time2
* @return 重叠:true 不重叠:false
*/
public static boolean isOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) {
LocalDate nowDate = LocalDate.now();
return LocalDateTimeUtil.isOverlap(LocalDateTime.of(nowDate, startTime1), LocalDateTime.of(nowDate, endTime1),
LocalDateTime.of(nowDate, startTime2), LocalDateTime.of(nowDate, endTime2));
}
/**
* 获取指定日期所在的月份的开始时间
* 例如:2023-09-30 00:00:00,000
*
* @param date 日期
* @return 月份的开始时间
*/
public static LocalDateTime beginOfMonth(LocalDateTime date) {
return date.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN);
}
/**
* 获取指定日期所在的月份的最后时间
* 例如:2023-09-30 23:59:59,999
*
* @param date 日期
* @return 月份的结束时间
*/
public static LocalDateTime endOfMonth(LocalDateTime date) {
return date.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX);
}
/**
* 获得指定日期所在季度
*
* @param date 日期
* @return 所在季度
*/
public static int getQuarterOfYear(LocalDateTime date) {
return (date.getMonthValue() - 1) / 3 + 1;
}
/**
* 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负
*
* @param dateTime 日期
* @return 相差天数
*/
public static Long between(LocalDateTime dateTime) {
return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.DAYS);
}
/**
* 获取今天的开始时间
*
* @return 今天
*/
public static LocalDateTime getToday() {
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
}
/**
* 获取昨天的开始时间
*
* @return 昨天
*/
public static LocalDateTime getYesterday() {
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1));
}
/**
* 获取本月的开始时间
*
* @return 本月
*/
public static LocalDateTime getMonth() {
return beginOfMonth(LocalDateTime.now());
}
/**
* 获取本年的开始时间
*
* @return 本年
*/
public static LocalDateTime getYear() {
return LocalDateTime.now().with(TemporalAdjusters.firstDayOfYear()).with(LocalTime.MIN);
}
public static List<LocalDateTime[]> getDateRangeList(LocalDateTime startTime,
LocalDateTime endTime,
Integer interval) {
// 1.1 找到枚举
DateIntervalEnum intervalEnum = DateIntervalEnum.valueOf(interval);
Assert.notNull(intervalEnum, "interval({}} 找不到对应的枚举", interval);
// 1.2 将时间对齐
startTime = LocalDateTimeUtil.beginOfDay(startTime);
endTime = LocalDateTimeUtil.endOfDay(endTime);
// 2. 循环,生成时间范围
List<LocalDateTime[]> timeRanges = new ArrayList<>();
switch (intervalEnum) {
case DAY:
while (startTime.isBefore(endTime)) {
timeRanges.add(new LocalDateTime[]{startTime, startTime.plusDays(1).minusNanos(1)});
startTime = startTime.plusDays(1);
}
break;
case WEEK:
while (startTime.isBefore(endTime)) {
LocalDateTime endOfWeek = startTime.with(DayOfWeek.SUNDAY).plusDays(1).minusNanos(1);
timeRanges.add(new LocalDateTime[]{startTime, endOfWeek});
startTime = endOfWeek.plusNanos(1);
}
break;
case MONTH:
while (startTime.isBefore(endTime)) {
LocalDateTime endOfMonth = startTime.with(TemporalAdjusters.lastDayOfMonth()).plusDays(1).minusNanos(1);
timeRanges.add(new LocalDateTime[]{startTime, endOfMonth});
startTime = endOfMonth.plusNanos(1);
}
break;
case QUARTER:
while (startTime.isBefore(endTime)) {
int quarterOfYear = getQuarterOfYear(startTime);
LocalDateTime quarterEnd = quarterOfYear == 4
? startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1)
: startTime.withMonth(quarterOfYear * 3 + 1).withDayOfMonth(1).minusNanos(1);
timeRanges.add(new LocalDateTime[]{startTime, quarterEnd});
startTime = quarterEnd.plusNanos(1);
}
break;
case YEAR:
while (startTime.isBefore(endTime)) {
LocalDateTime endOfYear = startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1);
timeRanges.add(new LocalDateTime[]{startTime, endOfYear});
startTime = endOfYear.plusNanos(1);
}
break;
default:
throw new IllegalArgumentException("Invalid interval: " + interval);
}
// 3. 兜底,最后一个时间,需要保持在 endTime 之前
LocalDateTime[] lastTimeRange = CollUtil.getLast(timeRanges);
if (lastTimeRange != null) {
lastTimeRange[1] = endTime;
}
return timeRanges;
}
/**
* 格式化时间范围
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param interval 时间间隔
* @return 时间范围
*/
public static String formatDateRange(LocalDateTime startTime, LocalDateTime endTime, Integer interval) {
// 1. 找到枚举
DateIntervalEnum intervalEnum = DateIntervalEnum.valueOf(interval);
Assert.notNull(intervalEnum, "interval({}} 找不到对应的枚举", interval);
// 2. 循环,生成时间范围
switch (intervalEnum) {
case DAY:
return LocalDateTimeUtil.format(startTime, DatePattern.NORM_DATE_PATTERN);
case WEEK:
return LocalDateTimeUtil.format(startTime, DatePattern.NORM_DATE_PATTERN)
+ StrUtil.format("(第 {} 周)", LocalDateTimeUtil.weekOfYear(startTime));
case MONTH:
return LocalDateTimeUtil.format(startTime, DatePattern.NORM_MONTH_PATTERN);
case QUARTER:
return StrUtil.format("{}-Q{}", startTime.getYear(), getQuarterOfYear(startTime));
case YEAR:
return LocalDateTimeUtil.format(startTime, DatePattern.NORM_YEAR_PATTERN);
default:
throw new IllegalArgumentException("Invalid interval: " + interval);
}
}
}

View File

@ -0,0 +1,126 @@
package cn.iocoder.yudao.framework.common.util.http;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.map.TableMap;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletRequest;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.Map;
/**
* HTTP 工具类
*
* @author 芋道源码
*/
public class HttpUtils {
@SuppressWarnings("unchecked")
public static String replaceUrlQuery(String url, String key, String value) {
UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset());
// 先移除
TableMap<CharSequence, CharSequence> query = (TableMap<CharSequence, CharSequence>)
ReflectUtil.getFieldValue(builder.getQuery(), "query");
query.remove(key);
// 后添加
builder.addQuery(key, value);
return builder.build();
}
private String append(String base, Map<String, ?> query, boolean fragment) {
return append(base, query, null, fragment);
}
/**
* 拼接 URL
*
* copy from Spring Security OAuth2 的 AuthorizationEndpoint 类的 append 方法
*
* @param base 基础 URL
* @param query 查询参数
* @param keys query 的 key,对应的原本的 key 的映射。例如说 query 里有个 key 是 xx,实际它的 key 是 extra_xx,则通过 keys 里添加这个映射
* @param fragment URL 的 fragment,即拼接到 # 中
* @return 拼接后的 URL
*/
public static String append(String base, Map<String, ?> query, Map<String, String> keys, boolean fragment) {
UriComponentsBuilder template = UriComponentsBuilder.newInstance();
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(base);
URI redirectUri;
try {
// assume it's encoded to start with (if it came in over the wire)
redirectUri = builder.build(true).toUri();
} catch (Exception e) {
// ... but allow client registrations to contain hard-coded non-encoded values
redirectUri = builder.build().toUri();
builder = UriComponentsBuilder.fromUri(redirectUri);
}
template.scheme(redirectUri.getScheme()).port(redirectUri.getPort()).host(redirectUri.getHost())
.userInfo(redirectUri.getUserInfo()).path(redirectUri.getPath());
if (fragment) {
StringBuilder values = new StringBuilder();
if (redirectUri.getFragment() != null) {
String append = redirectUri.getFragment();
values.append(append);
}
for (String key : query.keySet()) {
if (values.length() > 0) {
values.append("&");
}
String name = key;
if (keys != null && keys.containsKey(key)) {
name = keys.get(key);
}
values.append(name).append("={").append(key).append("}");
}
if (values.length() > 0) {
template.fragment(values.toString());
}
UriComponents encoded = template.build().expand(query).encode();
builder.fragment(encoded.getFragment());
} else {
for (String key : query.keySet()) {
String name = key;
if (keys != null && keys.containsKey(key)) {
name = keys.get(key);
}
template.queryParam(name, "{" + key + "}");
}
template.fragment(redirectUri.getFragment());
UriComponents encoded = template.build().expand(query).encode();
builder.query(encoded.getQuery());
}
return builder.build().toUriString();
}
public static String[] obtainBasicAuthorization(HttpServletRequest request) {
String clientId;
String clientSecret;
// 先从 Header 中获取
String authorization = request.getHeader("Authorization");
authorization = StrUtil.subAfter(authorization, "Basic ", true);
if (StringUtils.hasText(authorization)) {
authorization = Base64.decodeStr(authorization);
clientId = StrUtil.subBefore(authorization, ":", false);
clientSecret = StrUtil.subAfter(authorization, ":", false);
// 再从 Param 中获取
} else {
clientId = request.getParameter("client_id");
clientSecret = request.getParameter("client_secret");
}
// 如果两者非空,则返回
if (StrUtil.isNotEmpty(clientId) && StrUtil.isNotEmpty(clientSecret)) {
return new String[]{clientId, clientSecret};
}
return null;
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.framework.common.util.io;
import cn.hutool.core.io.FileTypeUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.DigestUtil;
import lombok.SneakyThrows;
import java.io.ByteArrayInputStream;
import java.io.File;
/**
* 文件工具类
*
* @author 芋道源码
*/
public class FileUtils {
/**
* 创建临时文件
* 该文件会在 JVM 退出时,进行删除
*
* @param data 文件内容
* @return 文件
*/
@SneakyThrows
public static File createTempFile(String data) {
File file = createTempFile();
// 写入内容
FileUtil.writeUtf8String(data, file);
return file;
}
/**
* 创建临时文件
* 该文件会在 JVM 退出时,进行删除
*
* @param data 文件内容
* @return 文件
*/
@SneakyThrows
public static File createTempFile(byte[] data) {
File file = createTempFile();
// 写入内容
FileUtil.writeBytes(data, file);
return file;
}
/**
* 创建临时文件,无内容
* 该文件会在 JVM 退出时,进行删除
*
* @return 文件
*/
@SneakyThrows
public static File createTempFile() {
// 创建文件,通过 UUID 保证唯一
File file = File.createTempFile(IdUtil.simpleUUID(), null);
// 标记 JVM 退出时,自动删除
file.deleteOnExit();
return file;
}
/**
* 生成文件路径
*
* @param content 文件内容
* @param originalName 原始文件名
* @return path,唯一不可重复
*/
public static String generatePath(byte[] content, String originalName) {
String sha256Hex = DigestUtil.sha256Hex(content);
// 情况一:如果存在 name,则优先使用 name 的后缀
if (StrUtil.isNotBlank(originalName)) {
String extName = FileNameUtil.extName(originalName);
return StrUtil.isBlank(extName) ? sha256Hex : sha256Hex + "." + extName;
}
// 情况二:基于 content 计算
return sha256Hex + '.' + FileTypeUtil.getType(new ByteArrayInputStream(content));
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.framework.common.util.io;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import java.io.InputStream;
/**
* IO 工具类,用于 {@link cn.hutool.core.io.IoUtil} 缺失的方法
*
* @author 芋道源码
*/
public class IoUtils {
/**
* 从流中读取 UTF8 编码的内容
*
* @param in 输入流
* @param isClose 是否关闭
* @return 内容
* @throws IORuntimeException IO 异常
*/
public static String readUtf8(InputStream in, boolean isClose) throws IORuntimeException {
return StrUtil.utf8Str(IoUtil.read(in, isClose));
}
}

View File

@ -0,0 +1,202 @@
package cn.iocoder.yudao.framework.common.util.json;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
/**
* JSON 工具类
*
* @author 芋道源码
*/
@Slf4j
public class JsonUtils {
private static ObjectMapper objectMapper = new ObjectMapper();
static {
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // 忽略 null 值
objectMapper.registerModules(new JavaTimeModule()); // 解决 LocalDateTime 的序列化
}
/**
* 初始化 objectMapper 属性
* <p>
* 通过这样的方式,使用 Spring 创建的 ObjectMapper Bean
*
* @param objectMapper ObjectMapper 对象
*/
public static void init(ObjectMapper objectMapper) {
JsonUtils.objectMapper = objectMapper;
}
@SneakyThrows
public static String toJsonString(Object object) {
return objectMapper.writeValueAsString(object);
}
@SneakyThrows
public static byte[] toJsonByte(Object object) {
return objectMapper.writeValueAsBytes(object);
}
@SneakyThrows
public static String toJsonPrettyString(Object object) {
return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
}
public static <T> T parseObject(String text, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return null;
}
try {
return objectMapper.readValue(text, clazz);
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
public static <T> T parseObject(String text, String path, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return null;
}
try {
JsonNode treeNode = objectMapper.readTree(text);
JsonNode pathNode = treeNode.path(path);
return objectMapper.readValue(pathNode.toString(), clazz);
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
public static <T> T parseObject(String text, Type type) {
if (StrUtil.isEmpty(text)) {
return null;
}
try {
return objectMapper.readValue(text, objectMapper.getTypeFactory().constructType(type));
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
/**
* 将字符串解析成指定类型的对象
* 使用 {@link #parseObject(String, Class)} 时,在@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 的场景下,
* 如果 text 没有 class 属性,则会报错。此时,使用这个方法,可以解决。
*
* @param text 字符串
* @param clazz 类型
* @return 对象
*/
public static <T> T parseObject2(String text, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return null;
}
return JSONUtil.toBean(text, clazz);
}
public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
if (ArrayUtil.isEmpty(bytes)) {
return null;
}
try {
return objectMapper.readValue(bytes, clazz);
} catch (IOException e) {
log.error("json parse err,json:{}", bytes, e);
throw new RuntimeException(e);
}
}
public static <T> T parseObject(String text, TypeReference<T> typeReference) {
try {
return objectMapper.readValue(text, typeReference);
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
/**
* 解析 JSON 字符串成指定类型的对象,如果解析失败,则返回 null
*
* @param text 字符串
* @param typeReference 类型引用
* @return 指定类型的对象
*/
public static <T> T parseObjectQuietly(String text, TypeReference<T> typeReference) {
try {
return objectMapper.readValue(text, typeReference);
} catch (IOException e) {
return null;
}
}
public static <T> List<T> parseArray(String text, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return new ArrayList<>();
}
try {
return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
public static <T> List<T> parseArray(String text, String path, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return null;
}
try {
JsonNode treeNode = objectMapper.readTree(text);
JsonNode pathNode = treeNode.path(path);
return objectMapper.readValue(pathNode.toString(), objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
public static JsonNode parseTree(String text) {
try {
return objectMapper.readTree(text);
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
public static JsonNode parseTree(byte[] text) {
try {
return objectMapper.readTree(text);
} catch (IOException e) {
log.error("json parse err,json:{}", text, e);
throw new RuntimeException(e);
}
}
public static boolean isJson(String text) {
return JSONUtil.isTypeJSON(text);
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.framework.common.util.monitor;
import org.apache.skywalking.apm.toolkit.trace.TraceContext;
/**
* 链路追踪工具类
*
* 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 util 包下
*
* @author 芋道源码
*/
public class TracerUtils {
/**
* 私有化构造方法
*/
private TracerUtils() {
}
/**
* 获得链路追踪编号,直接返回 SkyWalking 的 TraceId。
* 如果不存在的话为空字符串!!!
*
* @return 链路追踪编号
*/
public static String getTraceId() {
return TraceContext.traceId();
}
}

View File

@ -0,0 +1,131 @@
package cn.iocoder.yudao.framework.common.util.number;
import cn.hutool.core.math.Money;
import cn.hutool.core.util.NumberUtil;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
* 金额工具类
*
* @author 芋道源码
*/
public class MoneyUtils {
/**
* 金额的小数位数
*/
private static final int PRICE_SCALE = 2;
/**
* 百分比对应的 BigDecimal 对象
*/
public static final BigDecimal PERCENT_100 = BigDecimal.valueOf(100);
/**
* 计算百分比金额,四舍五入
*
* @param price 金额
* @param rate 百分比,例如说 56.77% 则传入 56.77
* @return 百分比金额
*/
public static Integer calculateRatePrice(Integer price, Double rate) {
return calculateRatePrice(price, rate, 0, RoundingMode.HALF_UP).intValue();
}
/**
* 计算百分比金额,向下传入
*
* @param price 金额
* @param rate 百分比,例如说 56.77% 则传入 56.77
* @return 百分比金额
*/
public static Integer calculateRatePriceFloor(Integer price, Double rate) {
return calculateRatePrice(price, rate, 0, RoundingMode.FLOOR).intValue();
}
/**
* 计算百分比金额
*
* @param price 金额(单位分)
* @param count 数量
* @param percent 折扣(单位分),列如 60.2%,则传入 6020
* @return 商品总价
*/
public static Integer calculator(Integer price, Integer count, Integer percent) {
price = price * count;
if (percent == null) {
return price;
}
return MoneyUtils.calculateRatePriceFloor(price, (double) (percent / 100));
}
/**
* 计算百分比金额
*
* @param price 金额
* @param rate 百分比,例如说 56.77% 则传入 56.77
* @param scale 保留小数位数
* @param roundingMode 舍入模式
*/
public static BigDecimal calculateRatePrice(Number price, Number rate, int scale, RoundingMode roundingMode) {
return NumberUtil.toBigDecimal(price).multiply(NumberUtil.toBigDecimal(rate)) // 乘以
.divide(BigDecimal.valueOf(100), scale, roundingMode); // 除以 100
}
/**
* 分转元
*
* @param fen 分
* @return 元
*/
public static BigDecimal fenToYuan(int fen) {
return new Money(0, fen).getAmount();
}
/**
* 分转元(字符串)
*
* 例如说 fen 为 1 时,则结果为 0.01
*
* @param fen 分
* @return 元
*/
public static String fenToYuanStr(int fen) {
return new Money(0, fen).toString();
}
/**
* 金额相乘,默认进行四舍五入
*
* 位数:{@link #PRICE_SCALE}
*
* @param price 金额
* @param count 数量
* @return 金额相乘结果
*/
public static BigDecimal priceMultiply(BigDecimal price, BigDecimal count) {
if (price == null || count == null) {
return null;
}
return price.multiply(count).setScale(PRICE_SCALE, RoundingMode.HALF_UP);
}
/**
* 金额相乘(百分比),默认进行四舍五入
*
* 位数:{@link #PRICE_SCALE}
*
* @param price 金额
* @param percent 百分比
* @return 金额相乘结果
*/
public static BigDecimal priceMultiplyPercent(BigDecimal price, BigDecimal percent) {
if (price == null || percent == null) {
return null;
}
return price.multiply(percent).divide(PERCENT_100, PRICE_SCALE, RoundingMode.HALF_UP);
}
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.framework.common.util.number;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import java.math.BigDecimal;
/**
* 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能
*
* @author 芋道源码
*/
public class NumberUtils {
public static Long parseLong(String str) {
return StrUtil.isNotEmpty(str) ? Long.valueOf(str) : null;
}
public static Integer parseInt(String str) {
return StrUtil.isNotEmpty(str) ? Integer.valueOf(str) : null;
}
/**
* 通过经纬度获取地球上两点之间的距离
*
* 参考 <<a href="https://gitee.com/dromara/hutool/blob/1caabb586b1f95aec66a21d039c5695df5e0f4c1/hutool-core/src/main/java/cn/hutool/core/util/DistanceUtil.java">DistanceUtil</a>> 实现,目前它已经被 hutool 删除
*
* @param lat1 经度1
* @param lng1 纬度1
* @param lat2 经度2
* @param lng2 纬度2
* @return 距离,单位:千米
*/
public static double getDistance(double lat1, double lng1, double lat2, double lng2) {
double radLat1 = lat1 * Math.PI / 180.0;
double radLat2 = lat2 * Math.PI / 180.0;
double a = radLat1 - radLat2;
double b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
double distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ Math.cos(radLat1) * Math.cos(radLat2)
* Math.pow(Math.sin(b / 2), 2)));
distance = distance * 6378.137;
distance = Math.round(distance * 10000d) / 10000d;
return distance;
}
/**
* 提供精确的乘法运算
*
* 和 hutool {@link NumberUtil#mul(BigDecimal...)} 的差别是,如果存在 null,则返回 null
*
* @param values 多个被乘值
* @return 积
*/
public static BigDecimal mul(BigDecimal... values) {
for (BigDecimal value : values) {
if (value == null) {
return null;
}
}
return NumberUtil.mul(values);
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.framework.common.util.object;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import java.util.List;
import java.util.function.Consumer;
/**
* Bean 工具类
*
* 1. 默认使用 {@link cn.hutool.core.bean.BeanUtil} 作为实现类,虽然不同 bean 工具的性能有差别,但是对绝大多数同学的项目,不用在意这点性能
* 2. 针对复杂的对象转换,可以搜参考 AuthConvert 实现,通过 mapstruct + default 配合实现
*
* @author 芋道源码
*/
public class BeanUtils {
public static <T> T toBean(Object source, Class<T> targetClass) {
return BeanUtil.toBean(source, targetClass);
}
public static <T> T toBean(Object source, Class<T> targetClass, Consumer<T> peek) {
T target = toBean(source, targetClass);
if (target != null) {
peek.accept(target);
}
return target;
}
public static <S, T> List<T> toBean(List<S> source, Class<T> targetType) {
if (source == null) {
return null;
}
return CollectionUtils.convertList(source, s -> toBean(s, targetType));
}
public static <S, T> List<T> toBean(List<S> source, Class<T> targetType, Consumer<T> peek) {
List<T> list = toBean(source, targetType);
if (list != null) {
list.forEach(peek);
}
return list;
}
public static <S, T> PageResult<T> toBean(PageResult<S> source, Class<T> targetType) {
return toBean(source, targetType, null);
}
public static <S, T> PageResult<T> toBean(PageResult<S> source, Class<T> targetType, Consumer<T> peek) {
if (source == null) {
return null;
}
List<T> list = toBean(source.getList(), targetType);
if (peek != null) {
list.forEach(peek);
}
return new PageResult<>(list, source.getTotal());
}
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.framework.common.util.object;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.function.Consumer;
/**
* Object 工具类
*
* @author 芋道源码
*/
public class ObjectUtils {
/**
* 复制对象,并忽略 Id 编号
*
* @param object 被复制对象
* @param consumer 消费者,可以二次编辑被复制对象
* @return 复制后的对象
*/
public static <T> T cloneIgnoreId(T object, Consumer<T> consumer) {
T result = ObjectUtil.clone(object);
// 忽略 id 编号
Field field = ReflectUtil.getField(object.getClass(), "id");
if (field != null) {
ReflectUtil.setFieldValue(result, field, null);
}
// 二次编辑
if (result != null) {
consumer.accept(result);
}
return result;
}
public static <T extends Comparable<T>> T max(T obj1, T obj2) {
if (obj1 == null) {
return obj2;
}
if (obj2 == null) {
return obj1;
}
return obj1.compareTo(obj2) > 0 ? obj1 : obj2;
}
@SafeVarargs
public static <T> T defaultIfNull(T... array) {
for (T item : array) {
if (item != null) {
return item;
}
}
return null;
}
@SafeVarargs
public static <T> boolean equalsAny(T obj, T... array) {
return Arrays.asList(array).contains(obj);
}
}

View File

@ -0,0 +1,67 @@
package cn.iocoder.yudao.framework.common.util.object;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.func.Func1;
import cn.hutool.core.lang.func.LambdaUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.SortablePageParam;
import cn.iocoder.yudao.framework.common.pojo.SortingField;
import org.springframework.util.Assert;
import static java.util.Collections.singletonList;
/**
* {@link cn.iocoder.yudao.framework.common.pojo.PageParam} 工具类
*
* @author 芋道源码
*/
public class PageUtils {
private static final Object[] ORDER_TYPES = new String[]{SortingField.ORDER_ASC, SortingField.ORDER_DESC};
public static int getStart(PageParam pageParam) {
return (pageParam.getPageNo() - 1) * pageParam.getPageSize();
}
/**
* 构建排序字段(默认倒序)
*
* @param func 排序字段的 Lambda 表达式
* @param <T> 排序字段所属的类型
* @return 排序字段
*/
public static <T> SortingField buildSortingField(Func1<T, ?> func) {
return buildSortingField(func, SortingField.ORDER_DESC);
}
/**
* 构建排序字段
*
* @param func 排序字段的 Lambda 表达式
* @param order 排序类型 {@link SortingField#ORDER_ASC} {@link SortingField#ORDER_DESC}
* @param <T> 排序字段所属的类型
* @return 排序字段
*/
public static <T> SortingField buildSortingField(Func1<T, ?> func, String order) {
Assert.isTrue(ArrayUtil.contains(ORDER_TYPES, order), String.format("字段的排序类型只能是 %s/%s", ORDER_TYPES));
String fieldName = LambdaUtil.getFieldName(func);
return new SortingField(fieldName, order);
}
/**
* 构建默认的排序字段
* 如果排序字段为空,则设置排序字段;否则忽略
*
* @param sortablePageParam 排序分页查询参数
* @param func 排序字段的 Lambda 表达式
* @param <T> 排序字段所属的类型
*/
public static <T> void buildDefaultSortingField(SortablePageParam sortablePageParam, Func1<T, ?> func) {
if (sortablePageParam != null && CollUtil.isEmpty(sortablePageParam.getSortingFields())) {
sortablePageParam.setSortingFields(singletonList(buildSortingField(func)));
}
}
}

View File

@ -0,0 +1,7 @@
/**
* 对于工具类的选择,优先查找 Hutool 中有没对应的方法
* 如果没有,则自己封装对应的工具类,以 Utils 结尾,用于区分
*
* ps:如果担心 Hutool 存在坑的问题,可以阅读 Hutool 的实现源码,以确保可靠性。并且,可以补充相关的单元测试。
*/
package cn.iocoder.yudao.framework.common.util;

View File

@ -0,0 +1,111 @@
package cn.iocoder.yudao.framework.common.util.servlet;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import org.springframework.http.MediaType;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Map;
/**
* 客户端工具类
*
* @author 芋道源码
*/
public class ServletUtils {
/**
* 返回 JSON 字符串
*
* @param response 响应
* @param object 对象,会序列化成 JSON 字符串
*/
@SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码
public static void writeJSON(HttpServletResponse response, Object object) {
String content = JsonUtils.toJsonString(object);
ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE);
}
/**
* 返回附件
*
* @param response 响应
* @param filename 文件名
* @param content 附件内容
*/
public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
// 设置 header 和 contentType
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
// 输出附件
IoUtil.write(response.getOutputStream(), false, content);
}
/**
* @param request 请求
* @return ua
*/
public static String getUserAgent(HttpServletRequest request) {
String ua = request.getHeader("User-Agent");
return ua != null ? ua : "";
}
/**
* 获得请求
*
* @return HttpServletRequest
*/
public static HttpServletRequest getRequest() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (!(requestAttributes instanceof ServletRequestAttributes)) {
return null;
}
return ((ServletRequestAttributes) requestAttributes).getRequest();
}
public static String getUserAgent() {
HttpServletRequest request = getRequest();
if (request == null) {
return null;
}
return getUserAgent(request);
}
public static String getClientIP() {
HttpServletRequest request = getRequest();
if (request == null) {
return null;
}
return ServletUtil.getClientIP(request);
}
public static boolean isJsonRequest(ServletRequest request) {
return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
}
public static String getBody(HttpServletRequest request) {
return ServletUtil.getBody(request);
}
public static byte[] getBodyBytes(HttpServletRequest request) {
return ServletUtil.getBodyBytes(request);
}
public static String getClientIP(HttpServletRequest request) {
return ServletUtil.getClientIP(request);
}
public static Map<String, String> getParamMap(HttpServletRequest request) {
return ServletUtil.getParamMap(request);
}
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.framework.common.util.spring;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Spring EL 表达式的工具类
*
* @author mashu
*/
public class SpringExpressionUtils {
/**
* Spring EL 表达式解析器
*/
private static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser();
/**
* 参数名发现器
*/
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
private SpringExpressionUtils() {
}
/**
* 从切面中,单个解析 EL 表达式的结果
*
* @param joinPoint 切面点
* @param expressionString EL 表达式数组
* @return 执行界面
*/
public static Object parseExpression(JoinPoint joinPoint, String expressionString) {
Map<String, Object> result = parseExpressions(joinPoint, Collections.singletonList(expressionString));
return result.get(expressionString);
}
/**
* 从切面中,批量解析 EL 表达式的结果
*
* @param joinPoint 切面点
* @param expressionStrings EL 表达式数组
* @return 结果,key 为表达式,value 为对应值
*/
public static Map<String, Object> parseExpressions(JoinPoint joinPoint, List<String> expressionStrings) {
// 如果为空,则不进行解析
if (CollUtil.isEmpty(expressionStrings)) {
return MapUtil.newHashMap();
}
// 第一步,构建解析的上下文 EvaluationContext
// 通过 joinPoint 获取被注解方法
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();
// 使用 spring 的 ParameterNameDiscoverer 获取方法形参名数组
String[] paramNames = PARAMETER_NAME_DISCOVERER.getParameterNames(method);
// Spring 的表达式上下文对象
EvaluationContext context = new StandardEvaluationContext();
// 给上下文赋值
if (ArrayUtil.isNotEmpty(paramNames)) {
Object[] args = joinPoint.getArgs();
for (int i = 0; i < paramNames.length; i++) {
context.setVariable(paramNames[i], args[i]);
}
}
// 第二步,逐个参数解析
Map<String, Object> result = MapUtil.newHashMap(expressionStrings.size(), true);
expressionStrings.forEach(key -> {
Object value = EXPRESSION_PARSER.parseExpression(key).getValue(context);
result.put(key, value);
});
return result;
}
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.framework.common.util.spring;
import cn.hutool.extra.spring.SpringUtil;
import java.util.Objects;
/**
* Spring 工具类
*
* @author 芋道源码
*/
public class SpringUtils extends SpringUtil {
/**
* 是否为生产环境
*
* @return 是否生产环境
*/
public static boolean isProd() {
String activeProfile = getActiveProfile();
return Objects.equals("prod", activeProfile);
}
}

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.framework.common.util.string;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 字符串工具类
*
* @author 芋道源码
*/
public class StrUtils {
public static String maxLength(CharSequence str, int maxLength) {
return StrUtil.maxLength(str, maxLength - 3); // -3 的原因,是该方法会补充 ... 恰好
}
/**
* 给定字符串是否以任何一个字符串开始
* 给定字符串和数组为空都返回 false
*
* @param str 给定字符串
* @param prefixes 需要检测的开始字符串
* @since 3.0.6
*/
public static boolean startWithAny(String str, Collection<String> prefixes) {
if (StrUtil.isEmpty(str) || ArrayUtil.isEmpty(prefixes)) {
return false;
}
for (CharSequence suffix : prefixes) {
if (StrUtil.startWith(str, suffix, false)) {
return true;
}
}
return false;
}
public static List<Long> splitToLong(String value, CharSequence separator) {
long[] longs = StrUtil.splitToLong(value, separator);
return Arrays.stream(longs).boxed().collect(Collectors.toList());
}
public static Set<Long> splitToLongSet(String value) {
return splitToLongSet(value, StrPool.COMMA);
}
public static Set<Long> splitToLongSet(String value, CharSequence separator) {
long[] longs = StrUtil.splitToLong(value, separator);
return Arrays.stream(longs).boxed().collect(Collectors.toSet());
}
public static List<Integer> splitToInteger(String value, CharSequence separator) {
int[] integers = StrUtil.splitToInt(value, separator);
return Arrays.stream(integers).boxed().collect(Collectors.toList());
}
/**
* 移除字符串中,包含指定字符串的行
*
* @param content 字符串
* @param sequence 包含的字符串
* @return 移除后的字符串
*/
public static String removeLineContains(String content, String sequence) {
if (StrUtil.isEmpty(content) || StrUtil.isEmpty(sequence)) {
return content;
}
return Arrays.stream(content.split("\n"))
.filter(line -> !line.contains(sequence))
.collect(Collectors.joining("\n"));
}
}

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