From b75d1544ef1b8b9e0d78e30b2302d21a4e5d4fe0 Mon Sep 17 00:00:00 2001 From: gitriver Date: Sun, 21 Dec 2025 19:15:50 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=92=88=E5=AF=B9Spring?= =?UTF-8?q?=20Boot=204=20=E5=8F=8AH2=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 136 +++-- renren-admin/pom.xml | 5 + .../src/main/resources/application-dev.yml | 45 +- .../src/main/resources/application.yml | 3 + renren-admin/src/main/resources/h2.sql | 504 ++++++++++++++++++ .../java/io/renren/DruidFilterConfig.java | 31 ++ .../io/renren/config/MDataSourceConfig.java | 74 +++ .../io/renren/config/SDataSourceConfig.java | 70 +++ renren-admin/src/test/resources/multi-ds.yml | 73 +++ renren-api/pom.xml | 86 +-- .../java/io/renren/client/AlbumsClient.java | 32 ++ .../io/renren/config/APIVersionConfig.java | 31 ++ .../io/renren/config/RestClientConfig.java | 18 + .../controller/APIVersionController.java | 31 ++ .../renren/controller/ApiLoginController.java | 2 - .../main/java/io/renren/dto/AlbumsReq.java | 19 + .../main/java/io/renren/dto/AlbumsResp.java | 14 + .../src/main/resources/application-dev.yml | 16 +- renren-api/src/main/resources/application.yml | 9 +- renren-api/src/main/resources/h2.sql | 25 + .../java/io/renren/test/BeanRegistarTest.java | 23 + .../java/io/renren/test/HttpExchangeTest.java | 24 + .../test/config/BeanRegisterConfig.java | 9 + .../renren/test/config/MyBeansRegistrar.java | 18 + .../java/io/renren/test/config/Order.java | 12 + .../test/java/io/renren/test/config/User.java | 18 + renren-common/pom.xml | 8 + .../DruidDataSourceAutoConfigure.java | 71 +++ .../autoconfigure/DruidDataSourceWrapper.java | 75 +++ "\344\277\256\346\224\271.md" | 27 + 30 files changed, 1400 insertions(+), 109 deletions(-) create mode 100644 renren-admin/src/main/resources/h2.sql create mode 100644 renren-admin/src/test/java/io/renren/DruidFilterConfig.java create mode 100644 renren-admin/src/test/java/io/renren/config/MDataSourceConfig.java create mode 100644 renren-admin/src/test/java/io/renren/config/SDataSourceConfig.java create mode 100644 renren-admin/src/test/resources/multi-ds.yml create mode 100644 renren-api/src/main/java/io/renren/client/AlbumsClient.java create mode 100644 renren-api/src/main/java/io/renren/config/APIVersionConfig.java create mode 100644 renren-api/src/main/java/io/renren/config/RestClientConfig.java create mode 100644 renren-api/src/main/java/io/renren/controller/APIVersionController.java create mode 100644 renren-api/src/main/java/io/renren/dto/AlbumsReq.java create mode 100644 renren-api/src/main/java/io/renren/dto/AlbumsResp.java create mode 100644 renren-api/src/main/resources/h2.sql create mode 100644 renren-api/src/test/java/io/renren/test/BeanRegistarTest.java create mode 100644 renren-api/src/test/java/io/renren/test/HttpExchangeTest.java create mode 100644 renren-api/src/test/java/io/renren/test/config/BeanRegisterConfig.java create mode 100644 renren-api/src/test/java/io/renren/test/config/MyBeansRegistrar.java create mode 100644 renren-api/src/test/java/io/renren/test/config/Order.java create mode 100644 renren-api/src/test/java/io/renren/test/config/User.java create mode 100644 renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceAutoConfigure.java create mode 100644 renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java create mode 100644 "\344\277\256\346\224\271.md" diff --git a/pom.xml b/pom.xml index e7dbe7d..6cfb082 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,4 @@ - 4.0.0 io.renren @@ -10,15 +10,15 @@ 人人权限系统 https://www.renren.io - - org.springframework.boot - spring-boot-starter-parent - 3.5.4 - + + org.springframework.boot + spring-boot-starter-parent + 4.0.0 + renren-common - renren-dynamic-datasource + renren-dynamic-datasource renren-admin renren-api renren-generator @@ -27,16 +27,16 @@ UTF-8 UTF-8 - 17 - 1.2.23 - 3.5.8 + 25 + 1.2.27 + 3.5.15 4.0 11.2.0.3 8.1.2.141 - 5.8.29 - 1.15.3 + 5.8.42 + 1.21.2 4.5.0 - 2.8.4 + 2.8.14 @@ -45,18 +45,17 @@ lombok true - - org.springframework.boot - spring-boot-starter-test - test - org.springframework.boot spring-boot-starter-web + + + + org.springframework.boot - spring-boot-starter-aop + spring-boot-starter-aspectj org.springframework.boot @@ -75,42 +74,60 @@ spring-boot-configuration-processor true - - - com.mysql - mysql-connector-j - - - com.oracle - ojdbc6 - ${oracle.version} - - - - com.microsoft.sqlserver - sqljdbc4 - ${sqlserver.version} + org.springframework.boot + spring-boot-starter-jdbc - - org.postgresql - postgresql - - + org.springframework.boot + spring-boot-starter-quartz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - com.dameng - DmJdbcDriver18 - ${dameng.version} + com.alibaba + druid-spring-boot-3-starter + ${druid.version} com.alibaba - druid-spring-boot-3-starter + druid ${druid.version} com.baomidou - mybatis-plus-spring-boot3-starter + mybatis-plus-spring-boot4-starter + ${mybatisplus.version} + + + com.baomidou + mybatis-plus-jsqlparser ${mybatisplus.version} @@ -134,7 +151,38 @@ ${springdoc.version} + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.14.1 + + 17 + 17 + + + org.springframework.boot + spring-boot-configuration-processor + 4.0.0 + + + org.projectlombok + lombok + 1.18.42 + + + + + + diff --git a/renren-admin/pom.xml b/renren-admin/pom.xml index fac8a4e..bdd40fe 100644 --- a/renren-admin/pom.xml +++ b/renren-admin/pom.xml @@ -31,6 +31,11 @@ renren-dynamic-datasource 5.5.0 + + com.h2database + h2 + 2.3.232 + org.quartz-scheduler quartz diff --git a/renren-admin/src/main/resources/application-dev.yml b/renren-admin/src/main/resources/application-dev.yml index af80fc7..16ed07c 100644 --- a/renren-admin/src/main/resources/application-dev.yml +++ b/renren-admin/src/main/resources/application-dev.yml @@ -2,15 +2,20 @@ spring: datasource: druid: #MySQL - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - username: renren - password: 123456 +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://localhost:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true +# username: renren +# password: 123456 + #H2 + driver-class-name: org.h2.Driver + url: jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1; + username: sa + password: admin #达梦8 -# driver-class-name: dm.jdbc.driver.DmDriver -# url: jdbc:dm://192.168.10.10:5236/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true -# username: renren_security -# password: 12345678 + # driver-class-name: dm.jdbc.driver.DmDriver + # url: jdbc:dm://192.168.10.10:5236/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true + # username: renren_security + # password: 12345678 # #Oracle # driver-class-name: oracle.jdbc.OracleDriver # url: jdbc:oracle:thin:@192.168.10.10:1521:xe @@ -55,15 +60,15 @@ spring: # multi-statement-allow: true ##多数据源的配置,需要引用renren-dynamic-datasource -#dynamic: -# datasource: -# slave1: -# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver -# url: jdbc:sqlserver://123456:1433;DatabaseName=renren_security -# username: sa -# password: 123456 -# slave2: -# driver-class-name: org.postgresql.Driver -# url: jdbc:postgresql://123456:5432/renren_security -# username: postgres -# password: 123456 +dynamic: + datasource: + slave1: + driver-class-name: org.h2.Driver + url: jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1; + username: sa + password: admin + slave2: + driver-class-name: org.h2.Driver + url: jdbc:h2:mem:testdb2;MODE=MySQL;DB_CLOSE_DELAY=-1; + username: sa + password: admin diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index 436480b..7c4268a 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -36,6 +36,9 @@ spring: max-file-size: 100MB max-request-size: 100MB enabled: true + sql: + init: + schema-locations: classpath*:h2.sql data: redis: diff --git a/renren-admin/src/main/resources/h2.sql b/renren-admin/src/main/resources/h2.sql new file mode 100644 index 0000000..05851c6 --- /dev/null +++ b/renren-admin/src/main/resources/h2.sql @@ -0,0 +1,504 @@ +-- 系统用户 +CREATE TABLE sys_user ( + id bigint NOT NULL COMMENT 'id', + username varchar(50) NOT NULL COMMENT '用户名', + password varchar(100) COMMENT '密码', + real_name varchar(50) COMMENT '姓名', + head_url varchar(200) COMMENT '头像', + gender tinyint unsigned COMMENT '性别 0:男 1:女 2:保密', + email varchar(100) COMMENT '邮箱', + mobile varchar(100) COMMENT '手机号', + dept_id bigint COMMENT '部门ID', + super_admin tinyint unsigned COMMENT '超级管理员 0:否 1:是', + status tinyint COMMENT '状态 0:停用 1:正常', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + unique key uk_username (username), + key idx_user_create_date (create_date) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户'; + +-- 部门 +CREATE TABLE sys_dept ( + id bigint NOT NULL COMMENT 'id', + pid bigint COMMENT '上级ID', + pids varchar(500) COMMENT '所有上级ID,用逗号分开', + name varchar(50) COMMENT '部门名称', + sort int unsigned COMMENT '排序', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + key idx_dept_pid (pid), + key idx_sort (sort) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门管理'; + +-- 角色管理 +create table sys_role +( + id bigint NOT NULL COMMENT 'id', + name varchar(50) COMMENT '角色名称', + remark varchar(100) COMMENT '备注', + dept_id bigint COMMENT '部门ID', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + key idx_dept_id (dept_id) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色管理'; + +-- 菜单管理 +create table sys_menu +( + id bigint NOT NULL COMMENT 'id', + pid bigint COMMENT '上级ID,一级菜单为0', + name varchar(200) COMMENT '名称', + url varchar(200) COMMENT '菜单URL', + permissions varchar(500) COMMENT '授权(多个用逗号分隔,如:sys:user:list,sys:user:save)', + menu_type tinyint unsigned COMMENT '类型 0:菜单 1:按钮', + icon varchar(50) COMMENT '菜单图标', + sort int COMMENT '排序', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + key idx_menu_pid (pid), + key idx_menu_sort (sort) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='菜单管理'; + +-- 角色用户关系 +create table sys_role_user +( + id bigint NOT NULL COMMENT 'id', + role_id bigint COMMENT '角色ID', + user_id bigint COMMENT '用户ID', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + primary key (id), + key idx_role_user_role_id (role_id), + key idx_user_id (user_id) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色用户关系'; + +-- 角色菜单关系 +create table sys_role_menu +( + id bigint NOT NULL COMMENT 'id', + role_id bigint COMMENT '角色ID', + menu_id bigint COMMENT '菜单ID', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + primary key (id), + key idx_role_menu_role_id (role_id), + key idx_menu_id (menu_id) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色菜单关系'; + +-- 角色数据权限 +create table sys_role_data_scope +( + id bigint NOT NULL COMMENT 'id', + role_id bigint COMMENT '角色ID', + dept_id bigint COMMENT '部门ID', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + primary key (id), + key idx_role_data_scope_role_id (role_id) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色数据权限'; + +-- 参数管理 +create table sys_params +( + id bigint NOT NULL COMMENT 'id', + param_code varchar(32) COMMENT '参数编码', + param_value varchar(2000) COMMENT '参数值', + param_type tinyint unsigned default 1 COMMENT '类型 0:系统参数 1:非系统参数', + remark varchar(200) COMMENT '备注', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + unique key uk_param_code (param_code), + key idx_params_create_date (create_date) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='参数管理'; + +-- 字典类型 +create table sys_dict_type +( + id bigint NOT NULL COMMENT 'id', + dict_type varchar(100) NOT NULL COMMENT '字典类型', + dict_name varchar(255) NOT NULL COMMENT '字典名称', + remark varchar(255) COMMENT '备注', + sort int unsigned COMMENT '排序', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + UNIQUE KEY(dict_type) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='字典类型'; + +-- 字典数据 +create table sys_dict_data +( + id bigint NOT NULL COMMENT 'id', + dict_type_id bigint NOT NULL COMMENT '字典类型ID', + dict_label varchar(255) NOT NULL COMMENT '字典标签', + dict_value varchar(255) COMMENT '字典值', + remark varchar(255) COMMENT '备注', + sort int unsigned COMMENT '排序', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + unique key uk_dict_type_value (dict_type_id, dict_value), + key idx_dict_data_sort (sort) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='字典数据'; + +-- 登录日志 +create table sys_log_login +( + id bigint NOT NULL COMMENT 'id', + operation tinyint unsigned COMMENT '用户操作 0:用户登录 1:用户退出', + status tinyint unsigned NOT NULL COMMENT '状态 0:失败 1:成功 2:账号已锁定', + user_agent varchar(500) COMMENT '用户代理', + ip varchar(32) COMMENT '操作IP', + creator_name varchar(50) COMMENT '用户名', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + primary key (id), + key idx_status (status), + key idx_log_login_create_date (create_date) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='登录日志'; + +-- 操作日志 +create table sys_log_operation +( + id bigint NOT NULL COMMENT 'id', + operation varchar(50) COMMENT '用户操作', + request_uri varchar(200) COMMENT '请求URI', + request_method varchar(20) COMMENT '请求方式', + request_params text COMMENT '请求参数', + request_time int unsigned NOT NULL COMMENT '请求时长(毫秒)', + user_agent varchar(500) COMMENT '用户代理', + ip varchar(32) COMMENT '操作IP', + status tinyint unsigned NOT NULL COMMENT '状态 0:失败 1:成功', + creator_name varchar(50) COMMENT '用户名', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + primary key (id), + key idx_sys_log_operation_create_date (create_date) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='操作日志'; + +-- 异常日志 +create table sys_log_error +( + id bigint NOT NULL COMMENT 'id', + request_uri varchar(200) COMMENT '请求URI', + request_method varchar(20) COMMENT '请求方式', + request_params text COMMENT '请求参数', + user_agent varchar(500) COMMENT '用户代理', + ip varchar(32) COMMENT '操作IP', + error_info text COMMENT '异常信息', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + primary key (id), + key idx_sys_log_error_create_date (create_date) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='异常日志'; + + +-- 文件上传 +CREATE TABLE sys_oss ( + id bigint NOT NULL COMMENT 'id', + url varchar(200) COMMENT 'URL地址', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + PRIMARY KEY (id), + key idx_sys_oss_create_date (create_date) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='文件上传'; + +-- 定时任务 +CREATE TABLE schedule_job ( + id bigint NOT NULL COMMENT 'id', + bean_name varchar(200) DEFAULT NULL COMMENT 'spring bean名称', + params varchar(2000) DEFAULT NULL COMMENT '参数', + cron_expression varchar(100) DEFAULT NULL COMMENT 'cron表达式', + status tinyint unsigned COMMENT '任务状态 0:暂停 1:正常', + remark varchar(255) DEFAULT NULL COMMENT '备注', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + PRIMARY KEY (id), + key idx_schedule_job_create_date (create_date) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='定时任务'; + +-- 定时任务日志 +CREATE TABLE schedule_job_log ( + id bigint NOT NULL COMMENT 'id', + job_id bigint NOT NULL COMMENT '任务id', + bean_name varchar(200) DEFAULT NULL COMMENT 'spring bean名称', + params varchar(2000) DEFAULT NULL COMMENT '参数', + status tinyint unsigned NOT NULL COMMENT '任务状态 0:失败 1:成功', + error varchar(2000) DEFAULT NULL COMMENT '失败信息', + times int NOT NULL COMMENT '耗时(单位:毫秒)', + create_date datetime COMMENT '创建时间', + PRIMARY KEY (id), + key idx_job_id (job_id), + key idx_schedule_job_log_create_date (create_date) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='定时任务日志'; + +-- 系统用户Token +CREATE TABLE sys_user_token ( + id bigint NOT NULL COMMENT 'id', + user_id bigint NOT NULL COMMENT '用户id', + token varchar(100) NOT NULL COMMENT '用户token', + expire_date datetime COMMENT '过期时间', + update_date datetime COMMENT '更新时间', + create_date datetime COMMENT '创建时间', + PRIMARY KEY (id), + UNIQUE KEY user_id (user_id), + UNIQUE KEY token (token) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户Token'; + +-- 初始数据 +INSERT INTO sys_user(id, username, password, real_name, gender, email, mobile, status, dept_id, super_admin, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'admin', '$2a$10$012Kx2ba5jzqr9gLlG4MX.bnQJTD9UWqF57XDo2N3.fPtLne02u/m', '管理员', 0, 'root@renren.io', '13612345678', 1, null, 1, 1067246875800000001, now(), 1067246875800000001, now()); + +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000002, 0, '权限管理', NULL, NULL, 0, 'icon-safetycertificate', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000003, 1067246875800000055, '新增', NULL, 'sys:user:save,sys:dept:list,sys:role:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000004, 1067246875800000055, '修改', NULL, 'sys:user:update,sys:dept:list,sys:role:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000005, 1067246875800000055, '删除', NULL, 'sys:user:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000006, 1067246875800000055, '导出', NULL, 'sys:user:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000007, 1067246875800000002, '角色管理', 'sys/role', NULL, 0, 'icon-team', 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000008, 1067246875800000007, '查看', NULL, 'sys:role:page,sys:role:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000009, 1067246875800000007, '新增', NULL, 'sys:role:save,sys:menu:select,sys:dept:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000010, 1067246875800000007, '修改', NULL, 'sys:role:update,sys:menu:select,sys:dept:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000011, 1067246875800000007, '删除', NULL, 'sys:role:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000012, 1067246875800000002, '部门管理', 'sys/dept', NULL, 0, 'icon-apartment', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000014, 1067246875800000012, '查看', NULL, 'sys:dept:list,sys:dept:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000015, 1067246875800000012, '新增', NULL, 'sys:dept:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000016, 1067246875800000012, '修改', NULL, 'sys:dept:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000017, 1067246875800000012, '删除', NULL, 'sys:dept:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000025, 1067246875800000035, '菜单管理', 'sys/menu', NULL, 0, 'icon-unorderedlist', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000026, 1067246875800000025, '查看', NULL, 'sys:menu:list,sys:menu:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000027, 1067246875800000025, '新增', NULL, 'sys:menu:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000028, 1067246875800000025, '修改', NULL, 'sys:menu:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000029, 1067246875800000025, '删除', NULL, 'sys:menu:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000030, 1067246875800000035, '定时任务', 'job/schedule', NULL, 0, 'icon-dashboard', 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000031, 1067246875800000030, '查看', NULL, 'sys:schedule:page,sys:schedule:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000032, 1067246875800000030, '新增', NULL, 'sys:schedule:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000033, 1067246875800000030, '修改', NULL, 'sys:schedule:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000034, 1067246875800000030, '删除', NULL, 'sys:schedule:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000035, 0, '系统设置', NULL, NULL, 0, 'icon-setting', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000036, 1067246875800000030, '暂停', NULL, 'sys:schedule:pause', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000037, 1067246875800000030, '恢复', NULL, 'sys:schedule:resume', 1, NULL, 5, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000038, 1067246875800000030, '立即执行', NULL, 'sys:schedule:run', 1, NULL, 6, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000039, 1067246875800000030, '日志列表', NULL, 'sys:schedule:log', 1, NULL, 7, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000040, 1067246875800000035, '参数管理', 'sys/params', '', 0, 'icon-fileprotect', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000041, 1067246875800000035, '字典管理', 'sys/dict-type', NULL, 0, 'icon-golden-fill', 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000042, 1067246875800000041, '查看', NULL, 'sys:dict:page,sys:dict:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000043, 1067246875800000041, '新增', NULL, 'sys:dict:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000044, 1067246875800000041, '修改', NULL, 'sys:dict:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000045, 1067246875800000041, '删除', NULL, 'sys:dict:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000046, 0, '日志管理', NULL, NULL, 0, 'icon-container', 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000047, 1067246875800000035, '文件上传', 'oss/oss', 'sys:oss:all', 0, 'icon-upload', 4, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000048, 1067246875800000046, '登录日志', 'sys/log-login', 'sys:log:login', 0, 'icon-filedone', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000049, 1067246875800000046, '操作日志', 'sys/log-operation', 'sys:log:operation', 0, 'icon-solution', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000050, 1067246875800000046, '异常日志', 'sys/log-error', 'sys:log:error', 0, 'icon-file-exception', 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000051, 1067246875800000053, 'SQL监控', '{{ApiUrl}}/druid/sql.html', NULL, 0, 'icon-database', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000053, 0, '系统监控', NULL, NULL, 0, 'icon-desktop', 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000055, 1067246875800000002, '用户管理', 'sys/user', NULL, 0, 'icon-user', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000056, 1067246875800000055, '查看', NULL, 'sys:user:page,sys:user:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000040, '新增', NULL, 'sys:params:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000040, '导出', NULL, 'sys:params:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000040, '查看', '', 'sys:params:page,sys:params:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000060, 1067246875800000040, '修改', NULL, 'sys:params:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000061, 1067246875800000040, '删除', '', 'sys:params:delete', 1, '', 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1156748733921165314, 1067246875800000053, '接口文档', '{{ApiUrl}}/doc.html', '', 0, 'icon-file-word', 1, 1067246875800000001, now(), 1067246875800000001, now()); + + +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000062, 1067246875800000063, '1067246875800000066,1067246875800000063', '技术部', 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000063, 1067246875800000066, '1067246875800000066', '长沙分公司', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000064, 1067246875800000066, '1067246875800000066', '上海分公司', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000065, 1067246875800000064, '1067246875800000066,1067246875800000064', '市场部', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000066, 0, '0', '人人开源集团', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000067, 1067246875800000064, '1067246875800000066,1067246875800000064', '销售部', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000068, 1067246875800000063, '1067246875800000066,1067246875800000063', '产品部', 1, 1067246875800000001, now(), 1067246875800000001, now()); + +INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1160061077912858625, 'gender', '性别', '', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061112075464705, 1160061077912858625, '男', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061146967879681, 1160061077912858625, '女', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061190127267841, 1160061077912858625, '保密', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1225813644059140097, 'notice_type', '站内通知-类型', '', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814069634195457, 1225813644059140097, '公告', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814107559092225, 1225813644059140097, '会议', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814271879340034, 1225813644059140097, '其他', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now()); + +INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000073, 'CLOUD_STORAGE_CONFIG_KEY', '{"type":1,"qiniuDomain":"http://test.oss.renren.io","qiniuPrefix":"upload","qiniuAccessKey":"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ","qiniuSecretKey":"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV","qiniuBucketName":"renren-oss","aliyunDomain":"","aliyunPrefix":"","aliyunEndPoint":"","aliyunAccessKeyId":"","aliyunAccessKeySecret":"","aliyunBucketName":"","qcloudDomain":"","qcloudPrefix":"","qcloudSecretId":"","qcloudSecretKey":"","qcloudBucketName":""}', '0', '云存储配置信息', 1067246875800000001, now(), 1067246875800000001, now()); + +INSERT INTO schedule_job (id, bean_name, params, cron_expression, status, remark, creator, create_date, updater, update_date) VALUES (1067246875800000076, 'testTask', 'renren', '0 0/30 * * * ?', 0, '有参测试,多个参数使用json', 1067246875800000001, now(), 1067246875800000001, now()); + + +-- quartz自带表结构 +CREATE TABLE QRTZ_JOB_DETAILS( + SCHED_NAME VARCHAR(120) NOT NULL, + JOB_NAME VARCHAR(200) NOT NULL, + JOB_GROUP VARCHAR(200) NOT NULL, + DESCRIPTION VARCHAR(250) NULL, + JOB_CLASS_NAME VARCHAR(250) NOT NULL, + IS_DURABLE VARCHAR(1) NOT NULL, + IS_NONCONCURRENT VARCHAR(1) NOT NULL, + IS_UPDATE_DATA VARCHAR(1) NOT NULL, + REQUESTS_RECOVERY VARCHAR(1) NOT NULL, + JOB_DATA BLOB NULL, + PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_TRIGGERS ( + SCHED_NAME VARCHAR(120) NOT NULL, + TRIGGER_NAME VARCHAR(200) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + JOB_NAME VARCHAR(200) NOT NULL, + JOB_GROUP VARCHAR(200) NOT NULL, + DESCRIPTION VARCHAR(250) NULL, + NEXT_FIRE_TIME BIGINT(13) NULL, + PREV_FIRE_TIME BIGINT(13) NULL, + PRIORITY INTEGER NULL, + TRIGGER_STATE VARCHAR(16) NOT NULL, + TRIGGER_TYPE VARCHAR(8) NOT NULL, + START_TIME BIGINT(13) NOT NULL, + END_TIME BIGINT(13) NULL, + CALENDAR_NAME VARCHAR(200) NULL, + MISFIRE_INSTR SMALLINT(2) NULL, + JOB_DATA BLOB NULL, + PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), + FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP) + REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_SIMPLE_TRIGGERS ( + SCHED_NAME VARCHAR(120) NOT NULL, + TRIGGER_NAME VARCHAR(200) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + REPEAT_COUNT BIGINT(7) NOT NULL, + REPEAT_INTERVAL BIGINT(12) NOT NULL, + TIMES_TRIGGERED BIGINT(10) NOT NULL, + PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), + FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) + REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_CRON_TRIGGERS ( + SCHED_NAME VARCHAR(120) NOT NULL, + TRIGGER_NAME VARCHAR(200) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + CRON_EXPRESSION VARCHAR(120) NOT NULL, + TIME_ZONE_ID VARCHAR(80), + PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), + FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) + REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_SIMPROP_TRIGGERS +( + SCHED_NAME VARCHAR(120) NOT NULL, + TRIGGER_NAME VARCHAR(200) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + STR_PROP_1 VARCHAR(512) NULL, + STR_PROP_2 VARCHAR(512) NULL, + STR_PROP_3 VARCHAR(512) NULL, + INT_PROP_1 INT NULL, + INT_PROP_2 INT NULL, + LONG_PROP_1 BIGINT NULL, + LONG_PROP_2 BIGINT NULL, + DEC_PROP_1 NUMERIC(13,4) NULL, + DEC_PROP_2 NUMERIC(13,4) NULL, + BOOL_PROP_1 VARCHAR(1) NULL, + BOOL_PROP_2 VARCHAR(1) NULL, + PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), + FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) + REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_BLOB_TRIGGERS ( + SCHED_NAME VARCHAR(120) NOT NULL, + TRIGGER_NAME VARCHAR(200) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + BLOB_DATA BLOB NULL, + PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), + INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP), + FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) + REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_CALENDARS ( + SCHED_NAME VARCHAR(120) NOT NULL, + CALENDAR_NAME VARCHAR(200) NOT NULL, + CALENDAR BLOB NOT NULL, + PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( + SCHED_NAME VARCHAR(120) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_FIRED_TRIGGERS ( + SCHED_NAME VARCHAR(120) NOT NULL, + ENTRY_ID VARCHAR(95) NOT NULL, + TRIGGER_NAME VARCHAR(200) NOT NULL, + TRIGGER_GROUP VARCHAR(200) NOT NULL, + INSTANCE_NAME VARCHAR(200) NOT NULL, + FIRED_TIME BIGINT(13) NOT NULL, + SCHED_TIME BIGINT(13) NOT NULL, + PRIORITY INTEGER NOT NULL, + STATE VARCHAR(16) NOT NULL, + JOB_NAME VARCHAR(200) NULL, + JOB_GROUP VARCHAR(200) NULL, + IS_NONCONCURRENT VARCHAR(1) NULL, + REQUESTS_RECOVERY VARCHAR(1) NULL, + PRIMARY KEY (SCHED_NAME,ENTRY_ID)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_SCHEDULER_STATE ( + SCHED_NAME VARCHAR(120) NOT NULL, + INSTANCE_NAME VARCHAR(200) NOT NULL, + LAST_CHECKIN_TIME BIGINT(13) NOT NULL, + CHECKIN_INTERVAL BIGINT(13) NOT NULL, + PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE QRTZ_LOCKS ( + SCHED_NAME VARCHAR(120) NOT NULL, + LOCK_NAME VARCHAR(40) NOT NULL, + PRIMARY KEY (SCHED_NAME,LOCK_NAME)) + ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY); +CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP); + +CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME); +CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); +CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME); +CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME); +CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME); +CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE); + +CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME); +CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY); +CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); +CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); \ No newline at end of file diff --git a/renren-admin/src/test/java/io/renren/DruidFilterConfig.java b/renren-admin/src/test/java/io/renren/DruidFilterConfig.java new file mode 100644 index 0000000..71a6a21 --- /dev/null +++ b/renren-admin/src/test/java/io/renren/DruidFilterConfig.java @@ -0,0 +1,31 @@ +package io.renren; + +import com.alibaba.druid.support.jakarta.StatViewServlet; +import com.alibaba.druid.support.jakarta.WebStatFilter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class DruidFilterConfig { + @Bean + public ServletRegistrationBean druidServlet(){ + ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean( + new StatViewServlet(),"/druid/*" + ); + + servletRegistrationBean.addInitParameter("loginUsername","admin"); + servletRegistrationBean.addInitParameter("loginPassword","123456"); + servletRegistrationBean.addInitParameter("resetEnable","false"); + return servletRegistrationBean; + } + + @Bean + public FilterRegistrationBean filterRegistrationBean(){ + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter()); + filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.bmp,*.css,*.ico,*.ico,*.ttf,/druid/*"); + filterRegistrationBean.addUrlPatterns("/*"); + return filterRegistrationBean; + } +} diff --git a/renren-admin/src/test/java/io/renren/config/MDataSourceConfig.java b/renren-admin/src/test/java/io/renren/config/MDataSourceConfig.java new file mode 100644 index 0000000..83e5c66 --- /dev/null +++ b/renren-admin/src/test/java/io/renren/config/MDataSourceConfig.java @@ -0,0 +1,74 @@ +package io.renren.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; +import io.renren.common.config.MybatisPlusConfig; +import org.apache.ibatis.logging.Log; +import org.apache.ibatis.plugin.Interceptor; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.PlatformTransactionManager; + +@ComponentScan +@Configuration +@MapperScan(basePackages = {"io.renren.modules.sys.dao"},sqlSessionTemplateRef = "msqlTemplate") +public class MDataSourceConfig { + @Value("${mybatis-plus.configuration.log-impl}") + private String logImpl; + + @Bean(name = "base") + @Qualifier("base") + @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.base") + public DruidDataSource druidDataSource(){ + return DruidDataSourceBuilder.create().build(); + } + + @Bean(name = "msqlFactory") + public SqlSessionFactory sqlSessionFactory(@Qualifier("base") DruidDataSource dataSource, MybatisPlusConfig mybatisPlusConfig) throws Exception { + MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); + MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); + mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + MybatisConfiguration mybatisConfiguration = new MybatisConfiguration(); + mybatisConfiguration.setMapUnderscoreToCamelCase(true); + mybatisConfiguration.setLogImpl((Class) Class.forName(logImpl)); + + factoryBean.setDataSource(dataSource); + factoryBean.setConfiguration(mybatisConfiguration); + + factoryBean.setPlugins(new Interceptor[]{mybatisPlusInterceptor}); + ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); + factoryBean.setMapperLocations(resolver.getResources("classpath*:mapper/busi/*.xml")); + return factoryBean.getObject(); + } + + @Bean(name = "msqlTemplate") + public SqlSessionTemplate sqlSessionTemplate(@Qualifier("msqlFactory") SqlSessionFactory sqlSessionFactory) { + return new SqlSessionTemplate(sqlSessionFactory); + } + + @Bean(name = "mTransactionManager") + public PlatformTransactionManager mtxManager(@Qualifier("base") DruidDataSource dataSource){ + return new DataSourceTransactionManager(dataSource); + } + + @Bean("baseNamedParameterJdbcTempate") + public NamedParameterJdbcTemplate namedParameterJdbcTemplate(@Qualifier("base") DruidDataSource dataSource) { + return new NamedParameterJdbcTemplate(dataSource); + } +} diff --git a/renren-admin/src/test/java/io/renren/config/SDataSourceConfig.java b/renren-admin/src/test/java/io/renren/config/SDataSourceConfig.java new file mode 100644 index 0000000..60caa17 --- /dev/null +++ b/renren-admin/src/test/java/io/renren/config/SDataSourceConfig.java @@ -0,0 +1,70 @@ +package io.renren.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; +import io.renren.common.config.MybatisPlusConfig; +import org.apache.ibatis.logging.Log; +import org.apache.ibatis.plugin.Interceptor; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.jdbc.core.JdbcTemplate; + +@ComponentScan +@Configuration +@MapperScan(basePackages = {"io.renren.modules.log.dao"},sqlSessionTemplateRef = "ssqlTemplate") +public class SDataSourceConfig { + @Value("${mybatis-plus.configuration.log-impl}") + private String logImpl; + + @Bean(name = "ch") + @Qualifier("ch") + @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.clickhouse") + public DruidDataSource druidDataSource(){ + return DruidDataSourceBuilder.create().build(); + } + + @Bean(name = "ssqlFactory") + public SqlSessionFactory sqlSessionFactory(@Qualifier("ch") DruidDataSource dataSource, MybatisPlusConfig mybatisPlusConfig) throws Exception { + MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); + MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); + mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + MybatisConfiguration mybatisConfiguration = new MybatisConfiguration(); + mybatisConfiguration.setMapUnderscoreToCamelCase(true); + mybatisConfiguration.setLogImpl((Class) Class.forName(logImpl)); + + factoryBean.setDataSource(dataSource); + factoryBean.setConfiguration(mybatisConfiguration); + + factoryBean.setPlugins(new Interceptor[]{mybatisPlusInterceptor}); + ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); + factoryBean.setMapperLocations(resolver.getResources("classpath*:mapper/ch/*.xml")); + return factoryBean.getObject(); + } + + @Bean(name = "ssqlTemplate") + public SqlSessionTemplate sqlSessionTemplate(@Qualifier("ssqlFactory") SqlSessionFactory sqlSessionFactory) { + return new SqlSessionTemplate(sqlSessionFactory); + } + + + @Bean("chJdbcTemplate") + public JdbcTemplate chJdbcTemplate() { + JdbcTemplate template = new JdbcTemplate(); + template.setDataSource(druidDataSource()); + return template; + } +} diff --git a/renren-admin/src/test/resources/multi-ds.yml b/renren-admin/src/test/resources/multi-ds.yml new file mode 100644 index 0000000..289ad57 --- /dev/null +++ b/renren-admin/src/test/resources/multi-ds.yml @@ -0,0 +1,73 @@ +spring: + datasource: + dynamic: + datasource: + # 基础库数据源配置 + base: + url: jdbc:oracle:thin:@10.10.84.99:1521/orcl + username: aa + password: bb + driver-class-name: oracle.jdbc.driver.OracleDriver + initial-size: 30 + max-active: 200 + min-idle: 30 + max-wait: 60000 + stat-view-servlet: + allow: true + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 30 + filters: stat + connection-properties: druid.stat.mergeSql:true;druid.stat.slowSql.millis:2000 + keep-alive: true + use-global-data-source-stat: true + # 阅报库数据源配置 + clickhouse: + url: jdbc:clickhouse://10.10.84.2:8123/default?socket_timeout=60000 + #?ssl=true&sslmode=none + username: aa + password: bb + driver-class-name: ru.yandex.clickhouse.ClickHouseDriver + initial-size: 30 + max-active: 200 + min-idle: 30 + max-wait: 60000 + # SQL监控配置 + druid: + stat-view-servlet: + #开关 + enabled: true + #识别路径 + url-pattern: /druid/* + login-username: admin + login-password: admin + reset-enable: true + #允许访问的IP地址,空 不限制 + allow: + web-stat-filter: + url-pattern: /* + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" + filter: + stat: + log-slow-sql: true + slow-sql-millis: 2000 + merge-sql: true + wall: + config: + multi-statement-allow: true + autoconfigure: + # 去除druid配置。是否需要,根据druid连接池的类型。如果druid连接池为starter类型,则需要排除。否则,不需要 + exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure + # Redis配置 + redis: + database: 0 + host: 192.192.184.222 + port: 6379 + password: thinker + timeout: 6000 + max-wait: -1 + max-active: 8 + max-idle: 8 + +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.slf4j.Slf4jLoggerImpl \ No newline at end of file diff --git a/renren-api/pom.xml b/renren-api/pom.xml index ddb5ac8..f6e1b13 100644 --- a/renren-api/pom.xml +++ b/renren-api/pom.xml @@ -1,41 +1,51 @@ - - - io.renren - renren-security - 5.5.0 - - 4.0.0 - renren-api - jar - renren-api + + + io.renren + renren-security + 5.5.0 + + 4.0.0 + renren-api + jar + renren-api - - - io.renren - renren-common - 5.5.0 - - - io.renren - renren-dynamic-datasource - 5.5.0 - - + + + io.renren + renren-common + 5.5.0 + + + io.renren + renren-dynamic-datasource + 5.5.0 + + + org.springframework.boot + spring-boot-starter-restclient + + + com.h2database + h2 + 2.3.232 + + - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + diff --git a/renren-api/src/main/java/io/renren/client/AlbumsClient.java b/renren-api/src/main/java/io/renren/client/AlbumsClient.java new file mode 100644 index 0000000..0414ccf --- /dev/null +++ b/renren-api/src/main/java/io/renren/client/AlbumsClient.java @@ -0,0 +1,32 @@ +package io.renren.client; + +import io.renren.dto.AlbumsReq; +import io.renren.dto.AlbumsResp; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.service.annotation.GetExchange; +import org.springframework.web.service.annotation.HttpExchange; +import org.springframework.web.service.annotation.PostExchange; + +import java.util.List; + +/** + * 在此处添加备注信息 + * + * @author YourBatman + * @since 0.0.1 + */ +@HttpExchange("/albums") +public interface AlbumsClient { + + @GetExchange + List getAll(); + + @GetExchange("/{id}") + AlbumsResp getById(@PathVariable Long id); + + @PostExchange + AlbumsResp add(@RequestBody @Valid AlbumsReq req); + +} diff --git a/renren-api/src/main/java/io/renren/config/APIVersionConfig.java b/renren-api/src/main/java/io/renren/config/APIVersionConfig.java new file mode 100644 index 0000000..eb34ba2 --- /dev/null +++ b/renren-api/src/main/java/io/renren/config/APIVersionConfig.java @@ -0,0 +1,31 @@ +package io.renren.config; + +import com.google.common.collect.Lists; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ApiVersionConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +@Configuration +public class APIVersionConfig implements WebMvcConfigurer { + private final List versions = Lists.newArrayList("1","2"); + + @Override + public void configureApiVersioning(ApiVersionConfigurer configurer) { + configurer.useQueryParam("version").setDefaultVersion("1"); + //TODO 版本格式要求类似于1.0.0 +// .setSupportedVersionPredicate(version->{ +// return versions.contains(version); +// }); + + configurer.useRequestHeader("version"); + + configurer.useRequestHeader("X-Version"); + + //Add resolver to extract the version from a path segment. + //Params: + //index – the index of the path segment to check; + // e.g. for URL's like "/{version}/..." use index 0, for "/api/{version}/..." index 1. + } +} diff --git a/renren-api/src/main/java/io/renren/config/RestClientConfig.java b/renren-api/src/main/java/io/renren/config/RestClientConfig.java new file mode 100644 index 0000000..ad8d39a --- /dev/null +++ b/renren-api/src/main/java/io/renren/config/RestClientConfig.java @@ -0,0 +1,18 @@ +package io.renren.config; + +import io.renren.client.AlbumsClient; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.support.RestClientAdapter; +import org.springframework.web.service.invoker.HttpServiceProxyFactory; + +@Configuration(proxyBeanMethods = false) +public class RestClientConfig { + @Bean + public AlbumsClient albumsClient(RestClient.Builder restClientBuilder) { + RestClient restClient = restClientBuilder.baseUrl("https://jsonplaceholder.typicode.com").build(); + return HttpServiceProxyFactory.builderFor(RestClientAdapter.create(restClient)) + .build().createClient(AlbumsClient.class); + } +} diff --git a/renren-api/src/main/java/io/renren/controller/APIVersionController.java b/renren-api/src/main/java/io/renren/controller/APIVersionController.java new file mode 100644 index 0000000..b57b1f2 --- /dev/null +++ b/renren-api/src/main/java/io/renren/controller/APIVersionController.java @@ -0,0 +1,31 @@ +package io.renren.controller; + +import io.renren.common.utils.Result; +import io.renren.entity.UserEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api") +public class APIVersionController { + + @GetMapping(value = "/user", version = "1") + public Result getUserV1() { + UserEntity user = new UserEntity(); + user.setId(1L); + user.setMobile("13856323128"); + user.setUsername("张三-1"); + return new Result().ok(user); + } + + @GetMapping(value = "/user",version="2") + public Result getUserV2() { + UserEntity user = new UserEntity(); + user.setId(1L); + user.setMobile("13856323128"); + user.setUsername("张三-2"); + return new Result().ok(user); + } + +} diff --git a/renren-api/src/main/java/io/renren/controller/ApiLoginController.java b/renren-api/src/main/java/io/renren/controller/ApiLoginController.java index 14df755..458c25f 100644 --- a/renren-api/src/main/java/io/renren/controller/ApiLoginController.java +++ b/renren-api/src/main/java/io/renren/controller/ApiLoginController.java @@ -8,7 +8,6 @@ package io.renren.controller; - import io.renren.annotation.Login; import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; @@ -36,7 +35,6 @@ public class ApiLoginController { private final UserService userService; private final TokenService tokenService; - @PostMapping("login") @Operation(summary = "登录") public Result> login(@RequestBody LoginDTO dto) { diff --git a/renren-api/src/main/java/io/renren/dto/AlbumsReq.java b/renren-api/src/main/java/io/renren/dto/AlbumsReq.java new file mode 100644 index 0000000..beb665e --- /dev/null +++ b/renren-api/src/main/java/io/renren/dto/AlbumsReq.java @@ -0,0 +1,19 @@ +package io.renren.dto; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Builder; +import lombok.Getter; + +@Builder +@Getter +public class AlbumsReq { + + @NotNull + @Positive + private Long userId; + @NotBlank + private String title; + +} \ No newline at end of file diff --git a/renren-api/src/main/java/io/renren/dto/AlbumsResp.java b/renren-api/src/main/java/io/renren/dto/AlbumsResp.java new file mode 100644 index 0000000..9da9fd1 --- /dev/null +++ b/renren-api/src/main/java/io/renren/dto/AlbumsResp.java @@ -0,0 +1,14 @@ +package io.renren.dto; + +import lombok.Setter; +import lombok.ToString; + +@Setter +@ToString +public class AlbumsResp { + + private Long id; + private Long userId; + private String title; + +} diff --git a/renren-api/src/main/resources/application-dev.yml b/renren-api/src/main/resources/application-dev.yml index fa43e6c..f5e1f38 100644 --- a/renren-api/src/main/resources/application-dev.yml +++ b/renren-api/src/main/resources/application-dev.yml @@ -1,10 +1,17 @@ spring: datasource: druid: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - username: renren - password: 123456 + # mysql + # driver-class-name: com.mysql.cj.jdbc.Driver + # url: jdbc:mysql://localhost:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true + # username: renren + # password: 123456 + # H2 + driver-class-name: org.h2.Driver + url: jdbc:h2:mem:testdb + username: sa + password: admin + initial-size: 10 max-active: 100 min-idle: 10 @@ -31,3 +38,4 @@ spring: wall: config: multi-statement-allow: true + diff --git a/renren-api/src/main/resources/application.yml b/renren-api/src/main/resources/application.yml index 02fbf50..6fcef7b 100644 --- a/renren-api/src/main/resources/application.yml +++ b/renren-api/src/main/resources/application.yml @@ -13,7 +13,7 @@ server: http-only: true knife4j: - enable: true + enable: false basic: enable: false username: admin @@ -23,6 +23,9 @@ knife4j: spring: # 环境 dev|test|prod + threads: + virtual: + enabled: true profiles: active: dev messages: @@ -54,6 +57,9 @@ spring: max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) max-idle: 10 # 连接池中的最大空闲连接 min-idle: 5 # 连接池中的最小空闲连接 + sql: + init: + schema-locations: classpath*:h2.sql renren: redis: @@ -81,3 +87,4 @@ mybatis-plus: prefix: blobType: BLOB boolValue: TRUE + diff --git a/renren-api/src/main/resources/h2.sql b/renren-api/src/main/resources/h2.sql new file mode 100644 index 0000000..23b3995 --- /dev/null +++ b/renren-api/src/main/resources/h2.sql @@ -0,0 +1,25 @@ +-- 用户表 +CREATE TABLE tb_user ( + id BIGINT NOT NULL, + username VARCHAR(50) NOT NULL, + mobile VARCHAR(20) NOT NULL, + password VARCHAR(64), + create_date TIMESTAMP, + PRIMARY KEY (id), + CONSTRAINT uk_user_name UNIQUE (username) +); + +-- 用户Token表 +CREATE TABLE tb_token ( + id BIGINT NOT NULL, + user_id BIGINT NOT NULL, + token VARCHAR(100) NOT NULL, + expire_date TIMESTAMP, + update_date TIMESTAMP, + PRIMARY KEY (id), + CONSTRAINT uk_user_id UNIQUE (user_id), + CONSTRAINT uk_token UNIQUE (token) +); + +-- 账号:13612345678 密码:admin +INSERT INTO tb_user (id, username, mobile, password, create_date) VALUES (1067246875900000001, 'mark', '13612345678', '8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918', now()); diff --git a/renren-api/src/test/java/io/renren/test/BeanRegistarTest.java b/renren-api/src/test/java/io/renren/test/BeanRegistarTest.java new file mode 100644 index 0000000..68f66ac --- /dev/null +++ b/renren-api/src/test/java/io/renren/test/BeanRegistarTest.java @@ -0,0 +1,23 @@ +package io.renren.test; + +import io.renren.test.config.Order; +import io.renren.test.config.User; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class BeanRegistarTest { + @Autowired + User user; + + @Autowired + Order order; + + @Test + public void test(){ + user.setName("张三"); + System.out.println(user.getName()); + System.out.println(order.getName()); + } +} diff --git a/renren-api/src/test/java/io/renren/test/HttpExchangeTest.java b/renren-api/src/test/java/io/renren/test/HttpExchangeTest.java new file mode 100644 index 0000000..be4cf5a --- /dev/null +++ b/renren-api/src/test/java/io/renren/test/HttpExchangeTest.java @@ -0,0 +1,24 @@ +package io.renren.test; + +import io.renren.client.AlbumsClient; +import io.renren.dto.AlbumsReq; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class HttpExchangeTest { + @Autowired + private AlbumsClient albumsClient; + + @Test + void contextLoads() { + System.out.println("getAll size:" + albumsClient.getAll().size()); + + System.out.println("getById 1:" + albumsClient.getById(1L)); + + // 创建一个 + Object addedResp = albumsClient.add(AlbumsReq.builder().userId(1L).title("diy add...").build()); + System.out.println("创建的allAlbums对象为:" + addedResp + ",现在总数为:" + albumsClient.getAll().size()); + } +} diff --git a/renren-api/src/test/java/io/renren/test/config/BeanRegisterConfig.java b/renren-api/src/test/java/io/renren/test/config/BeanRegisterConfig.java new file mode 100644 index 0000000..908b999 --- /dev/null +++ b/renren-api/src/test/java/io/renren/test/config/BeanRegisterConfig.java @@ -0,0 +1,9 @@ +package io.renren.test.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import(MyBeansRegistrar.class) +public class BeanRegisterConfig { +} \ No newline at end of file diff --git a/renren-api/src/test/java/io/renren/test/config/MyBeansRegistrar.java b/renren-api/src/test/java/io/renren/test/config/MyBeansRegistrar.java new file mode 100644 index 0000000..3e1d536 --- /dev/null +++ b/renren-api/src/test/java/io/renren/test/config/MyBeansRegistrar.java @@ -0,0 +1,18 @@ +package io.renren.test.config; + +import org.springframework.beans.factory.BeanRegistrar; +import org.springframework.beans.factory.BeanRegistry; +import org.springframework.core.env.Environment; + +public class MyBeansRegistrar implements BeanRegistrar { + + @Override + public void register(BeanRegistry registry, + Environment env) { + registry.registerBean("user", User.class); + if (env.matchesProfiles("dev")) { + registry.registerBean(Order.class, spec -> spec + .supplier(context -> new Order("order_001"))); + } + } +} diff --git a/renren-api/src/test/java/io/renren/test/config/Order.java b/renren-api/src/test/java/io/renren/test/config/Order.java new file mode 100644 index 0000000..5cc5067 --- /dev/null +++ b/renren-api/src/test/java/io/renren/test/config/Order.java @@ -0,0 +1,12 @@ +package io.renren.test.config; + +import lombok.Data; + +@Data +public class Order { + public Order(String name) { + this.name = name; + } + + private String name; +} \ No newline at end of file diff --git a/renren-api/src/test/java/io/renren/test/config/User.java b/renren-api/src/test/java/io/renren/test/config/User.java new file mode 100644 index 0000000..6562595 --- /dev/null +++ b/renren-api/src/test/java/io/renren/test/config/User.java @@ -0,0 +1,18 @@ +package io.renren.test.config; + +import lombok.Data; +import lombok.NonNull; +import org.jspecify.annotations.Nullable; + +@Data +public class User { + public @Nullable String getName() { + return name; + } + + public void setName(@NonNull String name) { + this.name = name; + } + + private String name; +} diff --git a/renren-common/pom.xml b/renren-common/pom.xml index 5545198..745e2d9 100644 --- a/renren-common/pom.xml +++ b/renren-common/pom.xml @@ -9,6 +9,14 @@ jar renren-common + + + com.google.guava + guava + 33.4.6-jre + + + ${project.artifactId} diff --git a/renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceAutoConfigure.java b/renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceAutoConfigure.java new file mode 100644 index 0000000..9925c33 --- /dev/null +++ b/renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceAutoConfigure.java @@ -0,0 +1,71 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.spring.boot3.autoconfigure; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties; +import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidFilterConfiguration; +import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidSpringAopConfiguration; +import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidStatViewServletConfiguration; +import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidWebStatFilterConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration; +import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +import javax.sql.DataSource; + +/** + * @author lihengming [89921218@qq.com] + */ +@Configuration +@ConditionalOnProperty(name = "spring.datasource.type", + havingValue = "com.alibaba.druid.pool.DruidDataSource", + matchIfMissing = true) +@ConditionalOnClass(DruidDataSource.class) +@AutoConfigureBefore(DataSourceAutoConfiguration.class) +@EnableConfigurationProperties({DruidStatProperties.class, DataSourceProperties.class}) +@Import({DruidSpringAopConfiguration.class, + DruidStatViewServletConfiguration.class, + DruidWebStatFilterConfiguration.class, + DruidFilterConfiguration.class}) +public class DruidDataSourceAutoConfigure { + private static final Logger LOGGER = LoggerFactory.getLogger(DruidDataSourceAutoConfigure.class); + + /** + * Not setting initMethod of annotation {@code @Bean} is to avoid failure when inspecting + * the bean definition at the build time. The {@link DruidDataSource#init()} will be called + * at the end of {@link DruidDataSourceWrapper#afterPropertiesSet()}. + * + * @return druid data source wrapper + */ + @Bean + @ConditionalOnMissingBean({DruidDataSourceWrapper.class, + DruidDataSource.class, + DataSource.class}) + public DruidDataSourceWrapper dataSource() { + LOGGER.info("Init DruidDataSource"); + return new DruidDataSourceWrapper(); + } +} diff --git a/renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java b/renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java new file mode 100644 index 0000000..94dce49 --- /dev/null +++ b/renren-common/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java @@ -0,0 +1,75 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.spring.boot3.autoconfigure; + +import com.alibaba.druid.filter.Filter; +import com.alibaba.druid.pool.DruidDataSource; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.List; + +/** + * @author lihengming [89921218@qq.com] + */ +@ConfigurationProperties("spring.datasource.druid") +public class DruidDataSourceWrapper extends DruidDataSource implements InitializingBean { + @Autowired + private DataSourceProperties basicProperties; + + @Override + public void afterPropertiesSet() throws Exception { + //if not found prefix 'spring.datasource.druid' jdbc properties ,'spring.datasource' prefix jdbc properties will be used. + if (super.getUsername() == null) { + super.setUsername(basicProperties.determineUsername()); + } + if (super.getPassword() == null) { + super.setPassword(basicProperties.determinePassword()); + } + if (super.getUrl() == null) { + super.setUrl(basicProperties.determineUrl()); + } + if (super.getDriverClassName() == null) { + super.setDriverClassName(basicProperties.getDriverClassName()); + } + + init(); + } + + @Autowired(required = false) + public void autoAddFilters(List filters) { + super.filters.addAll(filters); + } + + /** + * Ignore the 'maxEvictableIdleTimeMillis < minEvictableIdleTimeMillis' validate, + * it will be validated again in {@link DruidDataSource#init()}. + *

+ * for fix issue #3084, #2763 + * + * @since 1.1.14 + */ + @Override + public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) { + try { + super.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); + } catch (IllegalArgumentException ignore) { + super.maxEvictableIdleTimeMillis = maxEvictableIdleTimeMillis; + } + } +} diff --git "a/\344\277\256\346\224\271.md" "b/\344\277\256\346\224\271.md" new file mode 100644 index 0000000..83821c2 --- /dev/null +++ "b/\344\277\256\346\224\271.md" @@ -0,0 +1,27 @@ + + +# maven依赖调整 + +# 如何运行renren-ui +- cd D:/code/renren-security/renren-ui +- npm install +- npm run dev +- npm root -g + +# renren-api api doc +http://localhost:8081/renren-api/doc.html +http://localhost:8081/renren-api/v3/api-docs +http://localhost:8081/renren-api/swagger-ui/index.html + + +# renren-admin api doc +http://localhost:8080/renren-admin/doc.html +http://localhost:8080/renren-admin/v3/api-docs +http://localhost:8080/renren-admin/swagger-ui/index.html + +http://localhost:8080/renren-admin/druid/index.html + + +# ref + +https://www.xlabs.club/blog/migration-spring-boot-3-to-4/ -- Gitee From b45ae0179c41e795bb730f03fc07962680b0ac28 Mon Sep 17 00:00:00 2001 From: gitriver Date: Tue, 23 Dec 2025 21:00:30 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=87=B36.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- renren-admin/pom.xml | 6 +++--- renren-api/pom.xml | 6 +++--- renren-common/pom.xml | 2 +- renren-dynamic-datasource/pom.xml | 2 +- renren-generator/pom.xml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 6cfb082..37160ee 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.renren renren-security - 5.5.0 + 6.0.0 pom renren-security diff --git a/renren-admin/pom.xml b/renren-admin/pom.xml index bdd40fe..a6bcfe0 100644 --- a/renren-admin/pom.xml +++ b/renren-admin/pom.xml @@ -2,7 +2,7 @@ io.renren renren-security - 5.5.0 + 6.0.0 4.0.0 renren-admin @@ -24,12 +24,12 @@ io.renren renren-common - 5.5.0 + ${project.version} io.renren renren-dynamic-datasource - 5.5.0 + ${project.version} com.h2database diff --git a/renren-api/pom.xml b/renren-api/pom.xml index f6e1b13..fe6fc81 100644 --- a/renren-api/pom.xml +++ b/renren-api/pom.xml @@ -3,7 +3,7 @@ io.renren renren-security - 5.5.0 + 6.0.0 4.0.0 renren-api @@ -14,12 +14,12 @@ io.renren renren-common - 5.5.0 + ${project.version} io.renren renren-dynamic-datasource - 5.5.0 + ${project.version} org.springframework.boot diff --git a/renren-common/pom.xml b/renren-common/pom.xml index 745e2d9..d8341c0 100644 --- a/renren-common/pom.xml +++ b/renren-common/pom.xml @@ -2,7 +2,7 @@ io.renren renren-security - 5.5.0 + 6.0.0 4.0.0 renren-common diff --git a/renren-dynamic-datasource/pom.xml b/renren-dynamic-datasource/pom.xml index 463a9f0..acc9cee 100644 --- a/renren-dynamic-datasource/pom.xml +++ b/renren-dynamic-datasource/pom.xml @@ -2,7 +2,7 @@ io.renren renren-security - 5.5.0 + 6.0.0 4.0.0 renren-dynamic-datasource diff --git a/renren-generator/pom.xml b/renren-generator/pom.xml index cd0e5c1..6ea7e13 100644 --- a/renren-generator/pom.xml +++ b/renren-generator/pom.xml @@ -9,7 +9,7 @@ io.renren renren-security - 5.5.0 + 6.0.0 -- Gitee From ef38c1f9a323dc60fedf745d446c5b4731abd935 Mon Sep 17 00:00:00 2001 From: gitriver Date: Tue, 23 Dec 2025 21:42:36 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=9C=A8README.md=E4=B8=AD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BF=AE=E6=94=B9=E4=BA=8B=E9=A1=B9=E6=B8=85=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++++++++++++ pom.xml | 5 ----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c4572a4..107f0e3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,24 @@ +### 修改说明 +- 升级java 版本至21,默认使用25 +- 升级springboot 最新版4.0.0, 参考 [JAVA 21 & Spring Boot 4 学习--迁移指南 Migration Guide](https://cloudcoder.blog.csdn.net/article/details/156134682) +- mybatisplus调整 + - 升级 mybatisplus 3.5.15 【mybatis-plus-spring-boot4-starter】, 因为SpringBoot4 需要 ^3.5.13,详见[mybatis-plus](https://github.com/baomidou/mybatis-plus) + - 增加mybatis-plus-jsqlparser 依赖,因为mybatisplus ^3.5.9 需要单独引用,BlockAttackInnerInterceptor及PaginationInnerInterceptor迁移至此模块 +- Druid调整 + - 因为druid spring starter还未提供针对springboot 4的支持,主要是因为springboot 包结构发生的变化【org.springframework.boot.autoconfigure. -> org.springframework.boot..autoconfigure】,导致编译报错,所以虽然保留了druid-spring-boot-3-starter依赖,但重构了com.alibaba.druid.spring.boot3.autoconfigure下面的2个类 + - druid 版本升级至1.2.27 +- 增加针对H2的支持,并且renren-admin,renren-api中默认使用H2作为数据库启动 +- hutool版本升级至5.8.42 +- springdoc版本升级至2.8.14 +- 在springboot 4下,以下组件需要单独引用 + - spring-boot-starter-quartz + - spring-boot-starter-aop 在springboot 4下调整为spring-boot-starter-aspectj + - spring-boot-starter-jdbc +- 添加了一些针对Springboot 4新特性的测试 + - 优雅 API 版本控制 + - 程序化 Bean 注册(BeanRegistrar) + - 声明式HTTP客户端 HttpExchange + ### 项目说明 - renren-security是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】 - 采用SpringBoot3.x、Shiro、MyBatis-Plus、Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、Vite框架,开发的一套权限系统,极低门槛,拿来即用。设计之初,就非常注重安全性,为企业系统保驾护航,让一切都变得如此简单。 diff --git a/pom.xml b/pom.xml index 37160ee..553363e 100644 --- a/pom.xml +++ b/pom.xml @@ -115,11 +115,6 @@ druid-spring-boot-3-starter ${druid.version} - - com.alibaba - druid - ${druid.version} - com.baomidou mybatis-plus-spring-boot4-starter -- Gitee From 3d2284f3cc0e18fafbdadac01dd0e98706992be7 Mon Sep 17 00:00:00 2001 From: gitriver Date: Tue, 23 Dec 2025 22:22:02 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 68 ++++++++++++++++++++++------------- "\344\277\256\346\224\271.md" | 19 ++++++++-- 2 files changed, 60 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 107f0e3..a9dad88 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,49 @@ -### 修改说明 -- 升级java 版本至21,默认使用25 -- 升级springboot 最新版4.0.0, 参考 [JAVA 21 & Spring Boot 4 学习--迁移指南 Migration Guide](https://cloudcoder.blog.csdn.net/article/details/156134682) -- mybatisplus调整 - - 升级 mybatisplus 3.5.15 【mybatis-plus-spring-boot4-starter】, 因为SpringBoot4 需要 ^3.5.13,详见[mybatis-plus](https://github.com/baomidou/mybatis-plus) - - 增加mybatis-plus-jsqlparser 依赖,因为mybatisplus ^3.5.9 需要单独引用,BlockAttackInnerInterceptor及PaginationInnerInterceptor迁移至此模块 -- Druid调整 - - 因为druid spring starter还未提供针对springboot 4的支持,主要是因为springboot 包结构发生的变化【org.springframework.boot.autoconfigure. -> org.springframework.boot..autoconfigure】,导致编译报错,所以虽然保留了druid-spring-boot-3-starter依赖,但重构了com.alibaba.druid.spring.boot3.autoconfigure下面的2个类 - - druid 版本升级至1.2.27 -- 增加针对H2的支持,并且renren-admin,renren-api中默认使用H2作为数据库启动 -- hutool版本升级至5.8.42 -- springdoc版本升级至2.8.14 -- 在springboot 4下,以下组件需要单独引用 - - spring-boot-starter-quartz - - spring-boot-starter-aop 在springboot 4下调整为spring-boot-starter-aspectj - - spring-boot-starter-jdbc -- 添加了一些针对Springboot 4新特性的测试 - - 优雅 API 版本控制 - - 程序化 Bean 注册(BeanRegistrar) - - 声明式HTTP客户端 HttpExchange - -### 项目说明 +**📕 Table of Contents** +- 💡 [What is RAGFlow?](#-项目说明) +- 🎮 [Demo](#-演示地址) +- 📌 [Latest Updates](#-latest-updates) +- 📜[Roadmap](#-roadmap) +- 🏄 [Community](#-community) +- 🙌 [Contributing](#-contributing) + +### 🔥 Latest Updates +- 2025-12-23 + - 升级java 版本至21,默认使用25 + - 升级springboot 最新版4.0.0, 参考 [JAVA 21 & Spring Boot 4 学习--迁移指南 Migration Guide](https://cloudcoder.blog.csdn.net/article/details/156134682) + - mybatisplus调整 + - 升级 mybatisplus 3.5.15 【mybatis-plus-spring-boot4-starter】, 因为SpringBoot4 需要 ^3.5.13,详见[mybatis-plus](https://github.com/baomidou/mybatis-plus) + - 增加mybatis-plus-jsqlparser 依赖,因为mybatisplus ^3.5.9 需要单独引用,BlockAttackInnerInterceptor及PaginationInnerInterceptor迁移至此模块 + - Druid调整 + - 因为druid spring starter还未提供针对springboot 4的支持,主要是因为springboot 包结构发生的变化【org.springframework.boot.autoconfigure. -> org.springframework.boot..autoconfigure】,导致编译报错,所以虽然保留了druid-spring-boot-3-starter依赖,但重构了com.alibaba.druid.spring.boot3.autoconfigure下面的2个类 + - druid 版本升级至1.2.27 + - 增加针对H2的支持,并且renren-admin,renren-api中默认使用H2作为数据库启动 + - hutool版本升级至5.8.42 + - springdoc版本升级至2.8.14 + - 在springboot 4下,以下组件需要单独引用 + - spring-boot-starter-quartz + - spring-boot-starter-aop 在springboot 4下调整为spring-boot-starter-aspectj + - spring-boot-starter-jdbc + - 添加了一些针对Springboot 4新特性的测试 + - 优雅 API 版本控制 + - 程序化 Bean 注册(BeanRegistrar) + - 声明式HTTP客户端 HttpExchange + +### 📚 项目说明 - renren-security是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】 - 采用SpringBoot3.x、Shiro、MyBatis-Plus、Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、Vite框架,开发的一套权限系统,极低门槛,拿来即用。设计之初,就非常注重安全性,为企业系统保驾护航,让一切都变得如此简单。 - 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务 - 支持MySQL、达梦、Oracle、SQL Server、PostgreSQL等主流数据库 + +### 演示地址 - 演示地址:http://demo.open.renren.io/renren-security (账号密码:admin/admin) +### 📜 Roadmap + +See the [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214) +
-### 微信交流群 +### 🏄 微信交流群 我们提供了微信交流群,扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群!

![输入图片说明](renren-admin/src/main/resources/public/wechat.jpg) @@ -137,7 +152,8 @@ renren-security
-### 如何交流、反馈、参与贡献? +### 🏄 Community + - 开发文档:https://www.renren.io/guide/security - Gitee仓库:https://gitee.com/renrenio/renren-security - GitCode仓库:https://gitcode.com/renrenio/renren-security @@ -145,3 +161,7 @@ renren-security - 如需关注项目最新动态,请Watch、Star项目,同时也是对项目最好的支持
+### 🙌 Contributing +renren-security flourishes via open-source collaboration. In this spirit, we embrace diverse contributions from the community. + + diff --git "a/\344\277\256\346\224\271.md" "b/\344\277\256\346\224\271.md" index 83821c2..42e9472 100644 --- "a/\344\277\256\346\224\271.md" +++ "b/\344\277\256\346\224\271.md" @@ -1,7 +1,20 @@ - - # maven依赖调整 - +- 升级java 版本至21,默认使用25 +- 升级springboot 最新版4.0.0, 参考 [JAVA 21 & Spring Boot 4 学习--迁移指南 Migration Guide](https://cloudcoder.blog.csdn.net/article/details/156134682) +- mybatisplus调整 + - 升级 mybatisplus 3.5.15 【mybatis-plus-spring-boot4-starter】, 因为SpringBoot4 需要 ^3.5.13,详见[mybatis-plus](https://github.com/baomidou/mybatis-plus) + - 增加mybatis-plus-jsqlparser 依赖,因为mybatisplus ^3.5.9 需要单独引用,BlockAttackInnerInterceptor及PaginationInnerInterceptor迁移至此模块 +- Druid调整 + - 因为druid spring starter还未提供针对springboot 4的支持,主要是因为springboot 包结构发生的变化【org.springframework.boot.autoconfigure. -> org.springframework.boot..autoconfigure】,导致编译报错,所以虽然保留了druid-spring-boot-3-starter依赖,但重构了com.alibaba.druid.spring.boot3.autoconfigure下面的2个类 + - druid 版本升级至1.2.27 +- 增加针对H2的支持,并且renren-admin,renren-api中默认使用H2作为数据库启动 +- hutool版本升级至5.8.42 +- springdoc版本升级至2.8.14 +- 在springboot 4下,以下组件需要单独引用 + - spring-boot-starter-quartz + - spring-boot-starter-aop 在springboot 4下调整为spring-boot-starter-aspectj + - spring-boot-starter-jdbc + # 如何运行renren-ui - cd D:/code/renren-security/renren-ui - npm install -- Gitee From 2763be80d64a8f18e134e93d79d1bdacccf386e0 Mon Sep 17 00:00:00 2001 From: gitriver Date: Tue, 23 Dec 2025 22:26:33 +0800 Subject: [PATCH 5/7] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a9dad88..c2b9faf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ **📕 Table of Contents** -- 💡 [What is RAGFlow?](#-项目说明) -- 🎮 [Demo](#-演示地址) +- 💡 [What is renren-security?](#-项目说明) - 📌 [Latest Updates](#-latest-updates) - 📜[Roadmap](#-roadmap) - 🏄 [Community](#-community) @@ -34,7 +33,7 @@ - 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务 - 支持MySQL、达梦、Oracle、SQL Server、PostgreSQL等主流数据库 -### 演示地址 +### 🎮 演示地址 - 演示地址:http://demo.open.renren.io/renren-security (账号密码:admin/admin) ### 📜 Roadmap -- Gitee From f72eac6fa4fcd0f78ba3f54a5e013c98fb5138b3 Mon Sep 17 00:00:00 2001 From: gitriver Date: Tue, 23 Dec 2025 22:29:39 +0800 Subject: [PATCH 6/7] Update README.md --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index c2b9faf..2966c14 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ - 🏄 [Community](#-community) - 🙌 [Contributing](#-contributing) +### 📚 项目说明 +- renren-security是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】 +- 采用SpringBoot3.x、Shiro、MyBatis-Plus、Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、Vite框架,开发的一套权限系统,极低门槛,拿来即用。设计之初,就非常注重安全性,为企业系统保驾护航,让一切都变得如此简单。 +- 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务 +- 支持MySQL、达梦、Oracle、SQL Server、PostgreSQL等主流数据库 + ### 🔥 Latest Updates - 2025-12-23 - 升级java 版本至21,默认使用25 @@ -27,12 +33,6 @@ - 程序化 Bean 注册(BeanRegistrar) - 声明式HTTP客户端 HttpExchange -### 📚 项目说明 -- renren-security是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】 -- 采用SpringBoot3.x、Shiro、MyBatis-Plus、Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、Vite框架,开发的一套权限系统,极低门槛,拿来即用。设计之初,就非常注重安全性,为企业系统保驾护航,让一切都变得如此简单。 -- 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务 -- 支持MySQL、达梦、Oracle、SQL Server、PostgreSQL等主流数据库 - ### 🎮 演示地址 - 演示地址:http://demo.open.renren.io/renren-security (账号密码:admin/admin) @@ -42,14 +42,8 @@ See the [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214
-### 🏄 微信交流群 -我们提供了微信交流群,扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群! -

-![输入图片说明](renren-admin/src/main/resources/public/wechat.jpg) - -
- -### 具有如下特点 +### 架构设计 +#### 架构特点 - 友好的代码结构及注释,便于阅读及二次开发 - 实现前后端分离,通过token进行数据交互,前端再也不用关注后端技术 - 灵活的权限控制,可控制到页面或按钮,满足绝大部分的权限需求 @@ -65,7 +59,7 @@ See the [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214
-### 数据权限设计思想 +#### 数据权限设计思想 - 用户管理、角色管理、部门管理,可操作本部门及子部门数据 - 菜单管理、定时任务、参数管理、字典管理、系统日志,没有数据权限 - 业务功能,按照用户数据权限,查询、操作数据【没有本部门数据权限,也能查询本人数据】 @@ -73,7 +67,7 @@ See the [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214
-**项目结构** +#### 项目结构 ``` renren-security ├─renren-common 公共模块 @@ -108,7 +102,7 @@ renren-security
-**技术选型:** +#### 技术选型 - 核心框架:Spring Boot 3.x - 安全框架:Apache Shiro 1.12 - 持久层框架:MyBatis 3.5 @@ -119,7 +113,7 @@ renren-security
-**软件需求** +#### 软件需求 - JDK17+ - Maven3.6+ - MySQL8.0+ @@ -130,7 +124,7 @@ renren-security
-**本地部署** +#### 本地部署 - 通过git下载源码 - 创建数据库renren_security,数据库编码为UTF-8 - 执行db/mysql.sql文件,初始化数据 @@ -158,6 +152,12 @@ renren-security - GitCode仓库:https://gitcode.com/renrenio/renren-security - [人人开源](https://www.renren.io):https://www.renren.io - 如需关注项目最新动态,请Watch、Star项目,同时也是对项目最好的支持 +
+#### 🏄 微信交流群 +我们提供了微信交流群,扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群! +

+![输入图片说明](renren-admin/src/main/resources/public/wechat.jpg) +
### 🙌 Contributing -- Gitee From a75dfc469078048046c399d8c751a9de1c896051 Mon Sep 17 00:00:00 2001 From: gitriver Date: Tue, 23 Dec 2025 22:38:52 +0800 Subject: [PATCH 7/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2966c14..6f895aa 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,11 @@ ### 📜 Roadmap -See the [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214) +See the [renren-security Roadmap 2026](https://gitee.com/cloudcoder/renren-security/issues/IDFDF7)
-### 架构设计 +### 🎯 架构设计 #### 架构特点 - 友好的代码结构及注释,便于阅读及二次开发 - 实现前后端分离,通过token进行数据交互,前端再也不用关注后端技术 -- Gitee