diff --git a/.gitignore b/.gitignore
index 83e50754..5850020e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,7 @@ Thumbs.db
*.war
*.ear
/target
+
+# Flattened pom
+.flattened-pom.xml
+/**/.flattened-pom.xml
diff --git a/LICENSE b/LICENSE
index 55336630..bee99db2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -176,7 +176,7 @@ recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
- Copyright 2020 BladeX (https://bladex.vip)
+ Copyright 2023 BladeX (https://bladex.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index b121f996..f64f14a0 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,45 @@
-
-
+
+
-
-
-
+
+
+
-
+
## SpringBlade微服务开发平台
* 采用前后端分离的模式,前端开源两个框架:[Sword](https://gitee.com/smallc/Sword) (基于 React、Ant Design)、[Saber](https://gitee.com/smallc/Saber) (基于 Vue、Element-UI)
-* 后端采用SpringCloud全家桶,并同时对其基础组件做了高度的封装,单独开源出一个框架:[BladeTool](https://github.com/chillzhuang/blade-tool)
+* 后端采用SpringCloud全家桶,并同时对其基础组件做了高度的封装,单独开源出一个框架:[BladeTool](https://gitee.com/smallc/blade-tool)
* [BladeTool](https://github.com/chillzhuang/blade-tool)已推送至Maven中央库,直接引入即可,减少了工程的臃肿,也可更注重于业务开发
* 集成Sentinel从流量控制、熔断降级、系统负载等多个维度保护服务的稳定性。
* 注册中心、配置中心选型Nacos,为工程瘦身的同时加强各模块之间的联动。
-* 使用Traefik进行反向代理,监听后台变化自动化应用新的配置文件。
* 极简封装了多租户底层,用更少的代码换来拓展性更强的SaaS多租户系统。
-* 借鉴OAuth2,实现了多终端认证系统,可控制子系统的token权限互相隔离。
-* 借鉴Security,封装了Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案。
-* 稳定生产了两年,经历了从Camden -> Hoxton的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构
+* 借鉴OAuth2,自研多终端认证系统,可控制子系统的token权限互相隔离。
+* 借鉴Security,自研Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案。
+* 稳定生产了六年,经历了从 Camden -> Hoxton -> 2023 的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构。
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
## 架构图
-
+
+
+## 核心技术栈
+
+| 技术栈 | 版本 |
+|----------------------|------------|
+| Java | 17+ |
+| NodeJS | 18+ |
+| Spring | 6.1.15 |
+| Spring Boot | 3.2.12 |
+| Spring Cloud | 2023.0.3 |
+| Spring Cloud Alibaba | 2023.0.1.2 |
+| Nacos Alibaba | 2.3.2 |
+| Mybatis Plus | 3.5.8 |
+
## 工程结构
```
@@ -43,8 +56,7 @@ SpringBlade
├── blade-service -- 业务模块
├ ├── blade-desk -- 工作台模块
├ ├── blade-log -- 日志模块
-├ ├── blade-system -- 系统模块
-├ └── blade-user -- 用户模块
+├ └── blade-system -- 系统模块
├── blade-service-api -- 业务模块api封装
├ ├── blade-desk-api -- 工作台api
├ ├── blade-dict-api -- 字典api
@@ -52,135 +64,80 @@ SpringBlade
└── └── blade-user-api -- 用户api
```
-## 官网
-* 官网地址:[https://bladex.vip](https://bladex.vip)
-* 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip)
-* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
-* 交流一群:`477853168`(满)
-* 交流二群:`751253339`(满)
-* 交流三群:`784729540`(满)
-* 交流四群:`1034621754`(满)
-* 交流五群:`946350912`
-
-## 在线演示
-* Saber-基于Vue:[https://saber.bladex.vip](https://saber.bladex.vip)
-* Sword-基于React:[https://sword.bladex.vip](https://sword.bladex.vip)
-* Archer-全能代码生成系统:[https://archer.bladex.vip](https://archer.bladex.vip)
-* Caster-数据大屏展示系统:[https://data.avuejs.com](https://data.avuejs.com)
+## 官方信息
-## 技术文档
-* [SpringBlade开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)
-* [常见问题集锦](https://sns.bladex.vip/article-14966.html)
-
-## 项目地址
-* 后端Gitee地址:[https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade)
-* 后端Github地址:[https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade)
-* 后端SpringBoot版:[https://gitee.com/smallc/SpringBlade/tree/2.0-boot/](https://gitee.com/smallc/SpringBlade/tree/2.0-boot/)
-* 前端框架Sword(基于React):[https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword)
-* 前端框架Saber(基于Vue):[https://gitee.com/smallc/Saber](https://gitee.com/smallc/Saber)
-* 核心框架项目地址:[https://github.com/chillzhuang/blade-tool](https://github.com/chillzhuang/blade-tool)
-
-# 开源协议
-Apache Licence 2.0 ([英文原文](http://www.apache.org/licenses/LICENSE-2.0.html))
-Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似,同样鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再发布(作为开源或商业软件)。
-需要满足的条件如下:
-* 需要给代码的用户一份Apache Licence
-* 如果你修改了代码,需要在被修改的文件中说明。
-* 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。
-* 如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。
-Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。
+| 简介 | 内容 |
+|------|-------------------------------------------------------------------------------|
+| 官网地址 | [https://bladex.cn](https://bladex.cn) |
+| 问答社区 | [https://sns.bladex.cn](https://sns.bladex.cn) |
+| 会员计划 | [SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) |
+| 交流一群 | `477853168` (满) |
+| 交流二群 | `751253339` (满) |
+| 交流三群 | `784729540` (满) |
+| 交流四群 | `1034621754` (满) |
+| 交流五群 | `946350912` (满) |
+| 交流六群 | `511624269` (满) |
+| 交流七群 | `298061704` |
-## 用户权益
-* 允许免费用于学习、毕设、公司项目、私活等。
-* 对未经过授权和不遵循 Apache 2.0 协议二次开源或者商业化我们将追究到底。
-* 参考请注明:参考自 SpringBlade:https://gitee.com/smallc/SpringBlade 。另请遵循 Apache 2.0 协议。
-* `注意`:若禁止条款被发现有权追讨 **19999** 的授权费。
+## 官方产品
-# 界面
+| 简介 | 演示地址 |
+|-----------------|------------------------------------------------------|
+| BladeX企业级开发平台 | [https://saber3.bladex.cn](https://saber3.bladex.cn) |
+| BladeX可视化数据大屏 | [https://data.bladex.cn](https://data.bladex.cn) |
+| BladeX物联网开发平台 | [https://iot.bladex.cn](https://iot.bladex.cn) |
+| BladeXAI大模型平台 | [https://aigc.bladex.cn/](https://aigc.bladex.cn/) |
-## [BladeX](https://bladex.vip/#/vip) 工作流一览
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
+## 前端项目
-## [Sword](https://gitee.com/smallc/Sword) 界面一览
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
+| 简介 | 地址 |
+|--------------------|------------------------------------------------------------------------------|
+| 前端框架Saber3(基于Vue3) | [https://gitee.com/smallc/Saber3](https://gitee.com/smallc/Saber) |
+| 前端框架Saber(基于Vue2) | [https://gitee.com/smallc/Saber2](https://gitee.com/smallc/Saber/tree/vue2/) |
+| 前端框架Sword(基于React) | [https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword) |
-## [Saber](https://gitee.com/smallc/Saber) 界面一览
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
+## 后端项目
+| 简介 | 地址 |
+|---------------|----------------------------------------------------------------------------------------------------|
+| 核心框架项目地址 | [https://gitee.com/smallc/blade-tool](https://gitee.com/smallc/blade-tool) |
+| 后端Gitee地址 | [https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade) |
+| 后端Github地址 | [https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade) |
+| 后端SpringBoot版 | [https://gitee.com/smallc/SpringBlade/tree/boot/](https://gitee.com/smallc/SpringBlade/tree/boot/) |
+
+## 安全手册
+| 简介 | 地址 |
+|-----------|----------------------------------------------------------------------------------------------------|
+| Blade安全手册 | [https://www.kancloud.cn/smallchill/blade-safety](https://www.kancloud.cn/smallchill/blade-safety) |
-## 监控界面一览
+## 技术文档
+
+| 简介 | 地址 |
+|---------------------------|--------------------------------------------------------------------------------------------------------------------------|
+| SpringBlade开发手册一览 | [https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册) |
+| SpringBlade常见问题集锦 | [https://sns.bladex.cn/article-14966.html](https://sns.bladex.cn/article-14966.html) |
+| SpringBlade基于Kuboard部署K8S | [https://kuboard.cn/learning/k8s-practice/spring-blade/](https://kuboard.cn/learning/k8s-practice/spring-blade/) |
+| SpringBlade基于Rainbond部署 | [https://www.rainbond.com/docs/micro-service/example/blade](https://www.rainbond.com/docs/micro-service/example/blade) |
+
+
+## 免费公开课
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
-
-
-  |
-  |
+  |
+  |
-## 关注我们
-
\ No newline at end of file
+## 开源协议
+Apache Licence 2.0 ([英文原文](http://www.apache.org/licenses/LICENSE-2.0.html))
+Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似,同样鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再发布(作为开源或商业软件)。
+需要满足的条件如下:
+* 需要给代码的用户一份Apache Licence
+* 如果你修改了代码,需要在被修改的文件中说明。
+* 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。
+* 如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。
+ Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。
+
+## 用户权益
+* 允许免费用于学习、毕设、公司项目、私活等,但请保留源码作者信息。
+* 对未经过授权和不遵循 Apache 2.0 协议二次开源或者商业化我们将追究到底。
+* 参考请注明:参考自 SpringBlade:https://gitee.com/smallc/SpringBlade。
\ No newline at end of file
diff --git a/blade-auth/Dockerfile b/blade-auth/Dockerfile
index d95904e3..2cce55ab 100644
--- a/blade-auth/Dockerfile
+++ b/blade-auth/Dockerfile
@@ -1,6 +1,8 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
+# 网络问题无法下载可以改为阿里云镜像
+# FROM registry.cn-hangzhou.aliyuncs.com/bladex-repo/alpine-java:openjdk17_cn_slim
+FROM bladex/alpine-java:openjdk17_cn_slim
-MAINTAINER smallchill@163.com
+MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/auth
@@ -10,6 +12,6 @@ EXPOSE 8010
ADD ./target/blade-auth.jar ./app.jar
-ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
diff --git a/blade-auth/pom.xml b/blade-auth/pom.xml
index 26c23552..411d9d0b 100644
--- a/blade-auth/pom.xml
+++ b/blade-auth/pom.xml
@@ -8,12 +8,11 @@
SpringBlade
org.springblade
- 2.8.0
+ ${revision}
blade-auth
${project.artifactId}
- ${blade.project.version}
jar
@@ -21,55 +20,50 @@
org.springblade
blade-common
- ${blade.project.version}
org.springblade
blade-core-cloud
- ${blade.tool.version}
org.springblade
blade-core-secure
- ${blade.tool.version}
org.springblade
- blade-core-log
- ${blade.tool.version}
+ blade-starter-log
org.springblade
- blade-core-social
- ${blade.tool.version}
+ blade-starter-social
+
+
+ org.springblade
+ blade-starter-redis
org.springblade
blade-user-api
- ${blade.project.version}
org.springblade
- blade-core-swagger
- ${blade.tool.version}
+ blade-starter-swagger
+
+
+ com.baomidou
+ mybatis-plus-spring-boot-autoconfigure
com.github.whvcse
easy-captcha
- ${captcha.version}
- mysql
- mysql-connector-java
+ com.mysql
+ mysql-connector-j
runtime
-
-
@@ -97,22 +91,6 @@
org.apache.maven.plugins
maven-antrun-plugin
-
-
- package
-
- run
-
-
-
-
-
-
-
-
-
diff --git a/blade-auth/src/main/java/org/springblade/auth/AuthApplication.java b/blade-auth/src/main/java/org/springblade/auth/AuthApplication.java
index b9aa7123..3811301b 100644
--- a/blade-auth/src/main/java/org/springblade/auth/AuthApplication.java
+++ b/blade-auth/src/main/java/org/springblade/auth/AuthApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,18 +16,16 @@
package org.springblade.auth;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* 用户认证服务器
*
* @author Chill
*/
-@SpringCloudApplication
-@EnableFeignClients(AppConstant.BASE_PACKAGES)
+@BladeCloudApplication
public class AuthApplication {
public static void main(String[] args) {
diff --git a/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java b/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java
index 529264b3..6c0a7aa6 100644
--- a/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java
+++ b/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,20 +16,20 @@
package org.springblade.auth.controller;
import com.wf.captcha.SpecCaptcha;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springblade.auth.granter.ITokenGranter;
import org.springblade.auth.granter.TokenGranterBuilder;
import org.springblade.auth.granter.TokenParameter;
import org.springblade.auth.utils.TokenUtil;
import org.springblade.common.cache.CacheNames;
+import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.AuthInfo;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.RedisUtil;
import org.springblade.core.tool.utils.WebUtil;
import org.springblade.system.user.entity.UserInfo;
import org.springframework.web.bind.annotation.GetMapping;
@@ -47,18 +47,18 @@
*/
@RestController
@AllArgsConstructor
-@Api(value = "用户授权认证", tags = "授权接口")
+@Tag(name = "用户授权认证", description = "授权接口")
public class AuthController {
- private RedisUtil redisUtil;
+ private BladeRedis bladeRedis;
@PostMapping("token")
- @ApiOperation(value = "获取认证token", notes = "传入租户ID:tenantId,账号:account,密码:password")
- public R token(@ApiParam(value = "授权类型", required = true) @RequestParam(defaultValue = "password", required = false) String grantType,
- @ApiParam(value = "刷新令牌") @RequestParam(required = false) String refreshToken,
- @ApiParam(value = "租户ID", required = true) @RequestParam(defaultValue = "000000", required = false) String tenantId,
- @ApiParam(value = "账号") @RequestParam(required = false) String account,
- @ApiParam(value = "密码") @RequestParam(required = false) String password) {
+ @Operation(summary = "获取认证token", description = "传入租户ID:tenantId,账号:account,密码:password")
+ public R token(@Parameter(description = "授权类型", required = true) @RequestParam(defaultValue = "password", required = false) String grantType,
+ @Parameter(description = "刷新令牌") @RequestParam(required = false) String refreshToken,
+ @Parameter(description = "租户ID", required = true) @RequestParam(defaultValue = "000000", required = false) String tenantId,
+ @Parameter(description = "账号") @RequestParam(required = false) String account,
+ @Parameter(description = "密码") @RequestParam(required = false) String password) {
String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), TokenUtil.DEFAULT_USER_TYPE);
@@ -81,15 +81,22 @@ public R token(@ApiParam(value = "授权类型", required = true) @Req
}
@GetMapping("/captcha")
- @ApiOperation(value = "获取验证码")
+ @Operation(summary = "获取验证码")
public R captcha() {
SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5);
String verCode = specCaptcha.text().toLowerCase();
String key = UUID.randomUUID().toString();
// 存入redis并设置过期时间为30分钟
- redisUtil.set(CacheNames.CAPTCHA_KEY + key, verCode, 30L, TimeUnit.MINUTES);
+ bladeRedis.setEx(CacheNames.CAPTCHA_KEY + key, verCode, 30L, TimeUnit.MINUTES);
// 将key和base64返回给前端
return R.data(Kv.init().set("key", key).set("image", specCaptcha.toBase64()));
}
+ @PostMapping("/logout")
+ @Operation(summary = "登出")
+ public R logout() {
+ // 登出预留逻辑
+ return R.data(Kv.init().set("code", "200").set("msg", "操作成功"));
+ }
+
}
diff --git a/blade-auth/src/main/java/org/springblade/auth/controller/SocialController.java b/blade-auth/src/main/java/org/springblade/auth/controller/SocialController.java
index e231dd67..3955b27a 100644
--- a/blade-auth/src/main/java/org/springblade/auth/controller/SocialController.java
+++ b/blade-auth/src/main/java/org/springblade/auth/controller/SocialController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
package org.springblade.auth.controller;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.model.AuthCallback;
@@ -30,7 +30,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
@@ -42,7 +42,7 @@
@RestController
@AllArgsConstructor
@ConditionalOnProperty(value = "social.enabled", havingValue = "true")
-@Api(value = "第三方登陆", tags = "第三方登陆端点")
+@Tag(name = "第三方登陆", description = "第三方登陆端点")
public class SocialController {
private final SocialProperties socialProperties;
@@ -50,7 +50,7 @@ public class SocialController {
/**
* 授权完毕跳转
*/
- @ApiOperation(value = "授权完毕跳转")
+ @Operation(summary = "授权完毕跳转")
@RequestMapping("/oauth/render/{source}")
public void renderAuth(@PathVariable("source") String source, HttpServletResponse response) throws IOException {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
@@ -61,7 +61,7 @@ public void renderAuth(@PathVariable("source") String source, HttpServletRespons
/**
* 获取认证信息
*/
- @ApiOperation(value = "获取认证信息")
+ @Operation(summary = "获取认证信息")
@RequestMapping("/oauth/callback/{source}")
public Object login(@PathVariable("source") String source, AuthCallback callback) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
@@ -71,7 +71,7 @@ public Object login(@PathVariable("source") String source, AuthCallback callback
/**
* 撤销授权
*/
- @ApiOperation(value = "撤销授权")
+ @Operation(summary = "撤销授权")
@RequestMapping("/oauth/revoke/{source}/{token}")
public Object revokeAuth(@PathVariable("source") String source, @PathVariable("token") String token) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
@@ -81,7 +81,7 @@ public Object revokeAuth(@PathVariable("source") String source, @PathVariable("t
/**
* 续期accessToken
*/
- @ApiOperation(value = "续期令牌")
+ @Operation(summary = "续期令牌")
@RequestMapping("/oauth/refresh/{source}")
public Object refreshAuth(@PathVariable("source") String source, String token) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
diff --git a/blade-auth/src/main/java/org/springblade/auth/enums/BladeUserEnum.java b/blade-auth/src/main/java/org/springblade/auth/enums/BladeUserEnum.java
index 4d0d538a..2b218d54 100644
--- a/blade-auth/src/main/java/org/springblade/auth/enums/BladeUserEnum.java
+++ b/blade-auth/src/main/java/org/springblade/auth/enums/BladeUserEnum.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java b/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java
index a3d9e7ca..a0781970 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,31 +16,40 @@
package org.springblade.auth.granter;
import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springblade.auth.enums.BladeUserEnum;
import org.springblade.auth.utils.TokenUtil;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.secure.props.BladeAuthProperties;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Component;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
+
+import java.time.Duration;
/**
* 验证码TokenGranter
*
* @author Chill
*/
+@Slf4j
@Component
@AllArgsConstructor
public class CaptchaTokenGranter implements ITokenGranter {
public static final String GRANT_TYPE = "captcha";
+ public static final Integer FAIL_COUNT = 5;
private IUserClient userClient;
- private RedisUtil redisUtil;
+ private BladeRedis bladeRedis;
+
+ private BladeAuthProperties authProperties;
@Override
public UserInfo grant(TokenParameter tokenParameter) {
@@ -49,7 +58,7 @@ public UserInfo grant(TokenParameter tokenParameter) {
String key = request.getHeader(TokenUtil.CAPTCHA_HEADER_KEY);
String code = request.getHeader(TokenUtil.CAPTCHA_HEADER_CODE);
// 获取验证码
- String redisCode = String.valueOf(redisUtil.get(CacheNames.CAPTCHA_KEY + key));
+ String redisCode = Func.toStr(bladeRedis.getAndDel(CacheNames.CAPTCHA_KEY + key));
// 判断验证码
if (code == null || !StringUtil.equalsIgnoreCase(redisCode, code)) {
throw new ServiceException(TokenUtil.CAPTCHA_NOT_CORRECT);
@@ -58,21 +67,40 @@ public UserInfo grant(TokenParameter tokenParameter) {
String tenantId = tokenParameter.getArgs().getStr("tenantId");
String account = tokenParameter.getArgs().getStr("account");
String password = tokenParameter.getArgs().getStr("password");
+
+ // 判断登录是否锁定
+ int cnt = Func.toInt(bladeRedis.get(CacheNames.tenantKey(tenantId, CacheNames.USER_FAIL_KEY, account)), 0);
+ if (cnt >= FAIL_COUNT) {
+ log.error("用户登录失败次数过多, 账号:{}, IP:{}", account, WebUtil.getIP());
+ throw new ServiceException(TokenUtil.USER_HAS_TOO_MANY_FAILS);
+ }
+
UserInfo userInfo = null;
if (Func.isNoneBlank(account, password)) {
// 获取用户类型
String userType = tokenParameter.getArgs().getStr("userType");
+ // 解密密码
+ String decryptPassword = TokenUtil.decryptPassword(password, authProperties.getPublicKey(), authProperties.getPrivateKey());
+ // 定义返回结果
R result;
// 根据不同用户类型调用对应的接口返回数据,用户可自行拓展
if (userType.equals(BladeUserEnum.WEB.getName())) {
- result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password));
+ result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else if (userType.equals(BladeUserEnum.APP.getName())) {
- result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password));
+ result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else {
- result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password));
+ result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
}
userInfo = result.isSuccess() ? result.getData() : null;
}
+
+ if (userInfo == null || userInfo.getUser() == null) {
+ // 增加错误锁定次数
+ bladeRedis.setEx(CacheNames.tenantKey(tenantId, CacheNames.USER_FAIL_KEY, account), cnt + 1, Duration.ofMinutes(30));
+ } else {
+ // 成功则清除登录缓存
+ bladeRedis.del(CacheNames.tenantKey(tenantId, CacheNames.USER_FAIL_KEY, account));
+ }
return userInfo;
}
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/ITokenGranter.java b/blade-auth/src/main/java/org/springblade/auth/granter/ITokenGranter.java
index b2ec7318..9649e9d5 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/ITokenGranter.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/ITokenGranter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/PasswordTokenGranter.java b/blade-auth/src/main/java/org/springblade/auth/granter/PasswordTokenGranter.java
index 9572a6a5..201d8094 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/PasswordTokenGranter.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/PasswordTokenGranter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,47 +16,80 @@
package org.springblade.auth.granter;
import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springblade.auth.enums.BladeUserEnum;
+import org.springblade.auth.utils.TokenUtil;
+import org.springblade.common.cache.CacheNames;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.secure.props.BladeAuthProperties;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.WebUtil;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Component;
+import java.time.Duration;
+
/**
* PasswordTokenGranter
*
* @author Chill
*/
+@Slf4j
@Component
@AllArgsConstructor
public class PasswordTokenGranter implements ITokenGranter {
public static final String GRANT_TYPE = "password";
+ public static final Integer FAIL_COUNT = 5;
private IUserClient userClient;
+ private BladeRedis bladeRedis;
+
+ private BladeAuthProperties authProperties;
@Override
public UserInfo grant(TokenParameter tokenParameter) {
String tenantId = tokenParameter.getArgs().getStr("tenantId");
String account = tokenParameter.getArgs().getStr("account");
String password = tokenParameter.getArgs().getStr("password");
+
+ // 判断登录是否锁定
+ int cnt = Func.toInt(bladeRedis.get(CacheNames.tenantKey(tenantId, CacheNames.USER_FAIL_KEY, account)), 0);
+ if (cnt >= FAIL_COUNT) {
+ log.error("用户登录失败次数过多, 账号:{}, IP:{}", account, WebUtil.getIP());
+ throw new ServiceException(TokenUtil.USER_HAS_TOO_MANY_FAILS);
+ }
+
UserInfo userInfo = null;
if (Func.isNoneBlank(account, password)) {
// 获取用户类型
String userType = tokenParameter.getArgs().getStr("userType");
+ // 解密密码
+ String decryptPassword = TokenUtil.decryptPassword(password, authProperties.getPublicKey(), authProperties.getPrivateKey());
+ // 定义返回结果
R result;
// 根据不同用户类型调用对应的接口返回数据,用户可自行拓展
if (userType.equals(BladeUserEnum.WEB.getName())) {
- result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password));
+ result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else if (userType.equals(BladeUserEnum.APP.getName())) {
- result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password));
+ result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else {
- result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password));
+ result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
}
userInfo = result.isSuccess() ? result.getData() : null;
}
+
+ if (userInfo == null || userInfo.getUser() == null) {
+ // 增加错误锁定次数
+ bladeRedis.setEx(CacheNames.tenantKey(tenantId, CacheNames.USER_FAIL_KEY, account), cnt + 1, Duration.ofMinutes(30));
+ } else {
+ // 成功则清除登录缓存
+ bladeRedis.del(CacheNames.tenantKey(tenantId, CacheNames.USER_FAIL_KEY, account));
+ }
return userInfo;
}
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/RefreshTokenGranter.java b/blade-auth/src/main/java/org/springblade/auth/granter/RefreshTokenGranter.java
index 95fd95fe..f5b86f1b 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/RefreshTokenGranter.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/RefreshTokenGranter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/SocialTokenGranter.java b/blade-auth/src/main/java/org/springblade/auth/granter/SocialTokenGranter.java
index 905312d6..ff1513b3 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/SocialTokenGranter.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/SocialTokenGranter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Component;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
@@ -79,7 +79,7 @@ public UserInfo grant(TokenParameter tokenParameter) {
}
// 组装数据
- UserOauth userOauth = Objects.requireNonNull(BeanUtil.copy(authUser, UserOauth.class));
+ UserOauth userOauth = Objects.requireNonNull(BeanUtil.copyProperties(authUser, UserOauth.class));
userOauth.setSource(authUser.getSource());
userOauth.setTenantId(tenantId);
userOauth.setUuid(authUser.getUuid());
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java b/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java
index e8700f7d..d872128b 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/TokenParameter.java b/blade-auth/src/main/java/org/springblade/auth/granter/TokenParameter.java
index 368c83ef..e992b969 100644
--- a/blade-auth/src/main/java/org/springblade/auth/granter/TokenParameter.java
+++ b/blade-auth/src/main/java/org/springblade/auth/granter/TokenParameter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java b/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java
index 912a1a83..daf67948 100644
--- a/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java
+++ b/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,9 @@
import org.springblade.core.secure.TokenInfo;
import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SM2Util;
+import org.springblade.core.tool.utils.StringPool;
+import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo;
@@ -43,7 +46,9 @@ public class TokenUtil {
public final static String USER_NOT_FOUND = "用户名或密码错误";
public final static String HEADER_KEY = "Authorization";
public final static String HEADER_PREFIX = "Basic ";
- public final static String DEFAULT_AVATAR = "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png";
+ public final static String ENCRYPT_PREFIX = "04";
+ public final static String USER_HAS_TOO_MANY_FAILS = "用户登录失败次数过多";
+ public final static String DEFAULT_AVATAR = "https://bladex.cn/images/logo.png";
/**
* 创建认证token
@@ -61,6 +66,7 @@ public static AuthInfo createAuthInfo(UserInfo userInfo) {
param.put(TokenConstant.OAUTH_ID, userInfo.getOauthId());
param.put(TokenConstant.USER_ID, Func.toStr(user.getId()));
param.put(TokenConstant.ROLE_ID, user.getRoleId());
+ param.put(TokenConstant.DEPT_ID, user.getDeptId());
param.put(TokenConstant.ACCOUNT, user.getAccount());
param.put(TokenConstant.USER_NAME, user.getAccount());
param.put(TokenConstant.ROLE_NAME, Func.join(userInfo.getRoles()));
@@ -96,4 +102,31 @@ private static TokenInfo createRefreshToken(UserInfo userInfo) {
return SecureUtil.createJWT(param, "audience", "issuser", TokenConstant.REFRESH_TOKEN);
}
+ /**
+ * 解析国密sm2加密密码
+ *
+ * @param rawPassword 请求时提交的原密码
+ * @param publicKey 公钥
+ * @param privateKey 私钥
+ * @return 解密后的密码
+ */
+ public static String decryptPassword(String rawPassword, String publicKey, String privateKey) {
+ // 其中有空则匹配失败
+ if (StringUtil.isAnyBlank(publicKey, privateKey)) {
+ return StringPool.EMPTY;
+ }
+ // 处理部分工具类加密不带04前缀的情况
+ if (!StringUtil.startsWithIgnoreCase(rawPassword, ENCRYPT_PREFIX)) {
+ rawPassword = ENCRYPT_PREFIX + rawPassword;
+ }
+ // 解密密码
+ String decryptPassword = SM2Util.decrypt(rawPassword, privateKey);
+ // 签名校验
+ boolean isVerified = SM2Util.verify(decryptPassword, SM2Util.sign(decryptPassword, privateKey), publicKey);
+ if (!isVerified) {
+ return StringPool.EMPTY;
+ }
+ return decryptPassword;
+ }
+
}
diff --git a/blade-auth/src/test/java/org/springblade/test/SignKeyGenerator.java b/blade-auth/src/test/java/org/springblade/test/SignKeyGenerator.java
new file mode 100644
index 00000000..0878fc35
--- /dev/null
+++ b/blade-auth/src/test/java/org/springblade/test/SignKeyGenerator.java
@@ -0,0 +1,24 @@
+package org.springblade.test;
+
+import org.springblade.core.tool.utils.AesUtil;
+import org.springblade.core.tool.utils.RandomType;
+import org.springblade.core.tool.utils.StringUtil;
+
+/**
+ * signKey生成器
+ *
+ * @author Chill
+ */
+public class SignKeyGenerator {
+
+ public static void main(String[] args) {
+ System.out.println("=========== blade.token.sign-key 配置如下 ==============");
+ System.out.println("#blade配置\n" +
+ "blade:\n" +
+ " token:\n" +
+ " sign-key: " + StringUtil.random(32, RandomType.ALL) +"\n" +
+ " aes-key: " + AesUtil.genAesKey() );
+ System.out.println("=======================================================");
+ }
+
+}
diff --git a/blade-auth/src/test/java/org/springblade/test/Sm2KeyGenerator.java b/blade-auth/src/test/java/org/springblade/test/Sm2KeyGenerator.java
new file mode 100644
index 00000000..e527cbf6
--- /dev/null
+++ b/blade-auth/src/test/java/org/springblade/test/Sm2KeyGenerator.java
@@ -0,0 +1,46 @@
+package org.springblade.test;
+
+import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
+import org.bouncycastle.util.encoders.Hex;
+import org.springblade.core.tool.utils.SM2Util;
+import org.springblade.core.tool.utils.StringPool;
+
+/**
+ * signKey生成器
+ *
+ * @author Chill
+ */
+public class Sm2KeyGenerator {
+
+ public static void main(String[] args) {
+ System.out.println("================ blade.auth 配置如下 =================");
+ AsymmetricCipherKeyPair keyPair = SM2Util.generateKeyPair();
+ String publicKey = SM2Util.getPublicKeyString(keyPair);
+ String privateKey = SM2Util.getPrivateKeyString(keyPair);
+ System.out.println("#blade配置 \n" +
+ "blade:\n" +
+ " auth:\n" +
+ " public-key: " + publicKey + "\n" +
+ " private-key: " + privateKey);
+ System.out.println("=======================================================");
+ System.out.println(StringPool.EMPTY);
+ System.out.println("============== saber website.js 配置如下 ===============");
+ System.out.println("//saber配置\n" +
+ "auth: {\n" +
+ " publicKey: '" + publicKey + "',\n" +
+ "}");
+ System.out.println("=======================================================");
+ System.out.println(StringPool.EMPTY);
+ System.out.println("============== 密码:[admin] 加密流程如下 ================");
+ String password = "admin";
+ byte[] encryptedData = SM2Util.encrypt(password, publicKey);
+ String decryptedText = SM2Util.decrypt(encryptedData, privateKey);
+ System.out.println("加密前: " + password);
+ System.out.println("加密后: " + Hex.toHexString(encryptedData));
+ System.out.println("解密后: " + decryptedText);
+ System.out.println("请注意: 此密文为前端加密后调用token接口的密码参数");
+ System.out.println("=======================================================");
+
+ }
+
+}
diff --git a/blade-common/pom.xml b/blade-common/pom.xml
index 2e7fee04..4f014b10 100644
--- a/blade-common/pom.xml
+++ b/blade-common/pom.xml
@@ -5,25 +5,26 @@
SpringBlade
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-common
${project.artifactId}
- ${blade.project.version}
jar
org.springblade
blade-core-launch
- ${blade.tool.version}
+
+
+ org.springblade
+ blade-starter-loadbalancer
net.dreamlu
mica-auto
- ${mica.auto.version}
provided
diff --git a/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java b/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java
index 7fbb0072..36408961 100644
--- a/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java
+++ b/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,26 @@ public interface CacheNames {
String DICT_VALUE = "dict:value";
String DICT_LIST = "dict:list";
- String CAPTCHA_KEY = "blade:auth::captcha:";
+ /**
+ * 验证码key
+ */
+ String CAPTCHA_KEY = "blade:auth::blade:captcha:";
+
+ /**
+ * 登录失败key
+ */
+ String USER_FAIL_KEY = "blade:user::blade:fail:";
+
+ /**
+ * 返回租户格式的key
+ *
+ * @param tenantId 租户编号
+ * @param cacheKey 缓存key
+ * @param cacheKeyValue 缓存key值
+ * @return tenantKey
+ */
+ static String tenantKey(String tenantId, String cacheKey, String cacheKeyValue) {
+ return tenantId.concat(":").concat(cacheKey).concat(cacheKeyValue);
+ }
}
diff --git a/blade-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java b/blade-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java
index e8bfb1ab..ed34ca23 100644
--- a/blade-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java
+++ b/blade-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
*
* @author Chill
*/
-@Configuration
+@Configuration(proxyBeanMethods = false)
@AllArgsConstructor
public class BladeCommonConfiguration {
diff --git a/blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java b/blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
index abc21078..4be51473 100644
--- a/blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
+++ b/blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
@@ -9,6 +9,16 @@
*/
public interface LauncherConstant {
+ /**
+ * nacos 用户名
+ */
+ String NACOS_USERNAME = "nacos";
+
+ /**
+ * nacos 密码
+ */
+ String NACOS_PASSWORD = "nacos";
+
/**
* nacos namespace id
*/
diff --git a/blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java b/blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java
index 150c14cb..8a090e98 100644
--- a/blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java
+++ b/blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,9 +15,9 @@
*/
package org.springblade.common.launch;
-import org.springblade.common.constant.CommonConstant;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.launch.service.LauncherService;
+import org.springblade.core.launch.utils.PropsUtil;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
@@ -32,10 +32,12 @@ public class LauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile) {
Properties props = System.getProperties();
- props.setProperty("spring.cloud.nacos.discovery.server-addr", LauncherConstant.nacosAddr(profile));
- props.setProperty("spring.cloud.nacos.config.server-addr", LauncherConstant.nacosAddr(profile));
- props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
- props.setProperty("spring.zipkin.base-url", LauncherConstant.zipkinAddr(profile));
+ PropsUtil.setProperty(props, "spring.cloud.nacos.username", LauncherConstant.NACOS_USERNAME);
+ PropsUtil.setProperty(props, "spring.cloud.nacos.password", LauncherConstant.NACOS_PASSWORD);
+ PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.server-addr", LauncherConstant.nacosAddr(profile));
+ PropsUtil.setProperty(props, "spring.cloud.nacos.config.server-addr", LauncherConstant.nacosAddr(profile));
+ PropsUtil.setProperty(props, "spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
+ PropsUtil.setProperty(props, "spring.zipkin.base-url", LauncherConstant.zipkinAddr(profile));
}
}
diff --git a/blade-common/src/main/java/org/springblade/common/tool/CommonUtil.java b/blade-common/src/main/java/org/springblade/common/tool/CommonUtil.java
index 4fd9d10e..5785606b 100644
--- a/blade-common/src/main/java/org/springblade/common/tool/CommonUtil.java
+++ b/blade-common/src/main/java/org/springblade/common/tool/CommonUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/UserApplication.java b/blade-common/src/main/java/org/springblade/common/tool/PropsUtil.java
similarity index 50%
rename from blade-service/blade-user/src/main/java/org/springblade/system/user/UserApplication.java
rename to blade-common/src/main/java/org/springblade/common/tool/PropsUtil.java
index 938a342e..0801fb22 100644
--- a/blade-service/blade-user/src/main/java/org/springblade/system/user/UserApplication.java
+++ b/blade-common/src/main/java/org/springblade/common/tool/PropsUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,24 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.system.user;
+package org.springblade.common.tool;
-import org.springblade.core.launch.BladeApplication;
-import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.util.StringUtils;
+
+import java.util.Properties;
/**
- * 用户启动器
+ * 配置工具类
*
* @author Chill
*/
-@SpringCloudApplication
-@EnableFeignClients(AppConstant.BASE_PACKAGES)
-public class UserApplication {
+public class PropsUtil {
- public static void main(String[] args) {
- BladeApplication.run(AppConstant.APPLICATION_USER_NAME, UserApplication.class, args);
+ /**
+ * 设置配置值,已存在则跳过
+ *
+ * @param props property
+ * @param key key
+ * @param value value
+ */
+ public static void setProperty(Properties props, String key, String value) {
+ if (StringUtils.isEmpty(props.getProperty(key))) {
+ props.setProperty(key, value);
+ }
}
}
diff --git a/blade-gateway/Dockerfile b/blade-gateway/Dockerfile
index e0ae9f9c..8d53271a 100644
--- a/blade-gateway/Dockerfile
+++ b/blade-gateway/Dockerfile
@@ -1,6 +1,6 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
+FROM bladex/alpine-java:openjdk17_cn_slim
-MAINTAINER smallchill@163.com
+MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/gateway
@@ -10,6 +10,6 @@ EXPOSE 80
ADD ./target/blade-gateway.jar ./app.jar
-ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
diff --git a/blade-gateway/pom.xml b/blade-gateway/pom.xml
index 5e7b147c..caccfdeb 100644
--- a/blade-gateway/pom.xml
+++ b/blade-gateway/pom.xml
@@ -5,13 +5,12 @@
SpringBlade
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-gateway
${project.artifactId}
- ${blade.project.version}
jar
@@ -19,7 +18,6 @@
org.springblade
blade-core-launch
- ${blade.tool.version}
org.springframework.boot
@@ -34,7 +32,6 @@
org.springblade
blade-common
- ${blade.project.version}
org.springblade
@@ -54,67 +51,34 @@
de.codecentric
spring-boot-admin-starter-client
- ${spring.boot.admin.version}
org.springframework.cloud
- spring-cloud-starter-netflix-hystrix
-
-
- commons-logging
- commons-logging
-
-
+ spring-cloud-starter-loadbalancer
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
- ${alibaba.cloud.version}
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-config
- ${alibaba.cloud.version}
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+ com.github.xiaoymin
+ knife4j-gateway-spring-boot-starter
io.jsonwebtoken
jjwt-impl
- 0.11.2
io.jsonwebtoken
jjwt-jackson
- 0.11.2
-
-
-
- io.springfox
- springfox-swagger2
- ${swagger.version}
-
-
- io.swagger
- swagger-models
-
-
-
-
- io.swagger
- swagger-models
- ${swagger.models.version}
-
-
- com.github.xiaoymin
- knife4j-spring-ui
- ${knife4j.version}
-
@@ -142,22 +106,6 @@
org.apache.maven.plugins
maven-antrun-plugin
-
-
- package
-
- run
-
-
-
-
-
-
-
-
-
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/GateWayApplication.java b/blade-gateway/src/main/java/org/springblade/gateway/GateWayApplication.java
index 28959390..5e9e6c9c 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/GateWayApplication.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/GateWayApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,20 +15,18 @@
*/
package org.springblade.gateway;
-import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.launch.BladeApplication;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.netflix.hystrix.EnableHystrix;
-import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springblade.core.launch.constant.AppConstant;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* 项目启动
*
* @author Chill
*/
-@EnableHystrix
-@EnableScheduling
-@SpringCloudApplication
+@EnableDiscoveryClient
+@SpringBootApplication
public class GateWayApplication {
public static void main(String[] args) {
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/config/ErrorHandlerConfiguration.java b/blade-gateway/src/main/java/org/springblade/gateway/config/ErrorHandlerConfiguration.java
deleted file mode 100644
index 8caaccef..00000000
--- a/blade-gateway/src/main/java/org/springblade/gateway/config/ErrorHandlerConfiguration.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
- *
- * 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 org.springblade.gateway.config;
-
-
-import org.springblade.gateway.handler.ErrorExceptionHandler;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.boot.autoconfigure.web.ResourceProperties;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.web.reactive.error.ErrorAttributes;
-import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.http.codec.ServerCodecConfigurer;
-import org.springframework.web.reactive.result.view.ViewResolver;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * 异常处理配置类
- *
- * @author Chill
- */
-@Configuration
-@EnableConfigurationProperties({ServerProperties.class, ResourceProperties.class})
-public class ErrorHandlerConfiguration {
-
- private final ServerProperties serverProperties;
-
- private final ApplicationContext applicationContext;
-
- private final ResourceProperties resourceProperties;
-
- private final List viewResolvers;
-
- private final ServerCodecConfigurer serverCodecConfigurer;
-
- public ErrorHandlerConfiguration(ServerProperties serverProperties,
- ResourceProperties resourceProperties,
- ObjectProvider> viewResolversProvider,
- ServerCodecConfigurer serverCodecConfigurer,
- ApplicationContext applicationContext) {
- this.serverProperties = serverProperties;
- this.applicationContext = applicationContext;
- this.resourceProperties = resourceProperties;
- this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
- this.serverCodecConfigurer = serverCodecConfigurer;
- }
-
- @Bean
- @Order(Ordered.HIGHEST_PRECEDENCE)
- public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
- ErrorExceptionHandler exceptionHandler = new ErrorExceptionHandler(
- errorAttributes,
- this.resourceProperties,
- this.serverProperties.getError(),
- this.applicationContext);
- exceptionHandler.setViewResolvers(this.viewResolvers);
- exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
- exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
- return exceptionHandler;
- }
-
-}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/config/JwtConfiguration.java b/blade-gateway/src/main/java/org/springblade/gateway/config/JwtConfiguration.java
new file mode 100644
index 00000000..45b35262
--- /dev/null
+++ b/blade-gateway/src/main/java/org/springblade/gateway/config/JwtConfiguration.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.gateway.config;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.gateway.props.JwtProperties;
+import org.springblade.gateway.utils.JwtUtil;
+import org.springframework.beans.factory.SmartInitializingSingleton;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * JWT配置信息
+ *
+ * @author Chill
+ */
+@Slf4j
+@Configuration(proxyBeanMethods = false)
+@AllArgsConstructor
+@EnableConfigurationProperties({JwtProperties.class})
+public class JwtConfiguration implements SmartInitializingSingleton {
+
+ private final JwtProperties properties;
+
+ @Override
+ public void afterSingletonsInstantiated() {
+ JwtUtil.setJwtProperties(properties);
+ }
+}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/config/RouterFunctionConfiguration.java b/blade-gateway/src/main/java/org/springblade/gateway/config/RouterFunctionConfiguration.java
index ed519825..e2ef767c 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/config/RouterFunctionConfiguration.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/config/RouterFunctionConfiguration.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,18 +18,13 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springblade.gateway.handler.SwaggerResourceHandler;
-import org.springblade.gateway.handler.SwaggerSecurityHandler;
-import org.springblade.gateway.handler.SwaggerUiHandler;
+import org.springblade.gateway.filter.GatewayFilter;
import org.springblade.gateway.props.AuthProperties;
-import org.springblade.gateway.props.RouteProperties;
+import org.springblade.gateway.props.RequestProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.http.MediaType;
-import org.springframework.web.reactive.function.server.RequestPredicates;
-import org.springframework.web.reactive.function.server.RouterFunction;
-import org.springframework.web.reactive.function.server.RouterFunctions;
+import org.springframework.web.server.WebFilter;
/**
* 路由配置信息
@@ -37,23 +32,17 @@
* @author Chill
*/
@Slf4j
-@Configuration
+@Configuration(proxyBeanMethods = false)
@AllArgsConstructor
-@EnableConfigurationProperties({RouteProperties.class, AuthProperties.class})
+@EnableConfigurationProperties({AuthProperties.class, RequestProperties.class})
public class RouterFunctionConfiguration {
- private final SwaggerResourceHandler swaggerResourceHandler;
- private final SwaggerSecurityHandler swaggerSecurityHandler;
- private final SwaggerUiHandler swaggerUiHandler;
-
+ /**
+ * 全局配置
+ */
@Bean
- public RouterFunction routerFunction() {
- return RouterFunctions.route(RequestPredicates.GET("/swagger-resources")
- .and(RequestPredicates.accept(MediaType.ALL)), swaggerResourceHandler)
- .andRoute(RequestPredicates.GET("/swagger-resources/configuration/ui")
- .and(RequestPredicates.accept(MediaType.ALL)), swaggerUiHandler)
- .andRoute(RequestPredicates.GET("/swagger-resources/configuration/security")
- .and(RequestPredicates.accept(MediaType.ALL)), swaggerSecurityHandler);
+ public WebFilter gatewayFilter(RequestProperties requestProperties) {
+ return new GatewayFilter(requestProperties);
}
}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/controller/DiscoveryClientController.java b/blade-gateway/src/main/java/org/springblade/gateway/controller/DiscoveryClientController.java
index 4568fe93..478785d9 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/controller/DiscoveryClientController.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/controller/DiscoveryClientController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/filter/AuthFilter.java b/blade-gateway/src/main/java/org/springblade/gateway/filter/AuthFilter.java
index 47adfaea..cef89b25 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/filter/AuthFilter.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/filter/AuthFilter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,15 +15,17 @@
*/
package org.springblade.gateway.filter;
+import com.alibaba.nacos.common.utils.StringUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.jsonwebtoken.Claims;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
+import org.springblade.core.launch.props.BladeProperties;
import org.springblade.gateway.props.AuthProperties;
import org.springblade.gateway.provider.AuthProvider;
import org.springblade.gateway.provider.ResponseProvider;
+import org.springblade.gateway.utils.JwtCrypto;
import org.springblade.gateway.utils.JwtUtil;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
@@ -32,12 +34,15 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
+import org.springframework.util.AntPathMatcher;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.nio.charset.StandardCharsets;
+import static org.springblade.gateway.utils.JwtCrypto.BLADE_CRYPTO_AES_KEY;
+
/**
* 鉴权认证
*
@@ -47,8 +52,10 @@
@Component
@AllArgsConstructor
public class AuthFilter implements GlobalFilter, Ordered {
- private AuthProperties authProperties;
- private ObjectMapper objectMapper;
+ private final AuthProperties authProperties;
+ private final ObjectMapper objectMapper;
+ private final BladeProperties bladeProperties;
+ private final AntPathMatcher antPathMatcher = new AntPathMatcher();
@Override
public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
@@ -59,11 +66,15 @@ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpResponse resp = exchange.getResponse();
String headerToken = exchange.getRequest().getHeaders().getFirst(AuthProvider.AUTH_KEY);
String paramToken = exchange.getRequest().getQueryParams().getFirst(AuthProvider.AUTH_KEY);
- if (StringUtils.isAllBlank(headerToken, paramToken)) {
+ if (StringUtils.isBlank(headerToken) && StringUtils.isBlank(paramToken)) {
return unAuth(resp, "缺失令牌,鉴权失败");
}
String auth = StringUtils.isBlank(headerToken) ? paramToken : headerToken;
String token = JwtUtil.getToken(auth);
+ //校验 加密Token 合法性
+ if (JwtUtil.isCrypto(auth)) {
+ token = JwtCrypto.decryptToString(token, bladeProperties.getEnvironment().getProperty(BLADE_CRYPTO_AES_KEY));
+ }
Claims claims = JwtUtil.parseJWT(token);
if (claims == null) {
return unAuth(resp, "请求未授权");
@@ -72,8 +83,8 @@ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
}
private boolean isSkip(String path) {
- return AuthProvider.getDefaultSkipUrl().stream().map(url -> url.replace(AuthProvider.TARGET, AuthProvider.REPLACEMENT)).anyMatch(path::contains)
- || authProperties.getSkipUrl().stream().map(url -> url.replace(AuthProvider.TARGET, AuthProvider.REPLACEMENT)).anyMatch(path::contains);
+ return AuthProvider.getDefaultSkipUrl().stream().anyMatch(pattern -> antPathMatcher.match(pattern, path))
+ || authProperties.getSkipUrl().stream().anyMatch(pattern -> antPathMatcher.match(pattern, path));
}
private Mono unAuth(ServerHttpResponse resp, String msg) {
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/filter/GatewayFilter.java b/blade-gateway/src/main/java/org/springblade/gateway/filter/GatewayFilter.java
new file mode 100644
index 00000000..3867f9ab
--- /dev/null
+++ b/blade-gateway/src/main/java/org/springblade/gateway/filter/GatewayFilter.java
@@ -0,0 +1,161 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.gateway.filter;
+
+import lombok.RequiredArgsConstructor;
+import org.springblade.gateway.props.RequestProperties;
+import org.springframework.core.Ordered;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+import org.springframework.lang.NonNull;
+import org.springframework.util.AntPathMatcher;
+import org.springframework.util.PatternMatchUtils;
+import org.springframework.web.cors.reactive.CorsUtils;
+import org.springframework.web.server.ServerWebExchange;
+import org.springframework.web.server.WebFilter;
+import org.springframework.web.server.WebFilterChain;
+import reactor.core.publisher.Mono;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 全局拦截器
+ *
+ * @author Chill
+ */
+@RequiredArgsConstructor
+public class GatewayFilter implements WebFilter, Ordered {
+
+ /**
+ * 请求配置
+ */
+ private final RequestProperties requestProperties;
+ /**
+ * 路径匹配
+ */
+ private final AntPathMatcher antPathMatcher = new AntPathMatcher();
+
+ /**
+ * 默认拦截地址
+ */
+ private final List defaultBlockUrl = List.of("/**/actuator/**", "/health/**");
+ /**
+ * 默认白名单
+ */
+ private final List defaultWhiteList = List.of("127.0.0.1", "172.30.*.*", "192.168.*.*", "10.*.*.*", "0:0:0:0:0:0:0:1");
+ /**
+ * 默认提示信息
+ */
+ private final static String DEFAULT_MESSAGE = "当前请求被拒绝,请联系管理员!";
+
+ /**
+ * 这里为支持的请求头,如果有自定义的header字段请自己添加
+ */
+ private static final String ALLOWED_HEADERS = "X-Requested-With, Tenant-Id, Blade-Auth, Content-Type, Authorization, credential, X-XSRF-TOKEN, token, username, client, knfie4j-gateway-request, knife4j-gateway-code, request-origion";
+ private static final String ALLOWED_METHODS = "GET,POST,PUT,DELETE,OPTIONS,HEAD";
+ private static final String ALLOWED_ORIGIN = "*";
+ private static final String ALLOWED_EXPOSE = "*";
+ private static final String MAX_AGE = "18000L";
+
+
+ @NonNull
+ @Override
+ public Mono filter(@NonNull ServerWebExchange exchange, @NonNull WebFilterChain chain) {
+ ServerHttpRequest request = exchange.getRequest();
+ // 处理跨域请求
+ if (CorsUtils.isCorsRequest(request)) {
+ ServerHttpResponse response = exchange.getResponse();
+ HttpHeaders headers = response.getHeaders();
+ headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS);
+ headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS);
+ headers.add("Access-Control-Allow-Origin", ALLOWED_ORIGIN);
+ headers.add("Access-Control-Expose-Headers", ALLOWED_EXPOSE);
+ headers.add("Access-Control-Max-Age", MAX_AGE);
+ headers.add("Access-Control-Allow-Credentials", "true");
+ if (request.getMethod() == HttpMethod.OPTIONS) {
+ response.setStatusCode(HttpStatus.OK);
+ return Mono.empty();
+ }
+ }
+ // 处理黑白名单与拦截请求
+ if (requestProperties.getEnabled()) {
+ String path = request.getPath().value();
+ String ip = Objects.requireNonNull(request.getRemoteAddress()).getHostString();
+ if (isRequestBlock(path, ip)) {
+ throw new RuntimeException(DEFAULT_MESSAGE);
+ }
+ }
+ return chain.filter(exchange);
+ }
+
+
+ /**
+ * 是否白名单
+ *
+ * @param ip ip地址
+ * @return boolean
+ */
+ private boolean isWhiteList(String ip) {
+ List whiteList = requestProperties.getWhiteList();
+ String[] defaultWhiteIps = defaultWhiteList.toArray(new String[0]);
+ String[] whiteIps = whiteList.toArray(new String[0]);
+ return PatternMatchUtils.simpleMatch(defaultWhiteIps, ip) || PatternMatchUtils.simpleMatch(whiteIps, ip);
+ }
+
+ /**
+ * 是否黑名单
+ *
+ * @param ip ip地址
+ * @return boolean
+ */
+ private boolean isBlackList(String ip) {
+ List blackList = requestProperties.getBlackList();
+ String[] blackIps = blackList.toArray(new String[0]);
+ return PatternMatchUtils.simpleMatch(blackIps, ip);
+ }
+
+ /**
+ * 是否禁用请求访问
+ *
+ * @param path 请求路径
+ * @return boolean
+ */
+ private boolean isRequestBlock(String path) {
+ List blockUrl = requestProperties.getBlockUrl();
+ return defaultBlockUrl.stream().anyMatch(pattern -> antPathMatcher.match(pattern, path)) ||
+ blockUrl.stream().anyMatch(pattern -> antPathMatcher.match(pattern, path));
+ }
+
+ /**
+ * 是否拦截请求
+ *
+ * @param path 请求路径
+ * @param ip ip地址
+ * @return boolean
+ */
+ private boolean isRequestBlock(String path, String ip) {
+ return (isRequestBlock(path) && !isWhiteList(ip)) || isBlackList(ip);
+ }
+
+ @Override
+ public int getOrder() {
+ return Ordered.HIGHEST_PRECEDENCE;
+ }
+}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/filter/RequestFilter.java b/blade-gateway/src/main/java/org/springblade/gateway/filter/RequestFilter.java
new file mode 100644
index 00000000..bb66e9df
--- /dev/null
+++ b/blade-gateway/src/main/java/org/springblade/gateway/filter/RequestFilter.java
@@ -0,0 +1,45 @@
+package org.springblade.gateway.filter;
+
+import org.springframework.cloud.gateway.filter.GatewayFilterChain;
+import org.springframework.cloud.gateway.filter.GlobalFilter;
+import org.springframework.core.Ordered;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR;
+import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.addOriginalRequestUrl;
+
+/**
+ * request过滤器
+ *
+ * @author lengleng
+ */
+@Component
+public class RequestFilter implements GlobalFilter, Ordered {
+
+ @Override
+ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
+ ServerHttpRequest request = exchange.getRequest();
+ addOriginalRequestUrl(exchange, request.getURI());
+ String rawPath = request.getURI().getRawPath();
+ String newPath = "/" + Arrays.stream(StringUtils.tokenizeToStringArray(rawPath, "/"))
+ .skip(1L).collect(Collectors.joining("/"));
+ ServerHttpRequest newRequest = request.mutate()
+ .path(newPath)
+ .build();
+ exchange.getAttributes().put(GATEWAY_REQUEST_URL_ATTR, newRequest.getURI());
+ return chain.filter(exchange.mutate().request(newRequest.mutate().build()).build());
+ }
+
+ @Override
+ public int getOrder() {
+ return -1000;
+ }
+
+}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/handler/ErrorExceptionHandler.java b/blade-gateway/src/main/java/org/springblade/gateway/handler/ErrorExceptionHandler.java
index 29afa0e4..8746849f 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/handler/ErrorExceptionHandler.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/handler/ErrorExceptionHandler.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,17 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springblade.gateway.handler;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.RequiredArgsConstructor;
import org.springblade.gateway.provider.ResponseProvider;
-import org.springframework.boot.autoconfigure.web.ErrorProperties;
-import org.springframework.boot.autoconfigure.web.ResourceProperties;
-import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
-import org.springframework.boot.web.reactive.error.ErrorAttributes;
-import org.springframework.cloud.gateway.support.NotFoundException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.reactive.function.server.*;
+import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+import org.springframework.core.io.buffer.DataBufferFactory;
+import org.springframework.http.MediaType;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ResponseStatusException;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
import java.util.Map;
@@ -32,62 +38,51 @@
*
* @author Chill
*/
-public class ErrorExceptionHandler extends DefaultErrorWebExceptionHandler {
+@Order(-1)
+@Configuration(proxyBeanMethods = false)
+@RequiredArgsConstructor
+public class ErrorExceptionHandler implements ErrorWebExceptionHandler {
- public ErrorExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
- ErrorProperties errorProperties, ApplicationContext applicationContext) {
- super(errorAttributes, resourceProperties, errorProperties, applicationContext);
- }
+ private final ObjectMapper objectMapper;
- /**
- * 获取异常属性
- */
@Override
- protected Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
- int code = 500;
- Throwable error = super.getError(request);
- if (error instanceof NotFoundException) {
- code = 404;
+ public Mono handle(ServerWebExchange exchange, Throwable ex) {
+ ServerHttpRequest request = exchange.getRequest();
+ ServerHttpResponse response = exchange.getResponse();
+
+ if (response.isCommitted()) {
+ return Mono.error(ex);
}
- if (error instanceof ResponseStatusException) {
- code = ((ResponseStatusException) error).getStatus().value();
+
+ response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
+ if (ex instanceof ResponseStatusException) {
+ response.setStatusCode(((ResponseStatusException) ex).getStatusCode());
}
- return ResponseProvider.response(code, this.buildMessage(request, error));
- }
- /**
- * 指定响应处理方法为JSON处理的方法
- *
- * @param errorAttributes
- */
- @Override
- protected RouterFunction getRoutingFunction(ErrorAttributes errorAttributes) {
- return RouterFunctions.route(RequestPredicates.all(), this::renderErrorResponse);
+ return response.writeWith(Mono.fromSupplier(() -> {
+ DataBufferFactory bufferFactory = response.bufferFactory();
+ try {
+ int status = 500;
+ if (response.getStatusCode() != null) {
+ status = response.getStatusCode().value();
+ }
+ Map result = ResponseProvider.response(status, this.buildMessage(request, ex));
+ return bufferFactory.wrap(objectMapper.writeValueAsBytes(result));
+ } catch (JsonProcessingException e) {
+ return bufferFactory.wrap(new byte[0]);
+ }
+ }));
}
- /**
- * 根据code获取对应的HttpStatus
- *
- * @param errorAttributes
- * @return
- */
- @Override
- protected int getHttpStatus(Map errorAttributes) {
- return (int) errorAttributes.get("code");
- }
/**
* 构建异常信息
- *
- * @param request
- * @param ex
- * @return
*/
- private String buildMessage(ServerRequest request, Throwable ex) {
+ private String buildMessage(ServerHttpRequest request, Throwable ex) {
StringBuilder message = new StringBuilder("Failed to handle request [");
- message.append(request.methodName());
+ message.append(request.getMethod().name());
message.append(" ");
- message.append(request.uri());
+ message.append(request.getURI());
message.append("]");
if (ex != null) {
message.append(": ");
@@ -96,4 +91,5 @@ private String buildMessage(ServerRequest request, Throwable ex) {
return message.toString();
}
+
}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerResourceHandler.java b/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerResourceHandler.java
deleted file mode 100644
index 2885b31f..00000000
--- a/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerResourceHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
- *
- * 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 org.springblade.gateway.handler;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.web.reactive.function.BodyInserters;
-import org.springframework.web.reactive.function.server.HandlerFunction;
-import org.springframework.web.reactive.function.server.ServerRequest;
-import org.springframework.web.reactive.function.server.ServerResponse;
-import reactor.core.publisher.Mono;
-import springfox.documentation.swagger.web.SwaggerResourcesProvider;
-
-/**
- * SwaggerResourceHandler
- *
- * @author lengleng
- */
-@Slf4j
-@Component
-@RequiredArgsConstructor
-public class SwaggerResourceHandler implements HandlerFunction {
- private final SwaggerResourcesProvider swaggerResources;
-
- /**
- * Handle the given request.
- *
- * @param request the request to handler
- * @return the response
- */
- @Override
- public Mono handle(ServerRequest request) {
- return ServerResponse.status(HttpStatus.OK)
- .contentType(MediaType.APPLICATION_JSON)
- .body(BodyInserters.fromValue(swaggerResources.get()));
- }
-}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerSecurityHandler.java b/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerSecurityHandler.java
deleted file mode 100644
index d30f477f..00000000
--- a/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerSecurityHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
- *
- * 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 org.springblade.gateway.handler;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.web.reactive.function.BodyInserters;
-import org.springframework.web.reactive.function.server.HandlerFunction;
-import org.springframework.web.reactive.function.server.ServerRequest;
-import org.springframework.web.reactive.function.server.ServerResponse;
-import reactor.core.publisher.Mono;
-import springfox.documentation.swagger.web.SecurityConfigurationBuilder;
-
-/**
- * SwaggerSecurityHandler
- *
- * @author lengleng
- */
-@Slf4j
-@Component
-public class SwaggerSecurityHandler implements HandlerFunction {
-
- /**
- * Handle the given request.
- *
- * @param request the request to handler
- * @return the response
- */
- @Override
- public Mono handle(ServerRequest request) {
- return ServerResponse.status(HttpStatus.OK)
- .contentType(MediaType.APPLICATION_JSON)
- .body(BodyInserters.fromValue(SecurityConfigurationBuilder.builder().build()));
- }
-}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerUiHandler.java b/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerUiHandler.java
deleted file mode 100644
index 8bb78af1..00000000
--- a/blade-gateway/src/main/java/org/springblade/gateway/handler/SwaggerUiHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
- *
- * 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 org.springblade.gateway.handler;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.web.reactive.function.BodyInserters;
-import org.springframework.web.reactive.function.server.HandlerFunction;
-import org.springframework.web.reactive.function.server.ServerRequest;
-import org.springframework.web.reactive.function.server.ServerResponse;
-import reactor.core.publisher.Mono;
-import springfox.documentation.swagger.web.UiConfigurationBuilder;
-
-/**
- * SwaggerUiHandler
- *
- * @author lengleng
- */
-@Slf4j
-@Component
-public class SwaggerUiHandler implements HandlerFunction {
-
- /**
- * Handle the given request.
- *
- * @param request the request to handler
- * @return the response
- */
- @Override
- public Mono handle(ServerRequest request) {
- return ServerResponse.status(HttpStatus.OK)
- .contentType(MediaType.APPLICATION_JSON)
- .body(BodyInserters.fromValue(UiConfigurationBuilder.builder().build()));
- }
-}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/props/AuthProperties.java b/blade-gateway/src/main/java/org/springblade/gateway/props/AuthProperties.java
index 38a924db..2f77c8b0 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/props/AuthProperties.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/props/AuthProperties.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/props/JwtProperties.java b/blade-gateway/src/main/java/org/springblade/gateway/props/JwtProperties.java
new file mode 100644
index 00000000..7baef528
--- /dev/null
+++ b/blade-gateway/src/main/java/org/springblade/gateway/props/JwtProperties.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.gateway.props;
+
+import io.jsonwebtoken.JwtException;
+import lombok.Data;
+import org.springblade.core.launch.constant.TokenConstant;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * JWT配置
+ *
+ * @author Chill
+ */
+@Data
+@ConfigurationProperties("blade.token")
+public class JwtProperties {
+
+ /**
+ * token是否有状态
+ */
+ private Boolean state = Boolean.FALSE;
+
+ /**
+ * 是否只可同时在线一人
+ */
+ private Boolean single = Boolean.FALSE;
+
+ /**
+ * token签名
+ */
+ private String signKey = "";
+
+ /**
+ * 获取签名规则
+ */
+ public String getSignKey() {
+ if (this.signKey.length() < TokenConstant.SIGN_KEY_LENGTH) {
+ throw new JwtException("请配置 blade.token.sign-key 的值, 长度32位以上");
+ }
+ return this.signKey;
+ }
+
+}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/props/RequestProperties.java b/blade-gateway/src/main/java/org/springblade/gateway/props/RequestProperties.java
new file mode 100644
index 00000000..3250e008
--- /dev/null
+++ b/blade-gateway/src/main/java/org/springblade/gateway/props/RequestProperties.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.gateway.props;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Request配置类
+ *
+ * @author Chill
+ */
+@Data
+@ConfigurationProperties("blade.request")
+public class RequestProperties {
+
+ /**
+ * 开启自定义request
+ */
+ private Boolean enabled = true;
+
+ /**
+ * 放行url
+ */
+ private List skipUrl = new ArrayList<>();
+
+ /**
+ * 禁用url
+ */
+ private List blockUrl = new ArrayList<>();
+
+ /**
+ * 白名单,支持通配符,例如:10.20.0.8*、10.20.0.*
+ */
+ private List whiteList = new ArrayList<>();
+
+ /**
+ * 黑名单,支持通配符,例如:10.20.0.8*、10.20.0.*
+ */
+ private List blackList = new ArrayList<>();
+
+}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java b/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java
index 5be38628..7756bf00 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,34 +27,32 @@
*/
public class AuthProvider {
- public static String TARGET = "/**";
- public static String REPLACEMENT = "";
public static String AUTH_KEY = TokenConstant.HEADER;
- private static List defaultSkipUrl = new ArrayList<>();
+ private static final List DEFAULT_SKIP_URL = new ArrayList<>();
static {
- defaultSkipUrl.add("/example");
- defaultSkipUrl.add("/token/**");
- defaultSkipUrl.add("/captcha/**");
- defaultSkipUrl.add("/actuator/health/**");
- defaultSkipUrl.add("/v2/api-docs/**");
- defaultSkipUrl.add("/auth/**");
- defaultSkipUrl.add("/oauth/**");
- defaultSkipUrl.add("/log/**");
- defaultSkipUrl.add("/menu/routes");
- defaultSkipUrl.add("/menu/auth-routes");
- defaultSkipUrl.add("/tenant/info");
- defaultSkipUrl.add("/order/create/**");
- defaultSkipUrl.add("/storage/deduct/**");
- defaultSkipUrl.add("/error/**");
- defaultSkipUrl.add("/assets/**");
+ DEFAULT_SKIP_URL.add("/example");
+ DEFAULT_SKIP_URL.add("/token/**");
+ DEFAULT_SKIP_URL.add("/captcha/**");
+ DEFAULT_SKIP_URL.add("/actuator/health/**");
+ DEFAULT_SKIP_URL.add("/v3/api-docs/**");
+ DEFAULT_SKIP_URL.add("/auth/**");
+ DEFAULT_SKIP_URL.add("/oauth/**");
+ DEFAULT_SKIP_URL.add("/log/**");
+ DEFAULT_SKIP_URL.add("/menu/routes");
+ DEFAULT_SKIP_URL.add("/menu/auth-routes");
+ DEFAULT_SKIP_URL.add("/tenant/info");
+ DEFAULT_SKIP_URL.add("/order/create/**");
+ DEFAULT_SKIP_URL.add("/storage/deduct/**");
+ DEFAULT_SKIP_URL.add("/error/**");
+ DEFAULT_SKIP_URL.add("/assets/**");
}
/**
* 默认无需鉴权的API
*/
public static List getDefaultSkipUrl() {
- return defaultSkipUrl;
+ return DEFAULT_SKIP_URL;
}
}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/provider/ResponseProvider.java b/blade-gateway/src/main/java/org/springblade/gateway/provider/ResponseProvider.java
index cf4eb429..676a6882 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/provider/ResponseProvider.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/provider/ResponseProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ public static Map error(String message) {
public static Map response(int status, String message) {
Map map = new HashMap<>(16);
map.put("code", status);
- map.put("message", message);
+ map.put("msg", message);
map.put("data", null);
return map;
}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/provider/SwaggerProvider.java b/blade-gateway/src/main/java/org/springblade/gateway/provider/SwaggerProvider.java
deleted file mode 100644
index c4700f2e..00000000
--- a/blade-gateway/src/main/java/org/springblade/gateway/provider/SwaggerProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
- *
- * 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 org.springblade.gateway.provider;
-
-import lombok.AllArgsConstructor;
-import org.springblade.gateway.props.RouteProperties;
-import org.springblade.gateway.props.RouteResource;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-import springfox.documentation.swagger.web.SwaggerResource;
-import springfox.documentation.swagger.web.SwaggerResourcesProvider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 聚合接口文档注册
- *
- * @author Chill
- */
-@Primary
-@Component
-@AllArgsConstructor
-public class SwaggerProvider implements SwaggerResourcesProvider {
- private static final String API_URI = "/v2/api-docs";
-
- private RouteProperties routeProperties;
-
- @Override
- public List get() {
- List resources = new ArrayList<>();
- List routeResources = routeProperties.getResources();
- routeResources.forEach(routeResource -> resources.add(swaggerResource(routeResource)));
- return resources;
- }
-
- private SwaggerResource swaggerResource(RouteResource routeResource) {
- SwaggerResource swaggerResource = new SwaggerResource();
- swaggerResource.setName(routeResource.getName());
- swaggerResource.setLocation(routeResource.getLocation().concat(API_URI));
- swaggerResource.setSwaggerVersion(routeResource.getVersion());
- return swaggerResource;
- }
-
-}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtCrypto.java b/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtCrypto.java
new file mode 100644
index 00000000..30f7fe68
--- /dev/null
+++ b/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtCrypto.java
@@ -0,0 +1,202 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.gateway.utils;
+
+import lombok.SneakyThrows;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+import reactor.util.annotation.Nullable;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Objects;
+
+/**
+ * JwtCrypto
+ *
+ * @author Chill
+ */
+public class JwtCrypto {
+
+ public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
+ public static final String BLADE_CRYPTO_AES_KEY = "blade.token.aes-key";
+
+
+ /**
+ * Base64加密
+ *
+ * @param content 文本内容
+ * @param aesTextKey 文本密钥
+ * @return {String}
+ */
+ public static String encryptToString(String content, String aesTextKey) {
+ return Base64.getEncoder().encodeToString(encrypt(content, aesTextKey));
+ }
+
+ /**
+ * Base64加密
+ *
+ * @param content 内容
+ * @param aesTextKey 文本密钥
+ * @return {String}
+ */
+ public static String encryptToString(byte[] content, String aesTextKey) {
+ return Base64.getEncoder().encodeToString(encrypt(content, aesTextKey));
+ }
+
+ /**
+ * 加密
+ *
+ * @param content 文本内容
+ * @param aesTextKey 文本密钥
+ * @return byte[]
+ */
+ public static byte[] encrypt(String content, String aesTextKey) {
+ return encrypt(content.getBytes(DEFAULT_CHARSET), aesTextKey);
+ }
+
+ /**
+ * 加密
+ *
+ * @param content 文本内容
+ * @param charset 编码
+ * @param aesTextKey 文本密钥
+ * @return byte[]
+ */
+ public static byte[] encrypt(String content, Charset charset, String aesTextKey) {
+ return encrypt(content.getBytes(charset), aesTextKey);
+ }
+
+ /**
+ * 加密
+ *
+ * @param content 内容
+ * @param aesTextKey 文本密钥
+ * @return byte[]
+ */
+ public static byte[] encrypt(byte[] content, String aesTextKey) {
+ return encrypt(content, Objects.requireNonNull(aesTextKey).getBytes(DEFAULT_CHARSET));
+ }
+
+ /**
+ * Base64解密
+ *
+ * @param content 文本内容
+ * @param aesTextKey 文本密钥
+ * @return {String}
+ */
+ @Nullable
+ public static String decryptToString(@Nullable String content, @Nullable String aesTextKey) {
+ if (!StringUtils.hasText(content) || !StringUtils.hasText(aesTextKey)) {
+ return null;
+ }
+ byte[] hexBytes = decrypt(Base64.getDecoder().decode(content.getBytes(DEFAULT_CHARSET)), aesTextKey);
+ return new String(hexBytes, DEFAULT_CHARSET);
+ }
+
+
+ /**
+ * 解密
+ *
+ * @param content 内容
+ * @param aesTextKey 文本密钥
+ * @return byte[]
+ */
+ public static byte[] decrypt(byte[] content, String aesTextKey) {
+ return decrypt(content, Objects.requireNonNull(aesTextKey).getBytes(DEFAULT_CHARSET));
+ }
+
+
+ /**
+ * 解密
+ *
+ * @param content 内容
+ * @param aesKey 密钥
+ * @return byte[]
+ */
+ public static byte[] encrypt(byte[] content, byte[] aesKey) {
+ return aes(Pkcs7Encoder.encode(content), aesKey, Cipher.ENCRYPT_MODE);
+ }
+
+ /**
+ * 加密
+ *
+ * @param encrypted 内容
+ * @param aesKey 密钥
+ * @return byte[]
+ */
+ public static byte[] decrypt(byte[] encrypted, byte[] aesKey) {
+ return Pkcs7Encoder.decode(aes(encrypted, aesKey, Cipher.DECRYPT_MODE));
+ }
+
+ /**
+ * ase加密
+ *
+ * @param encrypted 内容
+ * @param aesKey 密钥
+ * @param mode 模式
+ * @return byte[]
+ */
+ @SneakyThrows
+ private static byte[] aes(byte[] encrypted, byte[] aesKey, int mode) {
+ Assert.isTrue(aesKey.length == 32, "IllegalAesKey, aesKey's length must be 32");
+ Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+ SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
+ IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
+ cipher.init(mode, keySpec, iv);
+ return cipher.doFinal(encrypted);
+ }
+
+ /**
+ * 提供基于PKCS7算法的加解密接口.
+ */
+ private static class Pkcs7Encoder {
+ private static final int BLOCK_SIZE = 32;
+
+ private static byte[] encode(byte[] src) {
+ int count = src.length;
+ // 计算需要填充的位数
+ int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
+ // 获得补位所用的字符
+ byte pad = (byte) (amountToPad & 0xFF);
+ byte[] pads = new byte[amountToPad];
+ for (int index = 0; index < amountToPad; index++) {
+ pads[index] = pad;
+ }
+ int length = count + amountToPad;
+ byte[] dest = new byte[length];
+ System.arraycopy(src, 0, dest, 0, count);
+ System.arraycopy(pads, 0, dest, count, amountToPad);
+ return dest;
+ }
+
+ private static byte[] decode(byte[] decrypted) {
+ int pad = decrypted[decrypted.length - 1];
+ if (pad < 1 || pad > BLOCK_SIZE) {
+ pad = 0;
+ }
+ if (pad > 0) {
+ return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
+ }
+ return decrypted;
+ }
+ }
+}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtUtil.java b/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtUtil.java
index 2d05163d..5c374aab 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtUtil.java
+++ b/blade-gateway/src/main/java/org/springblade/gateway/utils/JwtUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,9 @@
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
+import lombok.Getter;
import org.springblade.core.launch.constant.TokenConstant;
+import org.springblade.gateway.props.JwtProperties;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
@@ -29,27 +31,68 @@
*/
public class JwtUtil {
- public static String SIGN_KEY = TokenConstant.SIGN_KEY;
public static String BEARER = TokenConstant.BEARER;
+ public static String CRYPTO = TokenConstant.CRYPTO;
public static Integer AUTH_LENGTH = 7;
- public static String BASE64_SECURITY = Base64.getEncoder().encodeToString(SIGN_KEY.getBytes(StandardCharsets.UTF_8));
+ /**
+ * jwt配置
+ */
+ @Getter
+ private static JwtProperties jwtProperties;
+
+ public static void setJwtProperties(JwtProperties properties) {
+ if (JwtUtil.jwtProperties == null) {
+ JwtUtil.jwtProperties = properties;
+ }
+ }
/**
- * 获取token串
+ * 签名加密
+ */
+ public static String getBase64Security() {
+ return Base64.getEncoder().encodeToString(getJwtProperties().getSignKey().getBytes(StandardCharsets.UTF_8));
+ }
+
+ /**
+ * 获取请求传递的token串
*
* @param auth token
* @return String
*/
public static String getToken(String auth) {
+ if (isBearer(auth) || isCrypto(auth)) {
+ return auth.substring(AUTH_LENGTH);
+ }
+ return null;
+ }
+
+ /**
+ * 判断token类型为bearer
+ *
+ * @param auth token
+ * @return String
+ */
+ public static Boolean isBearer(String auth) {
if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
String headStr = auth.substring(0, 6).toLowerCase();
- if (headStr.compareTo(BEARER) == 0) {
- auth = auth.substring(7);
- }
- return auth;
+ return headStr.compareTo(BEARER) == 0;
}
- return null;
+ return false;
+ }
+
+ /**
+ * 判断token类型为crypto
+ *
+ * @param auth token
+ * @return String
+ */
+ public static Boolean isCrypto(String auth) {
+ if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
+ String headStr = auth.substring(0, 6).toLowerCase();
+ return headStr.compareTo(CRYPTO) == 0;
+ }
+ return false;
}
/**
@@ -61,7 +104,7 @@ public static String getToken(String auth) {
public static Claims parseJWT(String jsonWebToken) {
try {
return Jwts.parserBuilder()
- .setSigningKey(Base64.getDecoder().decode(JwtUtil.BASE64_SECURITY)).build()
+ .setSigningKey(Base64.getDecoder().decode(getBase64Security())).build()
.parseClaimsJws(jsonWebToken).getBody();
} catch (Exception ex) {
return null;
diff --git a/blade-gateway/src/main/resources/application-dev.yml b/blade-gateway/src/main/resources/application-dev.yml
new file mode 100644
index 00000000..b8eaf546
--- /dev/null
+++ b/blade-gateway/src/main/resources/application-dev.yml
@@ -0,0 +1,11 @@
+blade:
+ #多团队协作服务配置
+ loadbalancer:
+ #开启配置
+ enabled: true
+ #灰度版本
+ #version: 3.0.0
+ #负载均衡优先调用的ip段
+ prior-ip-pattern:
+ - 192.168.0.*
+ - 127.0.0.1
diff --git a/blade-gateway/src/main/resources/application.yml b/blade-gateway/src/main/resources/application.yml
new file mode 100644
index 00000000..d0c33710
--- /dev/null
+++ b/blade-gateway/src/main/resources/application.yml
@@ -0,0 +1,16 @@
+knife4j:
+ gateway:
+ enabled: true
+ tags-sorter: order
+ operations-sorter: order
+ # 指定服务发现的模式聚合微服务文档,并且是默认`default`分组
+ strategy: discover
+ discover:
+ enabled: true
+ # 指定版本号(Swagger2|OpenAPI3)
+ version : openapi3
+ # 需要排除的微服务(eg:网关服务)
+ excluded-services:
+ - blade-admin
+ - blade-gateway
+ - blade-log
diff --git a/blade-gateway/src/main/resources/bootstrap.yml b/blade-gateway/src/main/resources/bootstrap.yml
index e875240d..4172f5d6 100644
--- a/blade-gateway/src/main/resources/bootstrap.yml
+++ b/blade-gateway/src/main/resources/bootstrap.yml
@@ -3,9 +3,6 @@ server:
spring:
cloud:
- discovery:
- reactive:
- enabled: false
gateway:
discovery:
locator:
@@ -14,15 +11,4 @@ spring:
retry:
enabled: true
-# 聚合文档配置
-blade:
- document:
- resources:
- - name: 授权模块
- location: /blade-auth
- - name: 工作台模块
- location: /blade-desk
- - name: 系统模块
- location: /blade-system
-
diff --git a/blade-ops/blade-admin/Dockerfile b/blade-ops/blade-admin/Dockerfile
index 67119b9b..61e5f627 100644
--- a/blade-ops/blade-admin/Dockerfile
+++ b/blade-ops/blade-admin/Dockerfile
@@ -1,6 +1,6 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
+FROM bladex/alpine-java:openjdk17_cn_slim
-MAINTAINER smallchill@163.com
+MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/admin
@@ -10,6 +10,6 @@ EXPOSE 7002
ADD ./target/blade-admin.jar ./app.jar
-ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
diff --git a/blade-ops/blade-admin/pom.xml b/blade-ops/blade-admin/pom.xml
index 39eaf49a..9c150af2 100644
--- a/blade-ops/blade-admin/pom.xml
+++ b/blade-ops/blade-admin/pom.xml
@@ -5,13 +5,12 @@
blade-ops
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-admin
${project.artifactId}
- ${blade.project.version}
jar
@@ -19,22 +18,18 @@
org.springblade
blade-common
- ${blade.project.version}
org.springblade
blade-core-launch
- ${blade.tool.version}
org.springblade
blade-core-tool
- ${blade.tool.version}
org.springblade
blade-core-cloud
- ${blade.tool.version}
org.springblade
@@ -46,7 +41,6 @@
de.codecentric
spring-boot-admin-starter-server
- ${spring.boot.admin.version}
@@ -75,22 +69,6 @@
org.apache.maven.plugins
maven-antrun-plugin
-
-
- package
-
- run
-
-
-
-
-
-
-
-
-
diff --git a/blade-ops/blade-admin/src/main/java/org/springblade/admin/AdminApplication.java b/blade-ops/blade-admin/src/main/java/org/springblade/admin/AdminApplication.java
index 4e4ece61..f5769a2b 100644
--- a/blade-ops/blade-admin/src/main/java/org/springblade/admin/AdminApplication.java
+++ b/blade-ops/blade-admin/src/main/java/org/springblade/admin/AdminApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +16,9 @@
package org.springblade.admin;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
/**
* admin启动器
@@ -26,7 +26,7 @@
* @author Chill
*/
@EnableAdminServer
-@SpringCloudApplication
+@BladeCloudApplication
public class AdminApplication {
public static void main(String[] args) {
diff --git a/blade-ops/blade-develop/Dockerfile b/blade-ops/blade-develop/Dockerfile
new file mode 100644
index 00000000..37c0333b
--- /dev/null
+++ b/blade-ops/blade-develop/Dockerfile
@@ -0,0 +1,15 @@
+FROM bladex/alpine-java:openjdk17_cn_slim
+
+MAINTAINER bladejava@qq.com
+
+RUN mkdir -p /blade/develop
+
+WORKDIR /blade/develop
+
+EXPOSE 7007
+
+ADD ./target/blade-develop.jar ./app.jar
+
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+
+CMD ["--spring.profiles.active=test"]
diff --git a/blade-ops/blade-develop/pom.xml b/blade-ops/blade-develop/pom.xml
index ab6b6fbf..3d8ecea8 100644
--- a/blade-ops/blade-develop/pom.xml
+++ b/blade-ops/blade-develop/pom.xml
@@ -6,14 +6,13 @@
org.springblade
blade-ops
- 2.8.0
+ ${revision}
4.0.0
blade-develop
${project.artifactId}
- ${blade.project.version}
jar
@@ -21,39 +20,18 @@
org.springblade
blade-core-boot
- ${blade.tool.version}
org.springblade
blade-common
- ${blade.project.version}
org.springblade
- blade-core-develop
- ${blade.tool.version}
-
-
-
- io.springfox
- springfox-swagger2
- ${swagger.version}
-
-
- io.swagger
- swagger-models
-
-
-
-
- io.swagger
- swagger-models
- ${swagger.models.version}
+ blade-starter-develop
org.springblade
blade-dict-api
- ${blade.project.version}
@@ -64,28 +42,24 @@
docker-maven-plugin
${docker.plugin.version}
- true
+ ${docker.registry.url}/blade/${project.artifactId}:${project.version}
+ ${project.basedir}
+ ${docker.registry.host}
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.jar
+
+
+ ${docker.registry.url}
+ ${docker.registry.url}
+ true
org.apache.maven.plugins
maven-antrun-plugin
-
-
- package
-
- run
-
-
-
-
-
-
-
-
-
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/DevelopApplication.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/DevelopApplication.java
index 1c894544..a38357c2 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/DevelopApplication.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/DevelopApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,18 +15,16 @@
*/
package org.springblade.develop;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* Develop启动器
*
* @author Chill
*/
-@SpringCloudApplication
-@EnableFeignClients(AppConstant.BASE_PACKAGES)
+@BladeCloudApplication
public class DevelopApplication {
public static void main(String[] args) {
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java
index 2e6908ed..867b7e19 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,14 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.*;
+import io.swagger.v3.oas.annotations.Hidden;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
@@ -32,9 +39,7 @@
import org.springblade.develop.service.IDatasourceService;
import org.springblade.develop.support.BladeCodeGenerator;
import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
-import javax.validation.Valid;
import java.util.Collection;
import java.util.Map;
@@ -43,11 +48,11 @@
*
* @author Chill
*/
-@ApiIgnore
+@Hidden
@RestController
@AllArgsConstructor
@RequestMapping("/code")
-@Api(value = "代码生成", tags = "代码生成")
+@Tag(name = "代码生成", description = "代码生成")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class CodeController extends BladeController {
@@ -59,7 +64,7 @@ public class CodeController extends BladeController {
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
- @ApiOperation(value = "详情", notes = "传入code")
+ @Operation(summary = "详情", description = "传入code")
public R detail(Code code) {
Code detail = codeService.getOne(Condition.getQueryWrapper(code));
return R.data(detail);
@@ -69,14 +74,14 @@ public R detail(Code code) {
* 分页
*/
@GetMapping("/list")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "codeName", value = "模块名", paramType = "query", dataType = "string"),
- @ApiImplicitParam(name = "tableName", value = "表名", paramType = "query", dataType = "string"),
- @ApiImplicitParam(name = "modelName", value = "实体名", paramType = "query", dataType = "string")
+ @Parameters({
+ @Parameter(name = "codeName", description = "模块名", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
+ @Parameter(name = "tableName", description = "表名", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
+ @Parameter(name = "modelName", description = "实体名", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
})
@ApiOperationSupport(order = 2)
- @ApiOperation(value = "分页", notes = "传入code")
- public R> list(@ApiIgnore @RequestParam Map code, Query query) {
+ @Operation(summary = "分页", description = "传入code")
+ public R> list(@Parameter(hidden = true) @RequestParam Map code, Query query) {
IPage pages = codeService.page(Condition.getPage(query), Condition.getQueryWrapper(code, Code.class));
return R.data(pages);
}
@@ -86,7 +91,7 @@ public R> list(@ApiIgnore @RequestParam Map code, Qu
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
- @ApiOperation(value = "新增或修改", notes = "传入code")
+ @Operation(summary = "新增或修改", description = "传入code")
public R submit(@Valid @RequestBody Code code) {
return R.status(codeService.submit(code));
}
@@ -97,8 +102,8 @@ public R submit(@Valid @RequestBody Code code) {
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
- @ApiOperation(value = "删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ @Operation(summary = "删除", description = "传入ids")
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(codeService.removeByIds(Func.toLongList(ids)));
}
@@ -107,8 +112,8 @@ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam
*/
@PostMapping("/copy")
@ApiOperationSupport(order = 5)
- @ApiOperation(value = "复制", notes = "传入id")
- public R copy(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
+ @Operation(summary = "复制", description = "传入id")
+ public R copy(@Parameter(description = "主键", required = true) @RequestParam Long id) {
Code code = codeService.getById(id);
code.setId(null);
code.setCodeName(code.getCodeName() + "-copy");
@@ -120,8 +125,8 @@ public R copy(@ApiParam(value = "主键", required = true) @RequestParam Long id
*/
@PostMapping("/gen-code")
@ApiOperationSupport(order = 6)
- @ApiOperation(value = "代码生成", notes = "传入ids")
- public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) {
+ @Operation(summary = "代码生成", description = "传入ids")
+ public R genCode(@Parameter(description = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "saber3") String system) {
Collection codes = codeService.listByIds(Func.toLongList(ids));
codes.forEach(code -> {
BladeCodeGenerator generator = new BladeCodeGenerator();
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/DatasourceController.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/DatasourceController.java
index 4ca5a887..4677ac66 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/DatasourceController.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/DatasourceController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,9 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
@@ -30,7 +30,7 @@
import org.springblade.develop.service.IDatasourceService;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
+import jakarta.validation.Valid;
import java.util.List;
/**
@@ -41,7 +41,7 @@
@RestController
@AllArgsConstructor
@RequestMapping("/datasource")
-@Api(value = "数据源配置表", tags = "数据源配置表接口")
+@Tag(name = "数据源配置表", description = "数据源配置表接口")
public class DatasourceController extends BladeController {
private IDatasourceService datasourceService;
@@ -51,7 +51,7 @@ public class DatasourceController extends BladeController {
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
- @ApiOperation(value = "详情", notes = "传入datasource")
+ @Operation(summary = "详情", description = "传入datasource")
public R detail(Datasource datasource) {
Datasource detail = datasourceService.getOne(Condition.getQueryWrapper(datasource));
return R.data(detail);
@@ -62,7 +62,7 @@ public R detail(Datasource datasource) {
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
- @ApiOperation(value = "分页", notes = "传入datasource")
+ @Operation(summary = "分页", description = "传入datasource")
public R> list(Datasource datasource, Query query) {
IPage pages = datasourceService.page(Condition.getPage(query), Condition.getQueryWrapper(datasource));
return R.data(pages);
@@ -73,7 +73,7 @@ public R> list(Datasource datasource, Query query) {
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
- @ApiOperation(value = "新增", notes = "传入datasource")
+ @Operation(summary = "新增", description = "传入datasource")
public R save(@Valid @RequestBody Datasource datasource) {
return R.status(datasourceService.save(datasource));
}
@@ -83,7 +83,7 @@ public R save(@Valid @RequestBody Datasource datasource) {
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
- @ApiOperation(value = "修改", notes = "传入datasource")
+ @Operation(summary = "修改", description = "传入datasource")
public R update(@Valid @RequestBody Datasource datasource) {
return R.status(datasourceService.updateById(datasource));
}
@@ -93,7 +93,7 @@ public R update(@Valid @RequestBody Datasource datasource) {
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
- @ApiOperation(value = "新增或修改", notes = "传入datasource")
+ @Operation(summary = "新增或修改", description = "传入datasource")
public R submit(@Valid @RequestBody Datasource datasource) {
datasource.setUrl(datasource.getUrl().replace("&", "&"));
return R.status(datasourceService.saveOrUpdate(datasource));
@@ -105,8 +105,8 @@ public R submit(@Valid @RequestBody Datasource datasource) {
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ @Operation(summary = "逻辑删除", description = "传入ids")
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(datasourceService.deleteLogic(Func.toLongList(ids)));
}
@@ -115,7 +115,7 @@ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam
*/
@GetMapping("/select")
@ApiOperationSupport(order = 8)
- @ApiOperation(value = "下拉数据源", notes = "查询列表")
+ @Operation(summary = "下拉数据源", description = "查询列表")
public R> select() {
List list = datasourceService.list();
return R.data(list);
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Code.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Code.java
index 390aee27..b04c3374 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Code.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Code.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -34,15 +34,16 @@
*/
@Data
@TableName("blade_code")
-@ApiModel(value = "Code对象", description = "Code对象")
+@Schema(description = "Code对象")
public class Code implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,75 +51,75 @@ public class Code implements Serializable {
/**
* 数据源主键
*/
- @ApiModelProperty(value = "数据源主键")
+ @Schema(description = "数据源主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long datasourceId;
/**
* 模块名称
*/
- @ApiModelProperty(value = "服务名称")
+ @Schema(description = "服务名称")
private String serviceName;
/**
* 模块名称
*/
- @ApiModelProperty(value = "模块名称")
+ @Schema(description = "模块名称")
private String codeName;
/**
* 表名
*/
- @ApiModelProperty(value = "表名")
+ @Schema(description = "表名")
private String tableName;
/**
* 实体名
*/
- @ApiModelProperty(value = "表前缀")
+ @Schema(description = "表前缀")
private String tablePrefix;
/**
* 主键名
*/
- @ApiModelProperty(value = "主键名")
+ @Schema(description = "主键名")
private String pkName;
/**
* 基础业务模式
*/
- @ApiModelProperty(value = "基础业务模式")
+ @Schema(description = "基础业务模式")
private Integer baseMode;
/**
* 包装器模式
*/
- @ApiModelProperty(value = "包装器模式")
+ @Schema(description = "包装器模式")
private Integer wrapMode;
/**
* 后端包名
*/
- @ApiModelProperty(value = "后端包名")
+ @Schema(description = "后端包名")
private String packageName;
/**
* 后端路径
*/
- @ApiModelProperty(value = "后端路径")
+ @Schema(description = "后端路径")
private String apiPath;
/**
* 前端路径
*/
- @ApiModelProperty(value = "前端路径")
+ @Schema(description = "前端路径")
private String webPath;
/**
* 是否已删除
*/
@TableLogic
- @ApiModelProperty(value = "是否已删除")
+ @Schema(description = "是否已删除")
private Integer isDeleted;
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Datasource.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Datasource.java
index c48085c1..1ea5e15a 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Datasource.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Datasource.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,13 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
+import java.io.Serial;
+
/**
* 数据源配置表实体类
*
@@ -34,15 +35,16 @@
@Data
@TableName("blade_datasource")
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "Datasource对象", description = "数据源配置表")
+@Schema(description = "Datasource对象")
public class Datasource extends BaseEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,32 +52,32 @@ public class Datasource extends BaseEntity {
/**
* 名称
*/
- @ApiModelProperty(value = "名称")
+ @Schema(description = "名称")
private String name;
/**
* 驱动类
*/
- @ApiModelProperty(value = "驱动类")
+ @Schema(description = "驱动类")
private String driverClass;
/**
* 连接地址
*/
- @ApiModelProperty(value = "连接地址")
+ @Schema(description = "连接地址")
private String url;
/**
* 用户名
*/
- @ApiModelProperty(value = "用户名")
+ @Schema(description = "用户名")
private String username;
/**
* 密码
*/
- @ApiModelProperty(value = "密码")
+ @Schema(description = "密码")
private String password;
/**
* 备注
*/
- @ApiModelProperty(value = "备注")
+ @Schema(description = "备注")
private String remark;
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/CodeMapper.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/CodeMapper.java
index ac38043b..8ed52191 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/CodeMapper.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/CodeMapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/DatasourceMapper.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/DatasourceMapper.java
index 3f3be53c..bb816518 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/DatasourceMapper.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/DatasourceMapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/ICodeService.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/ICodeService.java
index 38e25a77..49e0574e 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/ICodeService.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/ICodeService.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/IDatasourceService.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/IDatasourceService.java
index d8109f3e..0321b49d 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/IDatasourceService.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/IDatasourceService.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/CodeServiceImpl.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/CodeServiceImpl.java
index 83aaa96a..44f1c7f3 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/CodeServiceImpl.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/CodeServiceImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/DatasourceServiceImpl.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/DatasourceServiceImpl.java
index c14222e8..5d7cc075 100644
--- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/DatasourceServiceImpl.java
+++ b/blade-ops/blade-develop/src/main/java/org/springblade/develop/service/impl/DatasourceServiceImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm b/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm
index 58762e2d..3862210a 100644
--- a/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm
+++ b/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm
@@ -1,11 +1,11 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* 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
+ * http://www.gnu.org/licenses/lgpl.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,12 +15,12 @@
*/
package $!{package.Controller};
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
-import javax.validation.Valid;
+import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@@ -35,14 +35,15 @@ import $!{package.Entity}.$!{entity};
#set($voPackage=$package.Entity.replace("entity","vo"))
import $!{voPackage}.$!{entity}VO;
#set($wrapperPackage=$package.Entity.replace("entity","wrapper"))
+#if($!{hasWrapper})
import $!{wrapperPackage}.$!{entity}Wrapper;
+#end
import $!{package.Service}.$!{table.serviceName};
#if($!{superControllerClassPackage})
import $!{superControllerClassPackage};
#end
#if(!$!{superEntityClass})
#end
-import java.util.List;
/**
* $!{table.comment} 控制器
@@ -52,8 +53,8 @@ import java.util.List;
*/
@RestController
@AllArgsConstructor
-@RequestMapping("#if($!{package.ModuleName})/$!{package.ModuleName}#end/$!{cfg.entityKey}")
-@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口")
+@RequestMapping("#if($!{package.ModuleName})$!{package.ModuleName}#end/$!{entityKey}")
+@Tag(name = "$!{table.comment}", description = "$!{table.comment}接口")
#if($!{superControllerClass})
public class $!{table.controllerName} extends $!{superControllerClass} {
#else
@@ -62,65 +63,90 @@ public class $!{table.controllerName} {
private $!{table.serviceName} $!{table.entityPath}Service;
+#if($!{hasWrapper})
/**
- * 详情
- */
+ * 详情
+ */
@GetMapping("/detail")
- @ApiOperationSupport(order = 1)
- @ApiOperation(value = "详情", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "详情", description = "传入$!{table.entityPath}")
public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) {
$!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
return R.data($!{entity}Wrapper.build().entityVO(detail));
}
/**
- * 分页 $!{table.comment}
- */
+ * 分页 $!{table.comment}
+ */
@GetMapping("/list")
- @ApiOperationSupport(order = 2)
- @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "分页", description = "传入$!{table.entityPath}")
public R> list($!{entity} $!{table.entityPath}, Query query) {
IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
return R.data($!{entity}Wrapper.build().pageVO(pages));
}
+#else
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "详情", description = "传入$!{table.entityPath}")
+ public R<$!{entity}> detail($!{entity} $!{table.entityPath}) {
+ $!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页 $!{table.comment}
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "分页", description = "传入$!{table.entityPath}")
+ public R> list($!{entity} $!{table.entityPath}, Query query) {
+ IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
+ return R.data(pages);
+ }
+#end
+
/**
- * 自定义分页 $!{table.comment}
- */
+ * 自定义分页 $!{table.comment}
+ */
@GetMapping("/page")
- @ApiOperationSupport(order = 3)
- @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "分页", description = "传入$!{table.entityPath}")
public R> page($!{entity}VO $!{table.entityPath}, Query query) {
IPage<$!{entity}VO> pages = $!{table.entityPath}Service.select$!{entity}Page(Condition.getPage(query), $!{table.entityPath});
return R.data(pages);
}
/**
- * 新增 $!{table.comment}
- */
+ * 新增 $!{table.comment}
+ */
@PostMapping("/save")
- @ApiOperationSupport(order = 4)
- @ApiOperation(value = "新增", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "新增", description = "传入$!{table.entityPath}")
public R save(@Valid @RequestBody $!{entity} $!{table.entityPath}) {
return R.status($!{table.entityPath}Service.save($!{table.entityPath}));
}
/**
- * 修改 $!{table.comment}
- */
+ * 修改 $!{table.comment}
+ */
@PostMapping("/update")
- @ApiOperationSupport(order = 5)
- @ApiOperation(value = "修改", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "修改", description = "传入$!{table.entityPath}")
public R update(@Valid @RequestBody $!{entity} $!{table.entityPath}) {
return R.status($!{table.entityPath}Service.updateById($!{table.entityPath}));
}
/**
- * 新增或修改 $!{table.comment}
- */
+ * 新增或修改 $!{table.comment}
+ */
@PostMapping("/submit")
- @ApiOperationSupport(order = 6)
- @ApiOperation(value = "新增或修改", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "新增或修改", description = "传入$!{table.entityPath}")
public R submit(@Valid @RequestBody $!{entity} $!{table.entityPath}) {
return R.status($!{table.entityPath}Service.saveOrUpdate($!{table.entityPath}));
}
@@ -128,24 +154,24 @@ public class $!{table.controllerName} {
#if($!{superEntityClass})
/**
- * 删除 $!{table.comment}
- */
+ * 删除 $!{table.comment}
+ */
@PostMapping("/remove")
- @ApiOperationSupport(order = 7)
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ @ApiOperationSupport(order = 7)
+ @Operation(summary = "逻辑删除", description = "传入ids")
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
}
#else
/**
- * 删除 $!{table.comment}
- */
+ * 删除 $!{table.comment}
+ */
@PostMapping("/remove")
- @ApiOperationSupport(order = 7)
- @ApiOperation(value = "删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ @ApiOperationSupport(order = 8)
+ @Operation(summary = "删除", description = "传入ids")
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
}
diff --git a/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm b/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm
index 64a8b015..4c331cd7 100644
--- a/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm
+++ b/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}V
@Override
public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) {
- $!{entity}VO $!{table.entityPath}VO = BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class);
+ $!{entity}VO $!{table.entityPath}VO = BeanUtil.copyProperties($!{table.entityPath}, $!{entity}VO.class);
return $!{table.entityPath}VO;
}
diff --git a/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGenerator.java b/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGenerator.java
index 6cb84af7..373ac259 100644
--- a/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGenerator.java
+++ b/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGenerator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm b/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm
index 58762e2d..3862210a 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm
+++ b/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm
@@ -1,11 +1,11 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* 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
+ * http://www.gnu.org/licenses/lgpl.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,12 +15,12 @@
*/
package $!{package.Controller};
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
-import javax.validation.Valid;
+import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@@ -35,14 +35,15 @@ import $!{package.Entity}.$!{entity};
#set($voPackage=$package.Entity.replace("entity","vo"))
import $!{voPackage}.$!{entity}VO;
#set($wrapperPackage=$package.Entity.replace("entity","wrapper"))
+#if($!{hasWrapper})
import $!{wrapperPackage}.$!{entity}Wrapper;
+#end
import $!{package.Service}.$!{table.serviceName};
#if($!{superControllerClassPackage})
import $!{superControllerClassPackage};
#end
#if(!$!{superEntityClass})
#end
-import java.util.List;
/**
* $!{table.comment} 控制器
@@ -52,8 +53,8 @@ import java.util.List;
*/
@RestController
@AllArgsConstructor
-@RequestMapping("#if($!{package.ModuleName})/$!{package.ModuleName}#end/$!{cfg.entityKey}")
-@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口")
+@RequestMapping("#if($!{package.ModuleName})$!{package.ModuleName}#end/$!{entityKey}")
+@Tag(name = "$!{table.comment}", description = "$!{table.comment}接口")
#if($!{superControllerClass})
public class $!{table.controllerName} extends $!{superControllerClass} {
#else
@@ -62,65 +63,90 @@ public class $!{table.controllerName} {
private $!{table.serviceName} $!{table.entityPath}Service;
+#if($!{hasWrapper})
/**
- * 详情
- */
+ * 详情
+ */
@GetMapping("/detail")
- @ApiOperationSupport(order = 1)
- @ApiOperation(value = "详情", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "详情", description = "传入$!{table.entityPath}")
public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) {
$!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
return R.data($!{entity}Wrapper.build().entityVO(detail));
}
/**
- * 分页 $!{table.comment}
- */
+ * 分页 $!{table.comment}
+ */
@GetMapping("/list")
- @ApiOperationSupport(order = 2)
- @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "分页", description = "传入$!{table.entityPath}")
public R> list($!{entity} $!{table.entityPath}, Query query) {
IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
return R.data($!{entity}Wrapper.build().pageVO(pages));
}
+#else
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "详情", description = "传入$!{table.entityPath}")
+ public R<$!{entity}> detail($!{entity} $!{table.entityPath}) {
+ $!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页 $!{table.comment}
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "分页", description = "传入$!{table.entityPath}")
+ public R> list($!{entity} $!{table.entityPath}, Query query) {
+ IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
+ return R.data(pages);
+ }
+#end
+
/**
- * 自定义分页 $!{table.comment}
- */
+ * 自定义分页 $!{table.comment}
+ */
@GetMapping("/page")
- @ApiOperationSupport(order = 3)
- @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "分页", description = "传入$!{table.entityPath}")
public R> page($!{entity}VO $!{table.entityPath}, Query query) {
IPage<$!{entity}VO> pages = $!{table.entityPath}Service.select$!{entity}Page(Condition.getPage(query), $!{table.entityPath});
return R.data(pages);
}
/**
- * 新增 $!{table.comment}
- */
+ * 新增 $!{table.comment}
+ */
@PostMapping("/save")
- @ApiOperationSupport(order = 4)
- @ApiOperation(value = "新增", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "新增", description = "传入$!{table.entityPath}")
public R save(@Valid @RequestBody $!{entity} $!{table.entityPath}) {
return R.status($!{table.entityPath}Service.save($!{table.entityPath}));
}
/**
- * 修改 $!{table.comment}
- */
+ * 修改 $!{table.comment}
+ */
@PostMapping("/update")
- @ApiOperationSupport(order = 5)
- @ApiOperation(value = "修改", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "修改", description = "传入$!{table.entityPath}")
public R update(@Valid @RequestBody $!{entity} $!{table.entityPath}) {
return R.status($!{table.entityPath}Service.updateById($!{table.entityPath}));
}
/**
- * 新增或修改 $!{table.comment}
- */
+ * 新增或修改 $!{table.comment}
+ */
@PostMapping("/submit")
- @ApiOperationSupport(order = 6)
- @ApiOperation(value = "新增或修改", notes = "传入$!{table.entityPath}")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "新增或修改", description = "传入$!{table.entityPath}")
public R submit(@Valid @RequestBody $!{entity} $!{table.entityPath}) {
return R.status($!{table.entityPath}Service.saveOrUpdate($!{table.entityPath}));
}
@@ -128,24 +154,24 @@ public class $!{table.controllerName} {
#if($!{superEntityClass})
/**
- * 删除 $!{table.comment}
- */
+ * 删除 $!{table.comment}
+ */
@PostMapping("/remove")
- @ApiOperationSupport(order = 7)
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ @ApiOperationSupport(order = 7)
+ @Operation(summary = "逻辑删除", description = "传入ids")
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
}
#else
/**
- * 删除 $!{table.comment}
- */
+ * 删除 $!{table.comment}
+ */
@PostMapping("/remove")
- @ApiOperationSupport(order = 7)
- @ApiOperation(value = "删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ @ApiOperationSupport(order = 8)
+ @Operation(summary = "删除", description = "传入ids")
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
}
diff --git a/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm b/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm
index 64a8b015..4c331cd7 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm
+++ b/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}V
@Override
public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) {
- $!{entity}VO $!{table.entityPath}VO = BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class);
+ $!{entity}VO $!{table.entityPath}VO = BeanUtil.copyProperties($!{table.entityPath}, $!{entity}VO.class);
return $!{table.entityPath}VO;
}
diff --git a/blade-ops/blade-report/Dockerfile b/blade-ops/blade-report/Dockerfile
index a85a7910..3fae63ff 100644
--- a/blade-ops/blade-report/Dockerfile
+++ b/blade-ops/blade-report/Dockerfile
@@ -1,6 +1,6 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
+FROM bladex/alpine-java:openjdk17_cn_slim
-MAINTAINER smallchill@163.com
+MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/report
@@ -10,6 +10,6 @@ EXPOSE 8108
ADD ./target/blade-report.jar ./app.jar
-ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
diff --git a/blade-ops/blade-report/pom.xml b/blade-ops/blade-report/pom.xml
index b4e7e302..b72fbf3c 100644
--- a/blade-ops/blade-report/pom.xml
+++ b/blade-ops/blade-report/pom.xml
@@ -5,14 +5,13 @@
org.springblade
blade-ops
- 2.8.0
+ ${revision}
4.0.0
blade-report
${project.artifactId}
- ${blade.project.version}
jar
@@ -20,18 +19,44 @@
org.springblade
blade-core-boot
- ${blade.tool.version}
org.springblade
- blade-core-report
- ${blade.tool.version}
+ blade-starter-report
org.springblade
blade-common
- ${blade.project.version}
+
+
+
+ com.spotify
+ docker-maven-plugin
+ ${docker.plugin.version}
+
+ ${docker.registry.url}/blade/${project.artifactId}:${project.version}
+ ${project.basedir}
+ ${docker.registry.host}
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.jar
+
+
+ ${docker.registry.url}
+ ${docker.registry.url}
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+
+
diff --git a/blade-ops/blade-report/src/main/java/org/springblade/report/ReportApplication.java b/blade-ops/blade-report/src/main/java/org/springblade/report/ReportApplication.java
index 696a2cd4..02281b87 100644
--- a/blade-ops/blade-report/src/main/java/org/springblade/report/ReportApplication.java
+++ b/blade-ops/blade-report/src/main/java/org/springblade/report/ReportApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,16 @@
*/
package org.springblade.report;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
/**
* UReport启动器
*
* @author Chill
*/
-@SpringCloudApplication
+@BladeCloudApplication
public class ReportApplication {
public static void main(String[] args) {
diff --git a/blade-ops/blade-report/src/main/java/org/springblade/report/config/BladeReportConfiguration.java b/blade-ops/blade-report/src/main/java/org/springblade/report/config/BladeReportConfiguration.java
index 28171a91..10122bfe 100644
--- a/blade-ops/blade-report/src/main/java/org/springblade/report/config/BladeReportConfiguration.java
+++ b/blade-ops/blade-report/src/main/java/org/springblade/report/config/BladeReportConfiguration.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
*
* @author Chill
*/
-@Configuration
+@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "report.enabled", havingValue = "true", matchIfMissing = true)
public class BladeReportConfiguration {
diff --git a/blade-ops/blade-resource/Dockerfile b/blade-ops/blade-resource/Dockerfile
index 72ee5432..ca95c3dc 100644
--- a/blade-ops/blade-resource/Dockerfile
+++ b/blade-ops/blade-resource/Dockerfile
@@ -1,6 +1,6 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
+FROM bladex/alpine-java:openjdk17_cn_slim
-MAINTAINER smallchill@163.com
+MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/resource
@@ -10,6 +10,6 @@ EXPOSE 8010
ADD ./target/blade-resource.jar ./app.jar
-ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
diff --git a/blade-ops/blade-resource/pom.xml b/blade-ops/blade-resource/pom.xml
index e31e735f..7dc3b602 100644
--- a/blade-ops/blade-resource/pom.xml
+++ b/blade-ops/blade-resource/pom.xml
@@ -5,30 +5,26 @@
blade-ops
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-resource
${project.artifactId}
- ${blade.project.version}
jar
org.springblade
blade-common
- ${blade.project.version}
org.springblade
blade-core-tool
- ${blade.tool.version}
org.springblade
blade-core-cloud
- ${blade.tool.version}
org.springblade
@@ -38,8 +34,11 @@
org.springblade
- blade-core-oss
- ${blade.tool.version}
+ blade-starter-oss
+
+
+ org.springblade
+ blade-starter-swagger
@@ -68,22 +67,6 @@
org.apache.maven.plugins
maven-antrun-plugin
-
-
- package
-
- run
-
-
-
-
-
-
-
-
-
diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java
index c233c387..a044c17e 100644
--- a/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java
+++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,16 @@
*/
package org.springblade.resource;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
/**
* 资源启动器
*
* @author Chill
*/
-@SpringCloudApplication
+@BladeCloudApplication
public class ResourceApplication {
public static void main(String[] args) {
diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java
index 7cddd8f8..952528fb 100644
--- a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java
+++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
package org.springblade.resource.endpoint;
-import io.swagger.annotations.Api;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springblade.core.oss.QiniuTemplate;
@@ -34,7 +34,7 @@
@RestController
@AllArgsConstructor
@RequestMapping("/oss/endpoint")
-@Api(value = "对象存储端点", tags = "对象存储端点")
+@Tag(name = "对象存储端点", description = "对象存储端点")
public class OssEndpoint {
private QiniuTemplate qiniuTemplate;
diff --git a/blade-ops/blade-seata-order/pom.xml b/blade-ops/blade-seata-order/pom.xml
index 401dad8f..3d9a9c69 100644
--- a/blade-ops/blade-seata-order/pom.xml
+++ b/blade-ops/blade-seata-order/pom.xml
@@ -5,31 +5,44 @@
blade-ops
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-seata-order
${project.artifactId}
- ${blade.project.version}
jar
org.springblade
blade-common
- ${blade.project.version}
org.springblade
blade-core-boot
- ${blade.tool.version}
org.springblade
- blade-core-transaction
- ${blade.tool.version}
+ blade-starter-transaction
+
+
+
+ com.spotify
+ docker-maven-plugin
+ ${docker.plugin.version}
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+
+
diff --git a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/SeataOrderApplication.java b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/SeataOrderApplication.java
index f277f031..bff38d2a 100644
--- a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/SeataOrderApplication.java
+++ b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/SeataOrderApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/entity/Order.java b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/entity/Order.java
index 8ccac26a..48ac3976 100644
--- a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/entity/Order.java
+++ b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/entity/Order.java
@@ -6,6 +6,7 @@
import lombok.Data;
import lombok.experimental.Accessors;
+import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
@@ -19,6 +20,7 @@
@TableName("tb_order")
public class Order implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
diff --git a/blade-ops/blade-seata-storage/pom.xml b/blade-ops/blade-seata-storage/pom.xml
index 9dead690..42014a4e 100644
--- a/blade-ops/blade-seata-storage/pom.xml
+++ b/blade-ops/blade-seata-storage/pom.xml
@@ -5,32 +5,44 @@
blade-ops
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-seata-storage
${project.artifactId}
- ${blade.project.version}
jar
org.springblade
blade-common
- ${blade.project.version}
org.springblade
blade-core-boot
- ${blade.tool.version}
org.springblade
- blade-core-transaction
- ${blade.tool.version}
+ blade-starter-transaction
+
+
+
+ com.spotify
+ docker-maven-plugin
+ ${docker.plugin.version}
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+
diff --git a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java
index 5f8686df..431f07c9 100644
--- a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java
+++ b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/entity/Storage.java b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/entity/Storage.java
index 73e4935e..b1e80ac6 100644
--- a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/entity/Storage.java
+++ b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/entity/Storage.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -15,6 +16,7 @@
@TableName("tb_storage")
public class Storage implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
private Long id;
diff --git a/blade-ops/pom.xml b/blade-ops/pom.xml
index d1395992..650a1676 100644
--- a/blade-ops/pom.xml
+++ b/blade-ops/pom.xml
@@ -5,11 +5,12 @@
SpringBlade
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-ops
+ ${project.artifactId}
pom
blade-admin
diff --git a/blade-service-api/blade-demo-api/pom.xml b/blade-service-api/blade-demo-api/pom.xml
index e3aa90e2..fee8cfea 100644
--- a/blade-service-api/blade-demo-api/pom.xml
+++ b/blade-service-api/blade-demo-api/pom.xml
@@ -5,13 +5,12 @@
blade-service-api
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-demo-api
${project.artifactId}
- ${blade.project.version}
jar
diff --git a/blade-service-api/blade-demo-api/src/main/java/com/example/demo/entity/Notice.java b/blade-service-api/blade-demo-api/src/main/java/com/example/demo/entity/Notice.java
index b158dfeb..84c38731 100644
--- a/blade-service-api/blade-demo-api/src/main/java/com/example/demo/entity/Notice.java
+++ b/blade-service-api/blade-demo-api/src/main/java/com/example/demo/entity/Notice.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,12 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
+import java.io.Serial;
import java.util.Date;
/**
@@ -37,12 +38,13 @@
@EqualsAndHashCode(callSuper = true)
public class Notice extends BaseEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,25 +52,25 @@ public class Notice extends BaseEntity {
/**
* 标题
*/
- @ApiModelProperty(value = "标题")
+ @Schema(description = "标题")
private String title;
/**
* 通知类型
*/
- @ApiModelProperty(value = "通知类型")
+ @Schema(description = "通知类型")
private Integer category;
/**
* 发布日期
*/
- @ApiModelProperty(value = "发布日期")
+ @Schema(description = "发布日期")
private Date releaseTime;
/**
* 内容
*/
- @ApiModelProperty(value = "内容")
+ @Schema(description = "内容")
private String content;
diff --git a/blade-service-api/blade-demo-api/src/main/java/com/example/demo/feign/INoticeClient.java b/blade-service-api/blade-demo-api/src/main/java/com/example/demo/feign/INoticeClient.java
index 911be4d7..19410c0f 100644
--- a/blade-service-api/blade-demo-api/src/main/java/com/example/demo/feign/INoticeClient.java
+++ b/blade-service-api/blade-demo-api/src/main/java/com/example/demo/feign/INoticeClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service-api/blade-demo-api/src/main/java/com/example/demo/vo/NoticeVO.java b/blade-service-api/blade-demo-api/src/main/java/com/example/demo/vo/NoticeVO.java
index dfb0a660..f8a200e4 100644
--- a/blade-service-api/blade-demo-api/src/main/java/com/example/demo/vo/NoticeVO.java
+++ b/blade-service-api/blade-demo-api/src/main/java/com/example/demo/vo/NoticeVO.java
@@ -1,6 +1,6 @@
package com.example.demo.vo;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.example.demo.entity.Notice;
@@ -14,7 +14,7 @@
@EqualsAndHashCode(callSuper = true)
public class NoticeVO extends Notice {
- @ApiModelProperty(value = "通知类型名")
+ @Schema(description = "通知类型名")
private String categoryName;
}
diff --git a/blade-service-api/blade-desk-api/pom.xml b/blade-service-api/blade-desk-api/pom.xml
index 6cf838b9..f9e538e3 100644
--- a/blade-service-api/blade-desk-api/pom.xml
+++ b/blade-service-api/blade-desk-api/pom.xml
@@ -5,13 +5,12 @@
blade-service-api
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-desk-api
${project.artifactId}
- ${blade.project.version}
jar
diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java
index ee07c335..1cdde926 100644
--- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java
+++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,12 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
+import java.io.Serial;
import java.util.Date;
/**
@@ -37,12 +38,13 @@
@TableName("blade_notice")
public class Notice extends BaseEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,25 +52,25 @@ public class Notice extends BaseEntity {
/**
* 标题
*/
- @ApiModelProperty(value = "标题")
+ @Schema(description = "标题")
private String title;
/**
* 通知类型
*/
- @ApiModelProperty(value = "通知类型")
+ @Schema(description = "通知类型")
private Integer category;
/**
* 发布日期
*/
- @ApiModelProperty(value = "发布日期")
+ @Schema(description = "发布日期")
private Date releaseTime;
/**
* 内容
*/
- @ApiModelProperty(value = "内容")
+ @Schema(description = "内容")
private String content;
diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/feign/INoticeClient.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/feign/INoticeClient.java
index 1c964004..3d174e85 100644
--- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/feign/INoticeClient.java
+++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/feign/INoticeClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/vo/NoticeVO.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/vo/NoticeVO.java
index 49e23748..958ca6f5 100644
--- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/vo/NoticeVO.java
+++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/vo/NoticeVO.java
@@ -1,6 +1,6 @@
package org.springblade.desk.vo;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.desk.entity.Notice;
@@ -14,7 +14,7 @@
@EqualsAndHashCode(callSuper = true)
public class NoticeVO extends Notice {
- @ApiModelProperty(value = "通知类型名")
+ @Schema(description = "通知类型名")
private String categoryName;
}
diff --git a/blade-service-api/blade-dict-api/pom.xml b/blade-service-api/blade-dict-api/pom.xml
index 50e5a9fa..31d0a38b 100644
--- a/blade-service-api/blade-dict-api/pom.xml
+++ b/blade-service-api/blade-dict-api/pom.xml
@@ -5,13 +5,12 @@
blade-service-api
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-dict-api
${project.artifactId}
- ${blade.project.version}
jar
diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/dto/DictDTO.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/dto/DictDTO.java
index cc09a0d3..ad023065 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/dto/DictDTO.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/dto/DictDTO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Dict;
+import java.io.Serial;
+
/**
* 数据传输对象实体类
*
@@ -28,6 +30,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
public class DictDTO extends Dict {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/Dict.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/Dict.java
index ea05ce27..1ca169c0 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/Dict.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/Dict.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -35,15 +35,16 @@
*/
@Data
@TableName("blade_dict")
-@ApiModel(value = "Dict对象", description = "Dict对象")
+@Schema(description = "Dict对象")
public class Dict implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -51,45 +52,45 @@ public class Dict implements Serializable {
/**
* 父主键
*/
- @ApiModelProperty(value = "父主键")
+ @Schema(description = "父主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 字典码
*/
- @ApiModelProperty(value = "字典码")
+ @Schema(description = "字典码")
private String code;
/**
* 字典值
*/
- @ApiModelProperty(value = "字典值")
+ @Schema(description = "字典值")
private Integer dictKey;
/**
* 字典名称
*/
- @ApiModelProperty(value = "字典名称")
+ @Schema(description = "字典名称")
private String dictValue;
/**
* 排序
*/
- @ApiModelProperty(value = "排序")
+ @Schema(description = "排序")
private Integer sort;
/**
* 字典备注
*/
- @ApiModelProperty(value = "字典备注")
+ @Schema(description = "字典备注")
private String remark;
/**
* 是否已删除
*/
@TableLogic
- @ApiModelProperty(value = "是否已删除")
+ @Schema(description = "是否已删除")
private Integer isDeleted;
diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClient.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClient.java
index 9aeabeeb..ade68aa4 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClient.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClientFallback.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClientFallback.java
index 82f671de..b5483123 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClientFallback.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/feign/IDictClientFallback.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/vo/DictVO.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/vo/DictVO.java
index 739d87e3..a7e2e9f9 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/vo/DictVO.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/vo/DictVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,13 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Dict;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
@@ -35,8 +36,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "DictVO对象", description = "DictVO对象")
-public class DictVO extends Dict implements INode {
+@Schema(description = "DictVO对象")
+public class DictVO extends Dict implements INode {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
@@ -54,10 +56,10 @@ public class DictVO extends Dict implements INode {
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List children;
+ private List children;
@Override
- public List getChildren() {
+ public List getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
diff --git a/blade-service-api/blade-scope-api/pom.xml b/blade-service-api/blade-scope-api/pom.xml
new file mode 100644
index 00000000..3eef2c73
--- /dev/null
+++ b/blade-service-api/blade-scope-api/pom.xml
@@ -0,0 +1,27 @@
+
+
+
+ blade-service-api
+ org.springblade
+ ${revision}
+
+ 4.0.0
+
+ blade-scope-api
+ ${project.artifactId}
+ jar
+
+
+
+ org.springblade
+ blade-core-secure
+
+
+ org.springblade
+ blade-starter-datascope
+
+
+
+
diff --git a/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/cache/DataScopeCache.java b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/cache/DataScopeCache.java
new file mode 100644
index 00000000..456423a5
--- /dev/null
+++ b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/cache/DataScopeCache.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.cache;
+
+import org.springblade.core.datascope.model.DataScopeModel;
+import org.springblade.core.tool.utils.*;
+import org.springblade.system.feign.IDataScopeClient;
+
+import java.util.List;
+
+import static org.springblade.core.tool.utils.CacheUtil.SYS_CACHE;
+
+
+/**
+ * 数据权限缓存
+ *
+ * @author Chill
+ */
+public class DataScopeCache {
+
+ private static final String SCOPE_CACHE_CODE = "dataScope:code:";
+ private static final String SCOPE_CACHE_CLASS = "dataScope:class:";
+ private static final String DEPT_CACHE_ANCESTORS = "dept:ancestors:";
+
+ private static IDataScopeClient dataScopeClient;
+
+ private static IDataScopeClient getDataScopeClient() {
+ if (dataScopeClient == null) {
+ dataScopeClient = SpringUtil.getBean(IDataScopeClient.class);
+ }
+ return dataScopeClient;
+ }
+
+ /**
+ * 获取数据权限
+ *
+ * @param mapperId 数据权限mapperId
+ * @param roleId 用户角色集合
+ * @return DataScopeModel
+ */
+ public static DataScopeModel getDataScopeByMapper(String mapperId, String roleId) {
+ DataScopeModel dataScope = CacheUtil.get(SYS_CACHE, SCOPE_CACHE_CLASS, mapperId + StringPool.COLON + roleId, DataScopeModel.class);
+ if (dataScope == null || !dataScope.getSearched()) {
+ dataScope = getDataScopeClient().getDataScopeByMapper(mapperId, roleId);
+ CacheUtil.put(SYS_CACHE, SCOPE_CACHE_CLASS, mapperId + StringPool.COLON + roleId, dataScope);
+ }
+ return StringUtil.isNotBlank(dataScope.getResourceCode()) ? dataScope : null;
+ }
+
+ /**
+ * 获取数据权限
+ *
+ * @param code 数据权限资源编号
+ * @return DataScopeModel
+ */
+ public static DataScopeModel getDataScopeByCode(String code) {
+ DataScopeModel dataScope = CacheUtil.get(SYS_CACHE, SCOPE_CACHE_CODE, code, DataScopeModel.class);
+ if (dataScope == null || !dataScope.getSearched()) {
+ dataScope = getDataScopeClient().getDataScopeByCode(code);
+ CacheUtil.put(SYS_CACHE, SCOPE_CACHE_CODE, code, dataScope);
+ }
+ return StringUtil.isNotBlank(dataScope.getResourceCode()) ? dataScope : null;
+ }
+
+ /**
+ * 获取部门子级
+ *
+ * @param deptId 部门id
+ * @return deptIds
+ */
+ public static List getDeptAncestors(Long deptId) {
+ List ancestors = CacheUtil.get(SYS_CACHE, DEPT_CACHE_ANCESTORS, deptId, List.class);
+ if (CollectionUtil.isEmpty(ancestors)) {
+ ancestors = getDataScopeClient().getDeptAncestors(deptId);
+ CacheUtil.put(SYS_CACHE, DEPT_CACHE_ANCESTORS, deptId, ancestors);
+ }
+ return ancestors;
+ }
+}
diff --git a/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/config/ScopeConfiguration.java b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/config/ScopeConfiguration.java
new file mode 100644
index 00000000..0b8df115
--- /dev/null
+++ b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/config/ScopeConfiguration.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.config;
+
+
+import lombok.AllArgsConstructor;
+import org.springblade.core.datascope.handler.ScopeModelHandler;
+import org.springblade.core.secure.config.RegistryConfiguration;
+import org.springblade.system.handler.DataScopeModelHandler;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 公共封装包配置类
+ *
+ * @author Chill
+ */
+@Configuration(proxyBeanMethods = false)
+@AllArgsConstructor
+@AutoConfigureBefore(RegistryConfiguration.class)
+public class ScopeConfiguration {
+
+ @Bean
+ public ScopeModelHandler scopeModelHandler() {
+ return new DataScopeModelHandler();
+ }
+
+}
diff --git a/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/feign/IDataScopeClient.java b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/feign/IDataScopeClient.java
new file mode 100644
index 00000000..fef9adde
--- /dev/null
+++ b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/feign/IDataScopeClient.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.feign;
+
+import org.springblade.core.datascope.model.DataScopeModel;
+import org.springblade.core.launch.constant.AppConstant;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+/**
+ * 数据权限Feign接口类
+ *
+ * @author Chill
+ */
+@FeignClient(
+ value = AppConstant.APPLICATION_SYSTEM_NAME,
+ fallback = IDataScopeClientFallback.class
+)
+public interface IDataScopeClient {
+
+ String API_PREFIX = "/client/data-scope";
+ String GET_DATA_SCOPE_BY_MAPPER = API_PREFIX + "/by-mapper";
+ String GET_DATA_SCOPE_BY_CODE = API_PREFIX + "/by-code";
+ String GET_DEPT_ANCESTORS = API_PREFIX + "/dept-ancestors";
+
+ /**
+ * 获取数据权限
+ *
+ * @param mapperId 数据权限mapperId
+ * @param roleId 用户角色集合
+ * @return DataScopeModel
+ */
+ @GetMapping(GET_DATA_SCOPE_BY_MAPPER)
+ DataScopeModel getDataScopeByMapper(@RequestParam("mapperId") String mapperId, @RequestParam("roleId") String roleId);
+
+ /**
+ * 获取数据权限
+ *
+ * @param code 数据权限资源编号
+ * @return DataScopeModel
+ */
+ @GetMapping(GET_DATA_SCOPE_BY_CODE)
+ DataScopeModel getDataScopeByCode(@RequestParam("code") String code);
+
+ /**
+ * 获取部门子级
+ *
+ * @param deptId 部门id
+ * @return deptIds
+ */
+ @GetMapping(GET_DEPT_ANCESTORS)
+ List getDeptAncestors(@RequestParam("deptId") Long deptId);
+
+
+}
diff --git a/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/feign/IDataScopeClientFallback.java b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/feign/IDataScopeClientFallback.java
new file mode 100644
index 00000000..68a14abe
--- /dev/null
+++ b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/feign/IDataScopeClientFallback.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.feign;
+
+import org.springblade.core.datascope.model.DataScopeModel;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * IDataScopeClientFallback
+ *
+ * @author Chill
+ */
+@Component
+public class IDataScopeClientFallback implements IDataScopeClient {
+ @Override
+ public DataScopeModel getDataScopeByMapper(String mapperId, String roleId) {
+ return null;
+ }
+
+ @Override
+ public DataScopeModel getDataScopeByCode(String code) {
+ return null;
+ }
+
+ @Override
+ public List getDeptAncestors(Long deptId) {
+ return null;
+ }
+}
diff --git a/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/handler/DataScopeModelHandler.java b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/handler/DataScopeModelHandler.java
new file mode 100644
index 00000000..64857d98
--- /dev/null
+++ b/blade-service-api/blade-scope-api/src/main/java/org/springblade/system/handler/DataScopeModelHandler.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.handler;
+
+import org.springblade.core.datascope.handler.ScopeModelHandler;
+import org.springblade.core.datascope.model.DataScopeModel;
+import org.springblade.system.cache.DataScopeCache;
+
+import java.util.List;
+
+/**
+ * 通用数据权限规则
+ *
+ * @author Chill
+ */
+public class DataScopeModelHandler implements ScopeModelHandler {
+
+ /**
+ * 获取数据权限
+ *
+ * @param mapperId 数据权限mapperId
+ * @param roleId 用户角色集合
+ * @return DataScopeModel
+ */
+ @Override
+ public DataScopeModel getDataScopeByMapper(String mapperId, String roleId) {
+ return DataScopeCache.getDataScopeByMapper(mapperId, roleId);
+ }
+
+ /**
+ * 获取数据权限
+ *
+ * @param code 数据权限资源编号
+ * @return DataScopeModel
+ */
+ @Override
+ public DataScopeModel getDataScopeByCode(String code) {
+ return DataScopeCache.getDataScopeByCode(code);
+ }
+
+ /**
+ * 获取部门子级
+ *
+ * @param deptId 部门id
+ * @return deptIds
+ */
+ @Override
+ public List getDeptAncestors(Long deptId) {
+ return DataScopeCache.getDeptAncestors(deptId);
+ }
+}
diff --git a/blade-service-api/blade-system-api/pom.xml b/blade-service-api/blade-system-api/pom.xml
index 6cf8c1af..683da46f 100644
--- a/blade-service-api/blade-system-api/pom.xml
+++ b/blade-service-api/blade-system-api/pom.xml
@@ -5,13 +5,12 @@
blade-service-api
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-system-api
${project.artifactId}
- ${blade.project.version}
jar
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/DeptDTO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/DeptDTO.java
index 70ca4285..ca73baff 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/DeptDTO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/DeptDTO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Dept;
+import java.io.Serial;
+
/**
* 数据传输对象实体类
*
@@ -27,6 +29,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
public class DeptDTO extends Dept {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/MenuDTO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/MenuDTO.java
index 80513cef..899ca500 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/MenuDTO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/MenuDTO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -26,6 +27,7 @@
*/
@Data
public class MenuDTO implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
private String alias;
private String path;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/ParamDTO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/ParamDTO.java
index c5b9631e..893cd192 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/ParamDTO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/ParamDTO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Param;
+import java.io.Serial;
+
/**
* 数据传输对象实体类
*
@@ -27,6 +29,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
public class ParamDTO extends Param {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleDTO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleDTO.java
index c1c8dc14..066d5aa1 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleDTO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleDTO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Role;
+import java.io.Serial;
+
/**
* 数据传输对象实体类
*
@@ -27,6 +29,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
public class RoleDTO extends Role {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleMenuDTO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleMenuDTO.java
index 2d7e8990..c37aec17 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleMenuDTO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/dto/RoleMenuDTO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.RoleMenu;
+import java.io.Serial;
+
/**
* 数据传输对象实体类
*
@@ -27,6 +29,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
public class RoleMenuDTO extends RoleMenu {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/AuthClient.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/AuthClient.java
index 0d2cee13..136d84ff 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/AuthClient.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/AuthClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,13 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
+import java.io.Serial;
+
/**
* 实体类
*
@@ -35,15 +36,16 @@
@Data
@TableName("blade_client")
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "Client对象", description = "Client对象")
+@Schema(description = "Client对象")
public class AuthClient extends BaseEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -51,57 +53,57 @@ public class AuthClient extends BaseEntity {
/**
* 客户端id
*/
- @ApiModelProperty(value = "客户端id")
+ @Schema(description = "客户端id")
private String clientId;
/**
* 客户端密钥
*/
- @ApiModelProperty(value = "客户端密钥")
+ @Schema(description = "客户端密钥")
private String clientSecret;
/**
* 资源集合
*/
- @ApiModelProperty(value = "资源集合")
+ @Schema(description = "资源集合")
private String resourceIds;
/**
* 授权范围
*/
- @ApiModelProperty(value = "授权范围")
+ @Schema(description = "授权范围")
private String scope;
/**
* 授权类型
*/
- @ApiModelProperty(value = "授权类型")
+ @Schema(description = "授权类型")
private String authorizedGrantTypes;
/**
* 回调地址
*/
- @ApiModelProperty(value = "回调地址")
+ @Schema(description = "回调地址")
private String webServerRedirectUri;
/**
* 权限
*/
- @ApiModelProperty(value = "权限")
+ @Schema(description = "权限")
private String authorities;
/**
* 令牌过期秒数
*/
- @ApiModelProperty(value = "令牌过期秒数")
+ @Schema(description = "令牌过期秒数")
private Integer accessTokenValidity;
/**
* 刷新令牌过期秒数
*/
- @ApiModelProperty(value = "刷新令牌过期秒数")
+ @Schema(description = "刷新令牌过期秒数")
private Integer refreshTokenValidity;
/**
* 附加说明
*/
- @ApiModelProperty(value = "附加说明")
+ @Schema(description = "附加说明")
private String additionalInformation;
/**
* 自动授权
*/
- @ApiModelProperty(value = "自动授权")
+ @Schema(description = "自动授权")
private String autoapprove;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/DataScope.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/DataScope.java
new file mode 100644
index 00000000..b08d8930
--- /dev/null
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/DataScope.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.io.Serial;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ */
+@Data
+@TableName("blade_scope_data")
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "DataScope对象")
+public class DataScope extends BaseEntity {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ @Schema(description = "主键")
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long id;
+
+ /**
+ * 菜单主键
+ */
+ @Schema(description = "菜单主键")
+ private Long menuId;
+ /**
+ * 资源编号
+ */
+ @Schema(description = "资源编号")
+ private String resourceCode;
+ /**
+ * 数据权限名称
+ */
+ @Schema(description = "数据权限名称")
+ private String scopeName;
+ /**
+ * 数据权限可见字段
+ */
+ @Schema(description = "数据权限可见字段")
+ private String scopeField;
+ /**
+ * 数据权限类名
+ */
+ @Schema(description = "数据权限类名")
+ private String scopeClass;
+ /**
+ * 数据权限字段
+ */
+ @Schema(description = "数据权限字段")
+ private String scopeColumn;
+ /**
+ * 数据权限类型
+ */
+ @Schema(description = "数据权限类型")
+ private Integer scopeType;
+ /**
+ * 数据权限值域
+ */
+ @Schema(description = "数据权限值域")
+ private String scopeValue;
+ /**
+ * 数据权限备注
+ */
+ @Schema(description = "数据权限备注")
+ private String remark;
+
+
+}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java
index 9350877f..48c1040b 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -34,15 +34,16 @@
*/
@Data
@TableName("blade_dept")
-@ApiModel(value = "Dept对象", description = "Dept对象")
+@Schema(description = "Dept对象")
public class Dept implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,45 +51,51 @@ public class Dept implements Serializable {
/**
* 租户ID
*/
- @ApiModelProperty(value = "租户ID")
+ @Schema(description = "租户ID")
private String tenantId;
/**
* 父主键
*/
- @ApiModelProperty(value = "父主键")
+ @Schema(description = "父主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
+ /**
+ * 祖级机构主键
+ */
+ @Schema(description = "祖级机构主键")
+ private String ancestors;
+
/**
* 部门名
*/
- @ApiModelProperty(value = "部门名")
+ @Schema(description = "部门名")
private String deptName;
/**
* 部门全称
*/
- @ApiModelProperty(value = "部门全称")
+ @Schema(description = "部门全称")
private String fullName;
/**
* 排序
*/
- @ApiModelProperty(value = "排序")
+ @Schema(description = "排序")
private Integer sort;
/**
* 备注
*/
- @ApiModelProperty(value = "备注")
+ @Schema(description = "备注")
private String remark;
/**
* 是否已删除
*/
@TableLogic
- @ApiModelProperty(value = "是否已删除")
+ @Schema(description = "是否已删除")
private Integer isDeleted;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Menu.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Menu.java
index f0448976..ec61d889 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Menu.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Menu.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,12 +21,13 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
+import java.io.Serial;
import java.io.Serializable;
+import java.util.Objects;
/**
* 实体类
@@ -35,15 +36,16 @@
*/
@Data
@TableName("blade_menu")
-@ApiModel(value = "Menu对象", description = "Menu对象")
+@Schema(description = "Menu对象")
public class Menu implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -51,75 +53,75 @@ public class Menu implements Serializable {
/**
* 菜单父主键
*/
- @ApiModelProperty(value = "父主键")
+ @Schema(description = "父主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 菜单编号
*/
- @ApiModelProperty(value = "菜单编号")
+ @Schema(description = "菜单编号")
private String code;
/**
* 菜单名称
*/
- @ApiModelProperty(value = "菜单名称")
+ @Schema(description = "菜单名称")
private String name;
/**
* 菜单别名
*/
- @ApiModelProperty(value = "菜单别名")
+ @Schema(description = "菜单别名")
private String alias;
/**
* 请求地址
*/
- @ApiModelProperty(value = "请求地址")
+ @Schema(description = "请求地址")
private String path;
/**
* 菜单资源
*/
- @ApiModelProperty(value = "菜单资源")
+ @Schema(description = "菜单资源")
private String source;
/**
* 排序
*/
- @ApiModelProperty(value = "排序")
+ @Schema(description = "排序")
private Integer sort;
/**
* 菜单类型
*/
- @ApiModelProperty(value = "菜单类型")
+ @Schema(description = "菜单类型")
private Integer category;
/**
* 操作按钮类型
*/
- @ApiModelProperty(value = "操作按钮类型")
+ @Schema(description = "操作按钮类型")
private Integer action;
/**
* 是否打开新页面
*/
- @ApiModelProperty(value = "是否打开新页面")
+ @Schema(description = "是否打开新页面")
private Integer isOpen;
/**
* 备注
*/
- @ApiModelProperty(value = "备注")
+ @Schema(description = "备注")
private String remark;
/**
* 是否已删除
*/
@TableLogic
- @ApiModelProperty(value = "是否已删除")
+ @Schema(description = "是否已删除")
private Integer isDeleted;
@@ -132,10 +134,12 @@ public boolean equals(Object obj) {
return false;
}
Menu other = (Menu) obj;
- if (Func.equals(this.getId(), other.getId())) {
- return true;
- }
- return false;
+ return Func.equals(this.getId(), other.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, parentId, code);
}
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java
index 18cd575d..59df84f1 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Param.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,13 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
+import java.io.Serial;
+
/**
* 实体类
*
@@ -34,15 +35,16 @@
@Data
@TableName("blade_param")
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "Param对象", description = "Param对象")
+@Schema(description = "Param对象")
public class Param extends BaseEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,25 +52,25 @@ public class Param extends BaseEntity {
/**
* 参数名
*/
- @ApiModelProperty(value = "参数名")
+ @Schema(description = "参数名")
private String paramName;
/**
* 参数键
*/
- @ApiModelProperty(value = "参数键")
+ @Schema(description = "参数键")
private String paramKey;
/**
* 参数值
*/
- @ApiModelProperty(value = "参数值")
+ @Schema(description = "参数值")
private String paramValue;
/**
* 备注
*/
- @ApiModelProperty(value = "备注")
+ @Schema(description = "备注")
private String remark;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Post.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Post.java
index 782dd94f..66dc2548 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Post.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Post.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,13 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.TenantEntity;
+import java.io.Serial;
+
/**
* 岗位表实体类
*
@@ -34,15 +35,16 @@
@Data
@TableName("blade_post")
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "Post对象", description = "岗位表")
+@Schema(description = "Post对象")
public class Post extends TenantEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,27 +52,27 @@ public class Post extends TenantEntity {
/**
* 类型
*/
- @ApiModelProperty(value = "类型")
+ @Schema(description = "类型")
private Integer category;
/**
* 岗位编号
*/
- @ApiModelProperty(value = "岗位编号")
+ @Schema(description = "岗位编号")
private String postCode;
/**
* 岗位名称
*/
- @ApiModelProperty(value = "岗位名称")
+ @Schema(description = "岗位名称")
private String postName;
/**
* 岗位排序
*/
- @ApiModelProperty(value = "岗位排序")
+ @Schema(description = "岗位排序")
private Integer sort;
/**
* 岗位描述
*/
- @ApiModelProperty(value = "岗位描述")
+ @Schema(description = "岗位描述")
private String remark;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Region.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Region.java
index 2447890e..7e1e49b6 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Region.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Region.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -31,96 +31,97 @@
*/
@Data
@TableName("blade_region")
-@ApiModel(value = "Region对象", description = "行政区划表")
+@Schema(description = "Region对象")
public class Region implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 区划编号
*/
@TableId(value = "code", type = IdType.INPUT)
- @ApiModelProperty(value = "区划编号")
+ @Schema(description = "区划编号")
private String code;
/**
* 父区划编号
*/
- @ApiModelProperty(value = "父区划编号")
+ @Schema(description = "父区划编号")
private String parentCode;
/**
* 祖区划编号
*/
- @ApiModelProperty(value = "祖区划编号")
+ @Schema(description = "祖区划编号")
private String ancestors;
/**
* 区划名称
*/
- @ApiModelProperty(value = "区划名称")
+ @Schema(description = "区划名称")
private String name;
/**
* 省级区划编号
*/
- @ApiModelProperty(value = "省级区划编号")
+ @Schema(description = "省级区划编号")
private String provinceCode;
/**
* 省级名称
*/
- @ApiModelProperty(value = "省级名称")
+ @Schema(description = "省级名称")
private String provinceName;
/**
* 市级区划编号
*/
- @ApiModelProperty(value = "市级区划编号")
+ @Schema(description = "市级区划编号")
private String cityCode;
/**
* 市级名称
*/
- @ApiModelProperty(value = "市级名称")
+ @Schema(description = "市级名称")
private String cityName;
/**
* 区级区划编号
*/
- @ApiModelProperty(value = "区级区划编号")
+ @Schema(description = "区级区划编号")
private String districtCode;
/**
* 区级名称
*/
- @ApiModelProperty(value = "区级名称")
+ @Schema(description = "区级名称")
private String districtName;
/**
* 镇级区划编号
*/
- @ApiModelProperty(value = "镇级区划编号")
+ @Schema(description = "镇级区划编号")
private String townCode;
/**
* 镇级名称
*/
- @ApiModelProperty(value = "镇级名称")
+ @Schema(description = "镇级名称")
private String townName;
/**
* 村级区划编号
*/
- @ApiModelProperty(value = "村级区划编号")
+ @Schema(description = "村级区划编号")
private String villageCode;
/**
* 村级名称
*/
- @ApiModelProperty(value = "村级名称")
+ @Schema(description = "村级名称")
private String villageName;
/**
* 层级
*/
- @ApiModelProperty(value = "层级")
+ @Schema(description = "层级")
private Integer level;
/**
* 排序
*/
- @ApiModelProperty(value = "排序")
+ @Schema(description = "排序")
private Integer sort;
/**
* 备注
*/
- @ApiModelProperty(value = "备注")
+ @Schema(description = "备注")
private String remark;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java
index d83cd7d5..642e45aa 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -34,15 +34,16 @@
*/
@Data
@TableName("blade_role")
-@ApiModel(value = "Role对象", description = "Role对象")
+@Schema(description = "Role对象")
public class Role implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,39 +51,39 @@ public class Role implements Serializable {
/**
* 租户ID
*/
- @ApiModelProperty(value = "租户ID")
+ @Schema(description = "租户ID")
private String tenantId;
/**
* 父主键
*/
- @ApiModelProperty(value = "父主键")
+ @Schema(description = "父主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 角色名
*/
- @ApiModelProperty(value = "角色名")
+ @Schema(description = "角色名")
private String roleName;
/**
* 排序
*/
- @ApiModelProperty(value = "排序")
+ @Schema(description = "排序")
private Integer sort;
/**
* 角色别名
*/
- @ApiModelProperty(value = "角色别名")
+ @Schema(description = "角色别名")
private String roleAlias;
/**
* 是否已删除
*/
@TableLogic
- @ApiModelProperty(value = "是否已删除")
+ @Schema(description = "是否已删除")
private Integer isDeleted;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleMenu.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleMenu.java
index 66d9eaea..e7470cc2 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleMenu.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleMenu.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -33,15 +33,16 @@
*/
@Data
@TableName("blade_role_menu")
-@ApiModel(value = "RoleMenu对象", description = "RoleMenu对象")
+@Schema(description = "RoleMenu对象")
public class RoleMenu implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -49,14 +50,14 @@ public class RoleMenu implements Serializable {
/**
* 菜单id
*/
- @ApiModelProperty(value = "菜单id")
+ @Schema(description = "菜单id")
@JsonSerialize(using = ToStringSerializer.class)
private Long menuId;
/**
* 角色id
*/
- @ApiModelProperty(value = "角色id")
+ @Schema(description = "角色id")
@JsonSerialize(using = ToStringSerializer.class)
private Long roleId;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleScope.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleScope.java
new file mode 100644
index 00000000..50af1a54
--- /dev/null
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleScope.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author Chill
+ */
+@Data
+@TableName("blade_role_scope")
+@Schema(description = "RoleScope对象")
+public class RoleScope implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ @JsonSerialize(using = ToStringSerializer.class)
+ @Schema(description = "主键")
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ private Long id;
+
+ /**
+ * 权限id
+ */
+ @JsonSerialize(using = ToStringSerializer.class)
+ @Schema(description = "权限id")
+ private Long scopeId;
+
+ /**
+ * 角色id
+ */
+ @JsonSerialize(using = ToStringSerializer.class)
+ @Schema(description = "角色id")
+ private Long roleId;
+
+
+}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Tenant.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Tenant.java
index a9b6915b..6272bb55 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Tenant.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Tenant.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,13 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
+import java.io.Serial;
+
/**
* 实体类
*
@@ -34,15 +35,16 @@
@Data
@TableName("blade_tenant")
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "Tenant对象", description = "Tenant对象")
+@Schema(description = "Tenant对象")
public class Tenant extends BaseEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@@ -50,32 +52,32 @@ public class Tenant extends BaseEntity {
/**
* 租户ID
*/
- @ApiModelProperty(value = "租户ID")
+ @Schema(description = "租户ID")
private String tenantId;
/**
* 租户名称
*/
- @ApiModelProperty(value = "租户名称")
+ @Schema(description = "租户名称")
private String tenantName;
/**
* 域名地址
*/
- @ApiModelProperty(value = "域名地址")
+ @Schema(description = "域名地址")
private String domain;
/**
* 联系人
*/
- @ApiModelProperty(value = "联系人")
+ @Schema(description = "联系人")
private String linkman;
/**
* 联系电话
*/
- @ApiModelProperty(value = "联系电话")
+ @Schema(description = "联系电话")
private String contactNumber;
/**
* 联系地址
*/
- @ApiModelProperty(value = "联系地址")
+ @Schema(description = "联系地址")
private String address;
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
index 302b5f25..1bd27dac 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
index f4578ab1..83958bab 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/props/RouteResource.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/CheckedTreeVO.java
similarity index 60%
rename from blade-gateway/src/main/java/org/springblade/gateway/props/RouteResource.java
rename to blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/CheckedTreeVO.java
index a279a400..23a074ed 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/props/RouteResource.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/CheckedTreeVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,32 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.gateway.props;
+package org.springblade.system.vo;
import lombok.Data;
-import org.springblade.core.launch.constant.AppConstant;
+
+import java.util.List;
/**
- * Swagger聚合文档属性
+ * CheckedTreeVO
*
* @author Chill
*/
@Data
-public class RouteResource {
-
- /**
- * 文档名
- */
- private String name;
+public class CheckedTreeVO {
- /**
- * 文档所在服务地址
- */
- private String location;
+ private List menu;
- /**
- * 文档版本
- */
- private String version = AppConstant.APPLICATION_VERSION;
+ private List dataScope;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DataScopeVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DataScopeVO.java
new file mode 100644
index 00000000..f6b1b6ea
--- /dev/null
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DataScopeVO.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * 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 org.springblade.system.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.system.entity.DataScope;
+
+import java.io.Serial;
+
+/**
+ * 视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "DataScopeVO对象")
+public class DataScopeVO extends DataScope {
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 规则类型名
+ */
+ private String scopeTypeName;
+}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DeptVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DeptVO.java
index 80bcb39b..511d1900 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DeptVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DeptVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,13 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Dept;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
@@ -34,8 +35,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "DeptVO对象", description = "DeptVO对象")
-public class DeptVO extends Dept implements INode {
+@Schema(description = "DeptVO对象")
+public class DeptVO extends Dept implements INode {
+ @Serial
private static final long serialVersionUID = 1L;
/**
@@ -54,10 +56,10 @@ public class DeptVO extends Dept implements INode {
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List children;
+ private List children;
@Override
- public List getChildren() {
+ public List getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
diff --git a/blade-gateway/src/main/java/org/springblade/gateway/props/RouteProperties.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java
similarity index 58%
rename from blade-gateway/src/main/java/org/springblade/gateway/props/RouteProperties.java
rename to blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java
index 9b7aa5d6..6a19c5fa 100644
--- a/blade-gateway/src/main/java/org/springblade/gateway/props/RouteProperties.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,25 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.gateway.props;
+package org.springblade.system.vo;
import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.cloud.context.config.annotation.RefreshScope;
-import java.util.ArrayList;
+import java.io.Serial;
+import java.io.Serializable;
import java.util.List;
/**
- * 路由配置类
+ * GrantTreeVO
*
* @author Chill
*/
@Data
-@RefreshScope
-@ConfigurationProperties("blade.document")
-public class RouteProperties {
+public class GrantTreeVO implements Serializable {
+ @Serial
+ private static final long serialVersionUID = 1L;
- private final List resources = new ArrayList<>();
+ private List menu;
+
+ private List dataScope;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java
index 79797f13..a781e797 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,9 +15,10 @@
*/
package org.springblade.system.vo;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
import java.util.List;
@@ -28,12 +29,16 @@
*/
@Data
public class GrantVO implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
- @ApiModelProperty(value = "roleIds集合")
+ @Schema(description = "roleIds集合")
private List roleIds;
- @ApiModelProperty(value = "menuIds集合")
+ @Schema(description = "menuIds集合")
private List menuIds;
+ @Schema(description = "dataScopeIds集合")
+ private List dataScopeIds;
+
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/MenuVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/MenuVO.java
index b27071f0..b90d4925 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/MenuVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/MenuVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,13 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Menu;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
@@ -34,8 +35,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "MenuVO对象", description = "MenuVO对象")
-public class MenuVO extends Menu implements INode {
+@Schema(description = "MenuVO对象")
+public class MenuVO extends Menu implements INode {
+ @Serial
private static final long serialVersionUID = 1L;
/**
@@ -54,10 +56,16 @@ public class MenuVO extends Menu implements INode {
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List children;
+ private List children;
+
+ /**
+ * 是否有子孙节点
+ */
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private Boolean hasChildren;
@Override
- public List getChildren() {
+ public List getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/ParamVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/ParamVO.java
index b8c063e5..a00bee5e 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/ParamVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/ParamVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,11 +15,13 @@
*/
package org.springblade.system.vo;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Param;
+import java.io.Serial;
+
/**
* 视图实体类
*
@@ -27,8 +29,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "ParamVO对象", description = "ParamVO对象")
+@Schema(description = "ParamVO对象")
public class ParamVO extends Param {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/PostVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/PostVO.java
index dff4c498..55bcff67 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/PostVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/PostVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,11 +15,13 @@
*/
package org.springblade.system.vo;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Post;
+import java.io.Serial;
+
/**
* 岗位表视图实体类
*
@@ -27,8 +29,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "PostVO对象", description = "岗位表")
+@Schema(description = "PostVO对象")
public class PostVO extends Post {
+ @Serial
private static final long serialVersionUID = 1L;
/**
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RegionVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RegionVO.java
index 9ff9259b..4ebcdba3 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RegionVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RegionVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,14 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Region;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
@@ -35,8 +36,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "RegionVO对象", description = "行政区划表")
-public class RegionVO extends Region implements INode {
+@Schema(description = "RegionVO对象")
+public class RegionVO extends Region implements INode {
+ @Serial
private static final long serialVersionUID = 1L;
/**
@@ -66,7 +68,7 @@ public class RegionVO extends Region implements INode {
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List children;
+ private List children;
@Override
public Long getId() {
@@ -79,7 +81,7 @@ public Long getParentId() {
}
@Override
- public List getChildren() {
+ public List getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleMenuVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleMenuVO.java
index d8099a10..e736500a 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleMenuVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleMenuVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,11 +15,13 @@
*/
package org.springblade.system.vo;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.RoleMenu;
+import java.io.Serial;
+
/**
* 视图实体类
*
@@ -27,8 +29,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "RoleMenuVO对象", description = "RoleMenuVO对象")
+@Schema(description = "RoleMenuVO对象")
public class RoleMenuVO extends RoleMenu {
+ @Serial
private static final long serialVersionUID = 1L;
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleVO.java
index 53f7bec4..e5e9a073 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleVO.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,13 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Role;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
@@ -34,8 +35,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "RoleVO对象", description = "RoleVO对象")
-public class RoleVO extends Role implements INode {
+@Schema(description = "RoleVO对象")
+public class RoleVO extends Role implements INode {
+ @Serial
private static final long serialVersionUID = 1L;
/**
@@ -54,10 +56,10 @@ public class RoleVO extends Role implements INode {
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List children;
+ private List children;
@Override
- public List getChildren() {
+ public List getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
diff --git a/blade-service-api/blade-user-api/pom.xml b/blade-service-api/blade-user-api/pom.xml
index 1a02abc0..5a6c5f8e 100644
--- a/blade-service-api/blade-user-api/pom.xml
+++ b/blade-service-api/blade-user-api/pom.xml
@@ -5,13 +5,12 @@
blade-service-api
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-user-api
${project.artifactId}
- ${blade.project.version}
jar
diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java
index a38d1b24..e68756cf 100644
--- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java
+++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,12 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.TenantEntity;
+import java.io.Serial;
import java.util.Date;
/**
@@ -37,12 +38,13 @@
@EqualsAndHashCode(callSuper = true)
public class User extends TenantEntity {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserInfo.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserInfo.java
index bb171c6e..5290b21a 100644
--- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserInfo.java
+++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserInfo.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,10 @@
*/
package org.springblade.system.user.entity;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
import java.util.List;
@@ -28,33 +28,34 @@
* @author Chill
*/
@Data
-@ApiModel(description = "用户信息")
+@Schema(description = "用户信息")
public class UserInfo implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
* 用户基础信息
*/
- @ApiModelProperty(value = "用户")
+ @Schema(description = "用户")
private User user;
/**
* 权限标识集合
*/
- @ApiModelProperty(value = "权限集合")
+ @Schema(description = "权限集合")
private List permissions;
/**
* 角色集合
*/
- @ApiModelProperty(value = "角色集合")
+ @Schema(description = "角色集合")
private List roles;
/**
* 第三方授权id
*/
- @ApiModelProperty(value = "第三方授权id")
+ @Schema(description = "第三方授权id")
private String oauthId;
}
diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserOauth.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserOauth.java
index e6c45fd0..81dfbbda 100644
--- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserOauth.java
+++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/UserOauth.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +20,10 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.io.Serial;
import java.io.Serializable;
/**
@@ -34,6 +35,7 @@
@TableName("blade_user_oauth")
public class UserOauth implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
@@ -41,7 +43,7 @@ public class UserOauth implements Serializable {
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
- @ApiModelProperty(value = "主键")
+ @Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
@@ -59,7 +61,7 @@ public class UserOauth implements Serializable {
* 用户ID
*/
@JsonSerialize(using = ToStringSerializer.class)
- @ApiModelProperty(value = "用户主键")
+ @Schema(description = "用户主键")
private Long userId;
/**
diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
index d23693a2..f85e1ed1 100644
--- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
+++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
* @author Chill
*/
@FeignClient(
- value = AppConstant.APPLICATION_USER_NAME,
+ value = AppConstant.APPLICATION_SYSTEM_NAME,
fallback = IUserClientFallback.class
)
public interface IUserClient {
diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClientFallback.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClientFallback.java
index 25a28517..61ea8d97 100644
--- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClientFallback.java
+++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClientFallback.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserVO.java b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserVO.java
index 0f4f7673..92fb693b 100644
--- a/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserVO.java
+++ b/blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserVO.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,13 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.user.entity.User;
+import java.io.Serial;
+
/**
* 视图实体类
*
@@ -29,8 +31,9 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "UserVO对象", description = "UserVO对象")
+@Schema(description = "UserVO对象")
public class UserVO extends User {
+ @Serial
private static final long serialVersionUID = 1L;
/**
diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml
index 887d7423..b8d623a2 100644
--- a/blade-service-api/pom.xml
+++ b/blade-service-api/pom.xml
@@ -5,13 +5,12 @@
SpringBlade
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-service-api
${project.artifactId}
- 2.8.0
pom
SpringBlade 微服务API集合
@@ -20,39 +19,22 @@
blade-dict-api
blade-system-api
blade-user-api
+ blade-scope-api
blade-demo-api
org.springblade
- blade-core-mybatis
- ${blade.tool.version}
+ blade-starter-mybatis
org.springframework.cloud
spring-cloud-starter-openfeign
-
- io.springfox
- springfox-swagger2
- ${swagger.version}
-
-
- io.swagger
- swagger-models
-
-
-
-
- io.swagger
- swagger-models
- ${swagger.models.version}
-
net.dreamlu
mica-auto
- ${mica.auto.version}
provided
diff --git a/blade-service/blade-demo/pom.xml b/blade-service/blade-demo/pom.xml
index 5b0e44cf..d1a2cb1b 100644
--- a/blade-service/blade-demo/pom.xml
+++ b/blade-service/blade-demo/pom.xml
@@ -5,35 +5,30 @@
blade-service
org.springblade
- 2.8.0
+ ${revision}
4.0.0
blade-demo
${project.artifactId}
- ${blade.project.version}
jar
org.springblade
blade-core-boot
- ${blade.tool.version}
org.springblade
- blade-core-swagger
- ${blade.tool.version}
+ blade-starter-swagger
org.springblade
blade-demo-api
- ${blade.project.version}
com.baomidou
- dynamic-datasource-spring-boot-starter
- 2.5.6
+ dynamic-datasource-spring-boot3-starter
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/DemoApplication.java b/blade-service/blade-demo/src/main/java/com/example/demo/DemoApplication.java
index c8e7acd0..4d7cae4b 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/DemoApplication.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/DemoApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,15 +15,15 @@
*/
package com.example.demo;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
-import org.springframework.cloud.client.SpringCloudApplication;
/**
* Demo启动器
*
* @author Chill
*/
-@SpringCloudApplication
+@BladeCloudApplication
public class DemoApplication {
public static void main(String[] args) {
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/config/DemoConfiguration.java b/blade-service/blade-demo/src/main/java/com/example/demo/config/DemoConfiguration.java
index 16295150..d54045c1 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/config/DemoConfiguration.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/config/DemoConfiguration.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
*
* @author Chill
*/
-@Configuration
+@Configuration(proxyBeanMethods = false)
@EnableFeignClients({"org.springblade", "com.example"})
@MapperScan({"org.springblade.**.mapper.**", "com.example.**.mapper.**"})
@EnableConfigurationProperties(DemoProperties.class)
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/controller/DemoController.java b/blade-service/blade-demo/src/main/java/com/example/demo/controller/DemoController.java
index 62106fe7..4e0eeeb4 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/controller/DemoController.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/controller/DemoController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package com.example.demo.controller;
import com.example.demo.props.DemoProperties;
-import io.swagger.annotations.Api;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
@@ -31,10 +31,10 @@
@RefreshScope
@RestController
@RequestMapping("demo")
-@Api(value = "配置接口", tags = "即时刷新配置")
+@Tag(name = "配置接口", description = "即时刷新配置")
public class DemoController {
- @Value("${demo.name}")
+ @Value("${demo.name:1}")
private String name;
private final DemoProperties properties;
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/controller/DynamicController.java b/blade-service/blade-demo/src/main/java/com/example/demo/controller/DynamicController.java
index 6ba52cdd..8375cc19 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/controller/DynamicController.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/controller/DynamicController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
import com.example.demo.entity.Notice;
import com.example.demo.service.IDynamicService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
@@ -36,7 +36,7 @@
@RestController
@AllArgsConstructor
@RequestMapping("dynamic")
-@Api(value = "多数据源接口", tags = "多数据源")
+@Tag(name = "多数据源接口", description = "多数据源")
public class DynamicController {
private IDynamicService dynamicService;
@@ -46,7 +46,7 @@ public class DynamicController {
*/
@GetMapping("/master-list")
@ApiOperationSupport(order = 1)
- @ApiOperation(value = "master列表", notes = "master列表")
+ @Operation(summary = "master列表", description = "master列表")
public R> masterList() {
List list = dynamicService.masterList();
return R.data(list);
@@ -57,7 +57,7 @@ public R> masterList() {
*/
@GetMapping("/slave-list")
@ApiOperationSupport(order = 1)
- @ApiOperation(value = "slave列表", notes = "slave列表")
+ @Operation(summary = "slave列表", description = "slave列表")
public R> slaveList() {
List list = dynamicService.slaveList();
return R.data(list);
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/controller/NoticeController.java b/blade-service/blade-demo/src/main/java/com/example/demo/controller/NoticeController.java
index 3736d7b4..02f919e6 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/controller/NoticeController.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/controller/NoticeController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,12 @@
import com.example.demo.entity.Notice;
import com.example.demo.service.INoticeService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.*;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.boot.ctrl.BladeController;
@@ -28,7 +33,6 @@
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@@ -40,7 +44,7 @@
@RestController
@RequestMapping("notice")
@AllArgsConstructor
-@Api(value = "用户博客", tags = "博客接口")
+@Tag(name = "用户博客", description = "博客接口")
public class NoticeController extends BladeController implements CacheNames {
private INoticeService noticeService;
@@ -50,7 +54,7 @@ public class NoticeController extends BladeController implements CacheNames {
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
- @ApiOperation(value = "详情", notes = "传入notice")
+ @Operation(summary = "详情", description = "传入notice")
public R detail(Notice notice) {
Notice detail = noticeService.getOne(Condition.getQueryWrapper(notice));
return R.data(detail);
@@ -60,13 +64,13 @@ public R detail(Notice notice) {
* 分页
*/
@GetMapping("/list")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
- @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
+ @Parameters({
+ @Parameter(name = "category", description = "公告类型", in = ParameterIn.QUERY, schema = @Schema(type = "integer")),
+ @Parameter(name = "title", description = "公告标题", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
})
@ApiOperationSupport(order = 2)
- @ApiOperation(value = "分页", notes = "传入notice")
- public R> list(@ApiIgnore @RequestParam Map notice, Query query) {
+ @Operation(summary = "分页", description = "传入notice")
+ public R> list(@Parameter(hidden = true) @RequestParam Map notice, Query query) {
IPage pages = noticeService.page(Condition.getPage(query), Condition.getQueryWrapper(notice, Notice.class));
return R.data(pages);
}
@@ -76,7 +80,7 @@ public R> list(@ApiIgnore @RequestParam Map notice
*/
@PostMapping("/save")
@ApiOperationSupport(order = 3)
- @ApiOperation(value = "新增", notes = "传入notice")
+ @Operation(summary = "新增", description = "传入notice")
public R save(@RequestBody Notice notice) {
return R.status(noticeService.save(notice));
}
@@ -86,7 +90,7 @@ public R save(@RequestBody Notice notice) {
*/
@PostMapping("/update")
@ApiOperationSupport(order = 4)
- @ApiOperation(value = "修改", notes = "传入notice")
+ @Operation(summary = "修改", description = "传入notice")
public R update(@RequestBody Notice notice) {
return R.status(noticeService.updateById(notice));
}
@@ -96,7 +100,7 @@ public R update(@RequestBody Notice notice) {
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 5)
- @ApiOperation(value = "新增或修改", notes = "传入notice")
+ @Operation(summary = "新增或修改", description = "传入notice")
public R submit(@RequestBody Notice notice) {
return R.status(noticeService.saveOrUpdate(notice));
}
@@ -106,8 +110,8 @@ public R submit(@RequestBody Notice notice) {
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
- @ApiOperation(value = "逻辑删除", notes = "传入notice")
- public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+ @Operation(summary = "逻辑删除", description = "传入notice")
+ public R remove(@Parameter(description = "主键集合") @RequestParam String ids) {
boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/feign/NoticeClient.java b/blade-service/blade-demo/src/main/java/com/example/demo/feign/NoticeClient.java
index b87b54fd..05e0f60e 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/feign/NoticeClient.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/feign/NoticeClient.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
+import io.swagger.v3.oas.annotations.Hidden;
import java.util.List;
@@ -30,7 +30,7 @@
*
* @author Chill
*/
-@ApiIgnore()
+@Hidden
@RestController
@AllArgsConstructor
public class NoticeClient implements INoticeClient {
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/launcher/DemoLauncherServiceImpl.java b/blade-service/blade-demo/src/main/java/com/example/demo/launcher/DemoLauncherServiceImpl.java
index c1f967d4..8f2b0ea3 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/launcher/DemoLauncherServiceImpl.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/launcher/DemoLauncherServiceImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ public void launcher(SpringApplicationBuilder builder, String appName, String pr
PropsUtil.setProperty(props, "spring.cloud.nacos.config.ext-config[0].data-id", NacosConstant.dataId("blade-demo", profile));
PropsUtil.setProperty(props, "spring.cloud.nacos.config.ext-config[0].group", NacosConstant.NACOS_CONFIG_GROUP);
PropsUtil.setProperty(props, "spring.cloud.nacos.config.ext-config[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH);
+ // 开启多数据源
+ PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true");
// 自定义命名空间
// PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE);
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE);
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/mapper/NoticeMapper.java b/blade-service/blade-demo/src/main/java/com/example/demo/mapper/NoticeMapper.java
index a69dbd8d..3f45a87c 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/mapper/NoticeMapper.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/mapper/NoticeMapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/service/IDynamicService.java b/blade-service/blade-demo/src/main/java/com/example/demo/service/IDynamicService.java
index 5eb5a141..4f8a3542 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/service/IDynamicService.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/service/IDynamicService.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/service/INoticeService.java b/blade-service/blade-demo/src/main/java/com/example/demo/service/INoticeService.java
index 1bf17fd5..a423a44f 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/service/INoticeService.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/service/INoticeService.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/service/impl/NoticeServiceImpl.java b/blade-service/blade-demo/src/main/java/com/example/demo/service/impl/NoticeServiceImpl.java
index d31519c1..2e1b4696 100644
--- a/blade-service/blade-demo/src/main/java/com/example/demo/service/impl/NoticeServiceImpl.java
+++ b/blade-service/blade-demo/src/main/java/com/example/demo/service/impl/NoticeServiceImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/blade-service/blade-demo/src/main/resources/application-dev.yml b/blade-service/blade-demo/src/main/resources/application-dev.yml
index 38426fa1..600cbdcc 100644
--- a/blade-service/blade-demo/src/main/resources/application-dev.yml
+++ b/blade-service/blade-demo/src/main/resources/application-dev.yml
@@ -12,7 +12,7 @@ server:
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+ exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
#设置默认的数据源或者数据源组,默认值即为master
diff --git a/blade-service/blade-demo/src/main/resources/application-prod.yml b/blade-service/blade-demo/src/main/resources/application-prod.yml
index da892629..053bf056 100644
--- a/blade-service/blade-demo/src/main/resources/application-prod.yml
+++ b/blade-service/blade-demo/src/main/resources/application-prod.yml
@@ -12,7 +12,7 @@ server:
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+ exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
#设置默认的数据源或者数据源组,默认值即为master
diff --git a/blade-service/blade-demo/src/main/resources/application-test.yml b/blade-service/blade-demo/src/main/resources/application-test.yml
index 4b4e157a..42ce581e 100644
--- a/blade-service/blade-demo/src/main/resources/application-test.yml
+++ b/blade-service/blade-demo/src/main/resources/application-test.yml
@@ -12,7 +12,7 @@ server:
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+ exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
#设置默认的数据源或者数据源组,默认值即为master
diff --git a/blade-service/blade-desk/Dockerfile b/blade-service/blade-desk/Dockerfile
index 728663e8..a50a739e 100644
--- a/blade-service/blade-desk/Dockerfile
+++ b/blade-service/blade-desk/Dockerfile
@@ -1,6 +1,6 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
+FROM bladex/alpine-java:openjdk17_cn_slim
-MAINTAINER smallchill@163.com
+MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/desk
@@ -10,6 +10,6 @@ EXPOSE 8105
ADD ./target/blade-desk.jar ./app.jar
-ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
+ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
diff --git a/blade-service/blade-desk/pom.xml b/blade-service/blade-desk/pom.xml
index e0240bdd..aaf44d55 100644
--- a/blade-service/blade-desk/pom.xml
+++ b/blade-service/blade-desk/pom.xml
@@ -6,41 +6,35 @@
org.springblade
blade-service
- 2.8.0
+ ${revision}
4.0.0
blade-desk
${project.artifactId}
- ${blade.project.version}
jar
org.springblade
blade-core-boot
- ${blade.tool.version}
org.springblade
- blade-core-swagger
- ${blade.tool.version}
+ blade-starter-swagger
org.springblade
blade-desk-api
- ${blade.project.version}
org.springblade
blade-dict-api
- ${blade.project.version}
org.springblade
blade-core-test
- ${blade.tool.version}
test
@@ -50,22 +44,6 @@
org.apache.maven.plugins
maven-antrun-plugin
-
-
- package
-
- run
-
-
-
-
-
-
-
-
-
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/DeskApplication.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/DeskApplication.java
index 2728d1cf..41b031a2 100644
--- a/blade-service/blade-desk/src/main/java/org/springblade/desk/DeskApplication.java
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/DeskApplication.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,18 +15,16 @@
*/
package org.springblade.desk;
+import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* Desk启动器
*
* @author Chill
*/
-@SpringCloudApplication
-@EnableFeignClients(AppConstant.BASE_PACKAGES)
+@BladeCloudApplication
public class DeskApplication {
public static void main(String[] args) {
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/DashBoardController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/DashBoardController.java
index 6f5b4e49..988d8e9d 100644
--- a/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/DashBoardController.java
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/DashBoardController.java
@@ -1,7 +1,7 @@
package org.springblade.desk.controller;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
@@ -22,7 +22,7 @@
@RestController
@RequestMapping("dashboard")
@AllArgsConstructor
-@Api(value = "首页", tags = "首页")
+@Tag(name = "首页", description = "首页")
public class DashBoardController {
/**
@@ -31,7 +31,7 @@ public class DashBoardController {
* @return
*/
@GetMapping("/activities")
- @ApiOperation(value = "活跃用户", notes = "活跃用户")
+ @Operation(summary = "活跃用户", description = "活跃用户")
public R activities() {
List