mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-14 01:00:01 +08:00
Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
a95639d5a8 | |||
23558d4562 | |||
926526ce9f | |||
![]() |
1ca6f6c7e5 | ||
f4523d2481 | |||
abd4fb5368 | |||
![]() |
2304f28a94 | ||
5f4f0f1b21 | |||
fea602439a | |||
c70e28a535 | |||
d5da1847e3 | |||
c44162d431 | |||
98fbe0506c | |||
79fa2c8abc | |||
2f87310bc8 | |||
7b741d5f8c | |||
1f7fef5b31 | |||
fa232874aa | |||
3bd56d8a1e | |||
8dbec9d1a3 | |||
51e1cd9307 | |||
dd4ca1e2a5 | |||
3738fa4872 | |||
0f2f35d608 | |||
cf3044312c | |||
38f52aaafa | |||
5a5bd1681e | |||
74e61a0111 | |||
7dda38d2b8 | |||
95c27ea323 | |||
40e11a7a25 | |||
0aafcc015c | |||
65401d0219 | |||
![]() |
dea160a7b2 |
12
.github/workflows/deploy.yml
vendored
12
.github/workflows/deploy.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
uses: actions/setup-java@master
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '8'
|
||||
java-version: '17'
|
||||
cache: 'maven'
|
||||
# 3、打包
|
||||
- name: Build
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
password: ${{ secrets.SERVER_PASSWORD }}
|
||||
local: ./continew-admin-webapi/target/app
|
||||
remote: /docker/continew-admin
|
||||
# 5、启动后端服务
|
||||
# 5、启动
|
||||
- name: Start
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
script: |
|
||||
cd /docker
|
||||
docker-compose up --force-recreate --build -d continew-admin-server
|
||||
docker images | grep none | awk '{print $3}' | xargs docker rmi
|
||||
docker images | grep none | awk '{print $3}' | xargs docker rmi
|
||||
|
||||
# 部署前端
|
||||
deploy-web:
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
password: ${{ secrets.SERVER_PASSWORD }}
|
||||
local: ./continew-admin-ui/dist
|
||||
remote: /docker/continew-admin/tmp
|
||||
# 7、重启前端服务
|
||||
# 7、重启 Nginx
|
||||
- name: Restart
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
@@ -94,6 +94,6 @@ jobs:
|
||||
username: ${{ secrets.SERVER_USERNAME }}
|
||||
password: ${{ secrets.SERVER_PASSWORD }}
|
||||
script: |
|
||||
rm -rf /docker/continew-admin/web/*
|
||||
mv /docker/continew-admin/tmp/* /docker/continew-admin/web
|
||||
rm -rf /docker/continew-admin/html/*
|
||||
mv /docker/continew-admin/tmp/* /docker/continew-admin/html
|
||||
docker restart nginx
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,7 +15,6 @@ target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
!.idea/icon.png
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
BIN
.idea/icon.png
generated
BIN
.idea/icon.png
generated
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB |
58
CHANGELOG.md
58
CHANGELOG.md
@@ -1,3 +1,61 @@
|
||||
## [v2.0.0](https://github.com/Charles7c/continew-admin/compare/v1.3.1...v2.0.0) (2023-11-15)
|
||||
|
||||
### 💎 功能优化
|
||||
|
||||
- 优化部分代码格式 ([e983430](https://github.com/Charles7c/continew-admin/commit/2f87310bc886af604a2667285a973ec6ae983430))
|
||||
- 优化 401 状态处理逻辑 ([457ef06](https://github.com/Charles7c/continew-admin/commit/c70e28a535c78214fe8d68a09824c786c457ef06))
|
||||
- 优化超时登录处理逻辑 ([7c1241c](https://github.com/Charles7c/continew-admin/commit/d5da1847e33e6cd7a0e5c3434335044167c1241c))
|
||||
|
||||
### 🐛 问题修复
|
||||
|
||||
- sms4j 3.0.3 => 3.0.4 ([23558d4](https://github.com/Charles7c/continew-admin/commit/23558d45620a48ed82b32a5bdd2f948a4a37263d))
|
||||
- 发送消息增加事务处理 ([Gitee#7](https://gitee.com/Charles7c/continew-admin/pulls/7)) ([3241ac4](https://github.com/Charles7c/continew-admin/commit/1ca6f6c7e5f8a7c78f74df547f14517293241ac4))
|
||||
- 修复前端控制台 eslint 告警 ([Gitee#6](https://gitee.com/Charles7c/continew-admin/pulls/6)) ([f350bba](https://github.com/Charles7c/continew-admin/commit/f4523d24817b4fee5c015eaba6b98fe99f350bba)) ([0d3b741](https://github.com/Charles7c/continew-admin/commit/2304f28a942fa8ea3e6d36fbebbe9346b0d3b741))
|
||||
- 修复仪表盘访问趋势区块 y 轴数值过大时无法展示的问题 ([b378d71](https://github.com/Charles7c/continew-admin/commit/fea602439a3c9589bee078bfa9ff1e7efb378d71))
|
||||
- 修复控制台报错 Please use theme before using plugins ([688b506](https://github.com/Charles7c/continew-admin/commit/98fbe0506c1cbe2f3c16347d9610ebfa5688b506))
|
||||
- 调整 Logback 配置,取消启动时打印 Logback 状态日志 ([02eb8c7](https://github.com/Charles7c/continew-admin/commit/1f7fef5b31212e94652777be37bea4d4e02eb8c7))
|
||||
|
||||
### 💥 破坏性变更
|
||||
|
||||
- 优化部署相关脚本,mariadb => mysql ([7d7af36](https://github.com/Charles7c/continew-admin/commit/5f4f0f1b21fe882dc51801d7c508c10b87d7af36))
|
||||
- 适配 Java 16 新特性 ([cf30443](https://github.com/Charles7c/continew-admin/commit/cf3044312c8631a8c2b306e466e3d4d663d8eb6d))
|
||||
- 适配 Java 14 新特性 ([38f52aa](https://github.com/Charles7c/continew-admin/commit/38f52aaafa22ebc958a22b7c38b084c655064fbc))
|
||||
- 适配 Java 11 新特性 ([5a5bd16](https://github.com/Charles7c/continew-admin/commit/5a5bd1681e076ac6814d552da5415a8f154b93af))
|
||||
- 升级前端依赖 ([e76ee2d](https://github.com/Charles7c/continew-admin/commit/79fa2c8abcf5f70f96ae7c6de35c47dbae76ee2d)) ([7aed9b3](https://github.com/Charles7c/continew-admin/commit/c44162d431cb87cae251067fff9a5ae707aed9b3))
|
||||
- Arco Design Vue 2.52.0 => 2.53.0
|
||||
- Vue 3.3.4 => 3.3.7
|
||||
- Vite 3.2.7 => 4.5.0
|
||||
- vue-router 4.2.4 => 4.2.5
|
||||
- vue-i18n 9.5.0 => 9.6.5
|
||||
- vue-tsc 1.2.0 => 1.8.22
|
||||
- @vueuse/core 9.13.0 => 10.5.0
|
||||
- pinia 2.1.6 => 2.1.7
|
||||
- rollup 3.20.2 => 4.3.0
|
||||
- vue-cropper 1.0.9 => 1.1.1
|
||||
- crypto-js 4.1.1 => 4.2.0
|
||||
- vite-svg-loader 3.6.0 => 4.0.0
|
||||
- highlight.js 11.8.0 => 11.9.0
|
||||
- mitt 3.0.0 => 3.0.1
|
||||
- consola 2.15.3 => 3.2.3
|
||||
- prettier 2.8.7 => 3.0.3
|
||||
- less 4.1.3 => 4.2.0
|
||||
- eslint 8.48.0 => 8.53.0
|
||||
- stylelint 15.10.3 => 15.11.0
|
||||
- lint-staged 13.2.0 => 3.0.3
|
||||
- 升级后端依赖 ([dea160a](https://github.com/Charles7c/continew-admin/commit/dea160a7b2d69e1b46edc936c9a697048bbb507a)) ([95c27ea](https://github.com/Charles7c/continew-admin/commit/95c27ea323e015c915d352618158df830b4d1c05)) ([05d2a7e](https://github.com/Charles7c/continew-admin/commit/fa232874aa88ab14fdc669e54a907e5ef05d2a7e)) ([61b2025](https://github.com/Charles7c/continew-admin/commit/8dbec9d1a3bcb0f6d7ef4bbfb9715effd61b2025)) ([de0dc9c](https://github.com/Charles7c/continew-admin/commit/3bd56d8a1ee274aac6d4ea57d61f6d470de0dc9c)) ([b566502](https://github.com/Charles7c/continew-admin/commit/7b741d5f8c42d154c5b325326d0cc954fb566502))
|
||||
- Spring Boot 2.7.16 => 3.0.5 => 3.1.5
|
||||
- javax.* => jakarta.*
|
||||
- ServletUtil => JakartaServletUtil(Hutool)
|
||||
- 其他配置变更
|
||||
- JDK 8 => JDK 17
|
||||
- Sa-Token 1.36.0 => 1.37.0(适配 Spring Boot 3.x)
|
||||
- MyBatis Plus 3.5.3.2 => 3.5.4(适配 Spring Boot 3.x)
|
||||
- Dynamic Datasource 3.6.1 => 4.2.0(适配 Spring Boot 3.x)
|
||||
- Redisson 3.20.1 => 3.24.3(适配 Spring Boot 3.x)
|
||||
- Knife4j 适配 Spring Boot 3.x
|
||||
- ip2region 2.7.15 => 3.1.5.1(适配 Spring Boot 3.x)
|
||||
- spotless 2.30.0 => 2.40.0
|
||||
|
||||
## [v1.3.1](https://github.com/Charles7c/continew-admin/compare/v1.3.0...v1.3.1) (2023-11-15)
|
||||
|
||||
### 💎 功能优化
|
||||
|
96
README.md
96
README.md
@@ -4,7 +4,7 @@
|
||||
<img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License" />
|
||||
</a>
|
||||
<a href="https://github.com/Charles7c/continew-admin" target="_blank">
|
||||
<img src="https://img.shields.io/badge/SNAPSHOT-v1.3.2-%23ff3f59.svg" alt="Release" />
|
||||
<img src="https://img.shields.io/badge/RELEASE-v2.0.0-%23ff3f59.svg" alt="Release" />
|
||||
</a>
|
||||
<a href="https://github.com/Charles7c/continew-admin" target="_blank">
|
||||
<img src="https://img.shields.io/github/stars/Charles7c/continew-admin?style=social" alt="GitHub stars" />
|
||||
@@ -18,14 +18,12 @@
|
||||
<a href="https://gitee.com/Charles7c/continew-admin" target="_blank">
|
||||
<img src="https://gitee.com/Charles7c/continew-admin/badge/fork.svg?theme=white" alt="Gitee forks" />
|
||||
</a>
|
||||
<img src="https://img.shields.io/badge/Spring Boot-2.7.16-%236CB52D.svg" alt="Release" />
|
||||
<img src="https://img.shields.io/badge/Java-8-%236CB52D.svg" alt="Release" />
|
||||
|
||||
📚 [在线文档](https://doc.charles7c.top) | ✨ [提交需求](https://doc.charles7c.top/require.html) | 🚀 [演示地址](https://cnadmin.charles7c.top)(账号/密码:admin/admin123)
|
||||
|
||||
## 简介
|
||||
|
||||
ContiNew Admin (Continue New Admin)中后台管理框架/脚手架,持续以最新流行技术栈构建,拥抱变化,迭代优化。在社区贡献者的支持和参与下,持续发展并源源不断地为企业级项目开发提供助力。当前采用的技术栈:Vue3、**Spring Boot 2.7.x(JDK8)** 、TypeScript、Arco Design Vue、Undertow、Sa-Token、JWT、MariaDB、MyBatis Plus、Redis、Redisson、Easy Excel、Hutool 等。
|
||||
ContiNew Admin (Continue New Admin)中后台管理框架/脚手架,持续以最新流行技术栈构建,拥抱变化,迭代优化。在社区贡献者的支持和参与下,持续发展并源源不断地为企业级项目开发提供助力。当前采用的技术栈:Spring Boot3(Java17)、Vue3 & Arco Design、Sa-Token、MyBatis Plus、Redisson、Liquibase、JustAuth、Easy Excel、Hutool、TypeScript、Vite4 等。
|
||||
|
||||
## 项目源码
|
||||
|
||||
@@ -34,9 +32,30 @@ ContiNew Admin (Continue New Admin)中后台管理框架/脚手架,持续
|
||||
| GitHub | https://github.com/Charles7c/continew-admin |
|
||||
| Gitee(码云) | https://gitee.com/Charles7c/continew-admin |
|
||||
|
||||
<img src="https://repobeats.axiom.co/api/embed/be43df158b86ce201cd2b7e0e6c8a85740149b7e.svg" alt="Alt" title="Repobeats github analytics image" />
|
||||
|
||||
## 反馈交流
|
||||
|
||||
💬 欢迎各位小伙伴儿扫描下方二维码加好友,备注 `cnadmin`,拉你进群,探讨技术、提提需求~
|
||||
|
||||
加入交流群后,你将会:
|
||||
|
||||
- 第一时间收到框架动态
|
||||
- 第一时间收到框架更新通知
|
||||
- 第一时间收到框架 Bug 通知
|
||||
- 和众多大佬互相 (huá shuǐ) 交流 (mō yú)
|
||||
|
||||
<div align="left">
|
||||
<img src=".image/qrcode.jpg" alt="二维码" width="230px" />
|
||||
</div>
|
||||
|
||||
<details>
|
||||
<summary>无加群意愿</summary>
|
||||
💬 如无加群意愿,欢迎在 <a href="https://github.com/Charles7c/continew-admin/discussions" target="_blank">Discussions</a> 中进行交流探讨~ 🍻
|
||||
</details>
|
||||
|
||||
## 主要特性
|
||||
|
||||
- :fire: 在 2.x 及以上版本中,下方部分通用基础能力及配置,已抽取到 [ContiNew Starter](https://github.com/Charles7c/continew-starter) 项目,现已发布到 Maven 中央仓库,为 Spring Boot Web 项目开发提供更灵活的助力
|
||||
- 精选技术栈:使用综合考虑成熟度、流行性、发展潜力较佳的技术栈,包括 Spring Boot、MyBatis Plus、Sa-Token、Hutool 等
|
||||
- 高效率开发:后端提供了 CRUD 组件,在 Controller 中只需添加一个注解,即可自动生成增、删、改、查、分页、列表、树列表等 API
|
||||
- 提供代码生成功能,根据用户提供的项目信息和配置,自动生成前后端项目结构、代码文件和部分逻辑代码,提高开发效率
|
||||
@@ -167,7 +186,7 @@ git clone https://github.com/Charles7c/continew-admin.git
|
||||
# 5.1.1 服务器安装好 docker 及 docker-compose(参考:https://blog.charles7c.top/categories/fragments/2022/10/31/CentOS%E5%AE%89%E8%A3%85Docker)
|
||||
# 5.1.2 执行 mvn package 进行项目打包,将 target/app 目录下的所有内容放到 /docker/continew-admin 目录下
|
||||
# 5.1.3 将 docker 目录上传到服务器 / 目录下,并授权(chmod -R 777 /docker)
|
||||
# 5.1.4 修改 docker-compose.yml 中的 MariaDB 配置、Redis 配置、continew-admin-server 配置、Nginx 配置
|
||||
# 5.1.4 修改 docker-compose.yml 中的 MySQL 配置、Redis 配置、continew-admin-server 配置、Nginx 配置
|
||||
# 5.1.5 执行 docker-compose up -d 创建并后台运行所有容器
|
||||
# 5.2 其他方式部署
|
||||
```
|
||||
@@ -196,35 +215,36 @@ pnpm dev
|
||||
# 6.1.1 服务器安装好 docker 及 docker-compose(参考:https://blog.charles7c.top/categories/fragments/2022/10/31/CentOS%E5%AE%89%E8%A3%85Docker)
|
||||
# 6.1.2 执行 pnpm build 进行项目打包,将 dist 目录下的所有文件放到 /docker/continew-admin/web 目录下
|
||||
# 6.1.3 将 docker 目录上传到服务器 / 目录下,并授权(chmod -R 777 /docker)
|
||||
# 6.1.4 修改 docker-compose.yml 中的 MariaDB 配置、Redis 配置、continew-admin-server 配置、Nginx 配置
|
||||
# 6.1.4 修改 docker-compose.yml 中的 MySQL 配置、Redis 配置、continew-admin-server 配置、Nginx 配置
|
||||
# 6.1.5 执行 docker-compose up -d 创建并后台运行所有容器
|
||||
# 6.2 其他方式部署
|
||||
```
|
||||
|
||||
## 核心技术栈
|
||||
|
||||
| 名称 | 版本 | 简介 |
|
||||
| :----------------------------------------------------------- |:-------------| :----------------------------------------------------------- |
|
||||
| <a href="https://cn.vuejs.org/" target="_blank">Vue</a> | 3.3.4 | 渐进式 JavaScript 框架,易学易用,性能出色,适用场景丰富的 Web 前端框架。 |
|
||||
| <a href="https://www.typescriptlang.org/zh/" target="_blank">TypeScript</a> | 4.9.5 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 |
|
||||
| <a href="https://arco.design/vue/docs/start" target="_blank">Arco Design Vue</a> | 2.52.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 |
|
||||
| <a href="https://spring.io/projects/spring-boot" target="_blank">Spring Boot</a> | 2.7.16 | 简化新 Spring 应用的初始搭建以及开发过程。 |
|
||||
| <a href="https://undertow.io/" target="_blank">Undertow</a> | 2.2.26.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 |
|
||||
| <a href="https://sa-token.dev33.cn/" target="_blank">Sa-Token + JWT</a> | 1.36.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 |
|
||||
| <a href="https://mariadb.org/" target="_blank">MariaDB</a> | 10.10.2 | MySQL 的一个分支,主要由开源社区在维护,完全兼容 MySQL,包括 API 和命令行,能轻松成为 MySQL 的代替品。 |
|
||||
| <a href="https://baomidou.com/" target="_blank">MyBatis Plus</a> | 3.5.3.2 | MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,简化开发、提高效率。 |
|
||||
| <a href="https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611" target="_blank">dynamic-datasource-spring-boot-starter</a> | 3.6.1 | 基于 Spring Boot 的快速集成多数据源的启动器。 |
|
||||
| Hikari | 4.0.3 | JDBC 连接池,号称 “史上最快连接池”,SpringBoot 在 2.0 之后,采用的默认数据库连接池就是 Hikari。 |
|
||||
| 名称 | 版本 | 简介 |
|
||||
| :----------------------------------------------------------- | :----------- | :----------------------------------------------------------- |
|
||||
| <a href="https://cn.vuejs.org/" target="_blank">Vue</a> | 3.3.7 | 渐进式 JavaScript 框架,易学易用,性能出色,适用场景丰富的 Web 前端框架。 |
|
||||
| <a href="https://arco.design/vue/docs/start" target="_blank">Arco Design</a> | 2.53.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 |
|
||||
| <a href="https://www.typescriptlang.org/zh/" target="_blank">TypeScript</a> | 5.2.2 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 |
|
||||
| <a href="https://cn.vitejs.dev/" target="_blank">Vite</a> | 4.5.0 | 下一代的前端工具链,为开发提供极速响应。 |
|
||||
| <a href="https://spring.io/projects/spring-boot" target="_blank">Spring Boot</a> | 3.1.5 | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) |
|
||||
| <a href="https://undertow.io/" target="_blank">Undertow</a> | 2.3.10.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 |
|
||||
| <a href="https://sa-token.dev33.cn/" target="_blank">Sa-Token + JWT</a> | 1.37.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 |
|
||||
| <a href="https://baomidou.com/" target="_blank">MyBatis Plus</a> | 3.5.4 | MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,简化开发、提高效率。 |
|
||||
| <a href="https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611" target="_blank">dynamic-datasource-spring-boot-starter</a> | 4.2.0 | 基于 Spring Boot 的快速集成多数据源的启动器。 |
|
||||
| Hikari | 5.0.1 | JDBC 连接池,号称 “史上最快连接池”,SpringBoot 在 2.0 之后,采用的默认数据库连接池就是 Hikari。 |
|
||||
| <a href="https://dev.mysql.com/downloads/mysql/" target="_blank">MySQL</a> | 8.0.33 | 体积小、速度快、总体拥有成本低,是最流行的关系型数据库管理系统之一。 |
|
||||
| <a href="https://dev.mysql.com/doc/connector-j/8.0/en/" target="_blank">mysql-connector-j</a> | 8.0.33 | MySQL Java 驱动。 |
|
||||
| <a href="https://github.com/p6spy/p6spy" target="_blank">P6Spy</a> | 3.9.1 | SQL 性能分析组件。 |
|
||||
| <a href="https://github.com/liquibase/liquibase" target="_blank">Liquibase</a> | 4.9.1 | 用于管理数据库版本,跟踪、管理和应用数据库变化。 |
|
||||
| <a href="https://redis.io/" target="_blank">Redis</a> | 6.2.7 | 高性能的 key-value 数据库。 |
|
||||
| <a href="https://github.com/redisson/redisson/wiki/Redisson%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D" target="_blank">Redisson</a> | 3.20.1 | 不仅仅是一个 Redis Java 客户端,同其他 Redis Java 客户端有着很大的区别,相比之下其他客户端提供的功能还仅仅停留在作为数据库驱动层面上,比如仅针对 Redis 提供连接方式,发送命令和处理返回结果等。而 Redisson 充分的利用了 Redis 键值数据库提供的一系列优势,基于 Java 实用工具包中常用接口,为使用者提供了一系列具有分布式特性的常用工具类。使得原本作为协调单机多线程并发程序的工具包获得了协调分布式多机多线程并发系统的能力,大大降低了设计和研发大规模分布式系统的难度。同时结合各富特色的分布式服务,更进一步简化了分布式环境中程序相互之间的协作。 |
|
||||
| <a href="https://sms4j.com/" target="_blank">SMS4J</a> | 3.0.4 | 短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程。 |
|
||||
| <a href="https://github.com/liquibase/liquibase" target="_blank">Liquibase</a> | 4.20.0 | 用于管理数据库版本,跟踪、管理和应用数据库变化。 |
|
||||
| <a href="https://github.com/redisson/redisson/wiki/Redisson%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D" target="_blank">Redisson</a> | 3.24.3 | 不仅仅是一个 Redis Java 客户端,同其他 Redis Java 客户端有着很大的区别,相比之下其他客户端提供的功能还仅仅停留在作为数据库驱动层面上,比如仅针对 Redis 提供连接方式,发送命令和处理返回结果等。而 Redisson 充分的利用了 Redis 键值数据库提供的一系列优势,基于 Java 实用工具包中常用接口,为使用者提供了一系列具有分布式特性的常用工具类。使得原本作为协调单机多线程并发程序的工具包获得了协调分布式多机多线程并发系统的能力,大大降低了设计和研发大规模分布式系统的难度。同时结合各富特色的分布式服务,更进一步简化了分布式环境中程序相互之间的协作。 |
|
||||
| <a href="https://redis.io/" target="_blank">Redis</a> | 7.2.3 | 高性能的 key-value 数据库。 |
|
||||
| <a href="https://sms4j.com/" target="_blank">SMS4J</a> | 3.0.3 | 短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程。 |
|
||||
| <a href="https://justauth.cn/" target="_blank">Just Auth</a> | 1.16.5 | 开箱即用的整合第三方登录的开源组件,脱离繁琐的第三方登录 SDK,让登录变得 So easy! |
|
||||
| <a href="https://easyexcel.opensource.alibaba.com/" target="_blank">Easy Excel</a> | 3.3.2 | 一个基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具。 |
|
||||
| Easy Captcha | 1.6.2 | Java 图形验证码,支持 gif、中文、算术等类型,可用于 Java Web、JavaSE 等项目。 |
|
||||
| <a href="https://doc.xiaominfo.com/" target="_blank">Knife4j</a> | 4.3.0 | 前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案。本项目使用的是 <a href="https://gitee.com/xiaoym/swagger-bootstrap-ui-demo/tree/master/knife4j-springdoc-openapi-demo" target="_blank">knife4j-openapi3-spring-boot-starter</a> 基于 OpenAPI3 规范,在 Spring Boot < 3.0.0-M1 的单体架构下可以直接引用此 starter,该模块包含了 UI 部分,底层基于 springdoc-openapi 项目。 |
|
||||
| <a href="https://doc.xiaominfo.com/" target="_blank">Knife4j</a> | 4.3.0 | 前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案。 |
|
||||
| <a href="https://www.hutool.cn/" target="_blank">Hutool</a> | 5.8.22 | 小而全的 Java 工具类库,通过静态方法封装,降低相关 API 的学习成本,提高工作效率,使 Java 拥有函数式语言般的优雅,让 Java 语言也可以“甜甜的”。 |
|
||||
| <a href="https://projectlombok.org/" target="_blank">Lombok</a> | 1.18.30 | 在 Java 开发过程中用注解的方式,简化了 JavaBean 的编写,避免了冗余和样板式代码,让编写的类更加简洁。 |
|
||||
|
||||
@@ -462,31 +482,11 @@ ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大
|
||||
> 2. 在提交代码前,请按照 [Angular 提交规范](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) 编写 commit 的 message(建议在 IntelliJ IDEA 中下载并安装 Git Commit Template 插件,以便按照规范进行 commit)
|
||||
> 3. 提交代码之前,请关闭所有代码窗口,执行 mvn compile 命令(项目已配置代码格式化插件,编译通过的同时也会自动进行代码格式化),编译通过后,不要再打开查看任何代码窗口,直接提交即可,以免不同的 IDE 配置会自动进行代码格式化
|
||||
|
||||
## 反馈交流
|
||||
|
||||
💬 欢迎各位小伙伴儿扫描下方二维码加好友,备注 `cnadmin`,拉你进群,探讨技术、提提需求~
|
||||
|
||||
加入交流群后,你将会:
|
||||
|
||||
- 第一时间收到框架动态
|
||||
- 第一时间收到框架更新通知
|
||||
- 第一时间收到框架 Bug 通知
|
||||
- 和众多大佬互相 (huá shuǐ) 交流 (mō yú)
|
||||
|
||||
<div align="left">
|
||||
<img src=".image/qrcode.jpg" alt="二维码" width="230px" />
|
||||
</div>
|
||||
|
||||
<details>
|
||||
<summary>无加群意愿</summary>
|
||||
💬 如无加群意愿,欢迎在 <a href="https://github.com/Charles7c/continew-admin/issues" target="_blank">Issues</a> 中反馈交流~ 🍻
|
||||
</details>
|
||||
|
||||
## 鸣谢
|
||||
|
||||
### 鸣谢
|
||||
|
||||
感谢参与贡献的每一位小伙伴🥰
|
||||
感谢参与贡献的每一位小伙伴!(以下排名不分先后)
|
||||
|
||||
<a href="https://github.com/Charles7c/continew-admin/graphs/contributors">
|
||||
<img src="https://opencollective.com/continew-admin/contributors.svg?width=890&button=false" alt="contributors" />
|
||||
@@ -497,11 +497,7 @@ ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大
|
||||
- 感谢 <a href="https://www.jetbrains.com/" target="_blank">JetBrains</a> 提供的 <a href="https://www.jetbrains.com/shop/eform/opensource" target="_blank">非商业开源软件开发授权</a>
|
||||
- 感谢 <a href="http://pro.arco.design/" target="_blank">Arco Design Pro</a> 开箱即用的中后台前端解决方案
|
||||
- 感谢 <a href="https://github.com/baomidou/mybatis-plus" target="_blank">MyBatis Plus</a>、<a href="https://github.com/dromara/sa-token" target="_blank">Sa-Token</a> 、<a href="https://github.com/alibaba/easyexcel" target="_blank">Easy Excel</a>、<a href="https://github.com/xiaoymin/knife4j" target="_blank">Knife4j</a>、<a href="https://github.com/dromara/hutool" target="_blank">Hutool</a> 等国产开源组件作者为国内开源世界作出的贡献
|
||||
- 感谢 <a href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a>、<a href="https://github.com/yangzongzhuan/RuoYi-Vue3" target="_blank">RuoYi-Vue3</a>、<a href="https://github.com/dromara/RuoYi-Vue-Plus" target="_blank">RuoYi-Vue-Plus</a>,致敬各位作者为开源脚手架领域作出的贡献
|
||||
- e.g. 脱胎于 ELADMIN 项目开源的 QueryHelper 组件
|
||||
- e.g. 参考 RuoYi-Vue3 前端项目的 Vue3 编码风格和规范
|
||||
- e.g. 使用 RuoYi-Vue-Plus 项目封装的 SaToken 相关认证鉴权配置等
|
||||
|
||||
- 感谢 <a href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a>、<a href="https://github.com/dromara/RuoYi-Vue-Plus" target="_blank">RuoYi-Vue-Plus</a>、<a href="https://github.com/yangzongzhuan/RuoYi-Vue3" target="_blank">RuoYi-Vue3</a> 提供的诸多成熟方案,致敬各位作者为开源脚手架领域作出的贡献
|
||||
- 感谢项目使用或未使用到的每一款开源组件,致敬各位开源先驱 :fire:
|
||||
|
||||
## License
|
||||
|
@@ -1,4 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!--
|
||||
Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
|
||||
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.
|
||||
-->
|
||||
<!-- 生成当前格式化配置文件,参照:https://github.com/diffplug/spotless/blob/main/ECLIPSE_SCREENSHOTS.md -->
|
||||
<profiles version="12">
|
||||
<profile kind="CodeFormatterProfile" name="P3C-CodeStyle" version="13">
|
||||
|
@@ -1,4 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
@@ -65,7 +80,7 @@
|
||||
<!-- Sa-Token(轻量级 Java 权限认证框架,让鉴权变得简单、优雅) -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
||||
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token 整合 JWT -->
|
||||
@@ -78,13 +93,13 @@
|
||||
<!-- MyBatis Plus(MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,简化开发、提高效率) -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Dynamic Datasource(基于 Spring Boot 的快速集成多数据源的启动器) -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MySQL Java 驱动 -->
|
||||
@@ -131,7 +146,7 @@
|
||||
<!-- Knife4j(前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案) -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Redisson(不仅仅是一个 Redis Java 客户端) -->
|
||||
@@ -139,10 +154,6 @@
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-data-27</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Easy Captcha(Java 图形验证码,支持 gif、中文、算术等类型,可用于 Java Web、JavaSE 等项目) -->
|
||||
<dependency>
|
||||
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* 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 top.charles7c.cnadmin.common.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 响应拦截忽略注解
|
||||
*
|
||||
* @author BULL_BCLS
|
||||
* @since 2023/10/8 20:44
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface NoResponseAdvice {}
|
@@ -20,7 +20,7 @@ import static top.charles7c.cnadmin.common.annotation.CrudRequestMapping.Api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -37,6 +37,7 @@ import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.CrudRequestMapping;
|
||||
import top.charles7c.cnadmin.common.annotation.NoResponseAdvice;
|
||||
import top.charles7c.cnadmin.common.constant.StringConsts;
|
||||
import top.charles7c.cnadmin.common.model.query.PageQuery;
|
||||
import top.charles7c.cnadmin.common.model.query.SortQuery;
|
||||
@@ -77,9 +78,9 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Operation(summary = "分页查询列表", description = "分页查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping
|
||||
public R<PageDataResp<L>> page(Q query, @Validated PageQuery pageQuery) {
|
||||
public PageDataResp<L> page(Q query, @Validated PageQuery pageQuery) {
|
||||
this.checkPermission(Api.LIST);
|
||||
return R.ok(baseService.page(query, pageQuery));
|
||||
return baseService.page(query, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,9 +95,9 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Operation(summary = "查询树列表", description = "查询树列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/tree")
|
||||
public R<List<Tree<Long>>> tree(Q query, SortQuery sortQuery) {
|
||||
public List<Tree<Long>> tree(Q query, SortQuery sortQuery) {
|
||||
this.checkPermission(Api.LIST);
|
||||
return R.ok(baseService.tree(query, sortQuery, false));
|
||||
return baseService.tree(query, sortQuery, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,9 +112,9 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Operation(summary = "查询列表", description = "查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
public R<List<L>> list(Q query, SortQuery sortQuery) {
|
||||
public List<L> list(Q query, SortQuery sortQuery) {
|
||||
this.checkPermission(Api.LIST);
|
||||
return R.ok(baseService.list(query, sortQuery));
|
||||
return baseService.list(query, sortQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,9 +128,9 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
|
||||
@ResponseBody
|
||||
@GetMapping("/{id}")
|
||||
public R<D> get(@PathVariable Long id) {
|
||||
public D get(@PathVariable Long id) {
|
||||
this.checkPermission(Api.LIST);
|
||||
return R.ok(baseService.get(id));
|
||||
return baseService.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,6 +196,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
* 响应对象
|
||||
*/
|
||||
@Operation(summary = "导出数据", description = "导出数据")
|
||||
@NoResponseAdvice
|
||||
@GetMapping("/export")
|
||||
public void export(Q query, SortQuery sortQuery, HttpServletResponse response) {
|
||||
this.checkPermission(Api.EXPORT);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -34,6 +35,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@Data
|
||||
public class BaseDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@Data
|
||||
public class BaseDetailResp extends BaseResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -29,5 +30,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BaseReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -36,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@Data
|
||||
public class BaseResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -18,7 +18,7 @@ package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
|
||||
|
@@ -20,7 +20,7 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -156,7 +156,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
|
||||
|
||||
/**
|
||||
* 设置排序
|
||||
*
|
||||
*
|
||||
* @param queryWrapper
|
||||
* 查询 Wrapper
|
||||
* @param sortQuery
|
||||
@@ -231,8 +231,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
|
||||
* 待填充列表信息
|
||||
*/
|
||||
protected void fill(Object baseObj) {
|
||||
if (baseObj instanceof BaseResp) {
|
||||
BaseResp baseResp = (BaseResp)baseObj;
|
||||
if (baseObj instanceof BaseResp baseResp) {
|
||||
Long createUser = baseResp.getCreateUser();
|
||||
if (null == createUser) {
|
||||
return;
|
||||
@@ -249,10 +248,8 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
|
||||
* 待填充详情信息
|
||||
*/
|
||||
public void fillDetail(Object detailObj) {
|
||||
if (detailObj instanceof BaseDetailResp) {
|
||||
BaseDetailResp detail = (BaseDetailResp)detailObj;
|
||||
if (detailObj instanceof BaseDetailResp detail) {
|
||||
this.fill(detail);
|
||||
|
||||
Long updateUser = detail.getUpdateUser();
|
||||
if (null == updateUser) {
|
||||
return;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import jakarta.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分组校验
|
||||
|
@@ -60,9 +60,8 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
Long createUser = LoginHelper.getUserId();
|
||||
LocalDateTime createTime = LocalDateTime.now();
|
||||
if (metaObject.getOriginalObject() instanceof BaseDO) {
|
||||
if (metaObject.getOriginalObject() instanceof BaseDO baseDO) {
|
||||
// 继承了 BaseDO 的类,填充创建信息
|
||||
BaseDO baseDO = (BaseDO)metaObject.getOriginalObject();
|
||||
baseDO.setCreateUser(ObjectUtil.defaultIfNull(baseDO.getCreateUser(), createUser));
|
||||
baseDO.setCreateTime(ObjectUtil.defaultIfNull(baseDO.getCreateTime(), createTime));
|
||||
} else {
|
||||
@@ -90,9 +89,8 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
Long updateUser = LoginHelper.getUserId();
|
||||
LocalDateTime updateTime = LocalDateTime.now();
|
||||
if (metaObject.getOriginalObject() instanceof BaseDO) {
|
||||
if (metaObject.getOriginalObject() instanceof BaseDO baseDO) {
|
||||
// 继承了 BaseDO 的类,填充修改信息
|
||||
BaseDO baseDO = (BaseDO)metaObject.getOriginalObject();
|
||||
baseDO.setUpdateUser(updateUser);
|
||||
baseDO.setUpdateTime(updateTime);
|
||||
} else {
|
||||
|
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
import org.springframework.web.util.pattern.PathPatternParser;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -55,7 +56,14 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
|
||||
// 拼接路径前缀(合并了 @RequestMapping 的部分能力)
|
||||
String pathPrefix = crudRequestMapping.value();
|
||||
if (StrUtil.isNotBlank(pathPrefix)) {
|
||||
requestMappingInfo = RequestMappingInfo.paths(pathPrefix).build().combine(requestMappingInfo);
|
||||
/*
|
||||
* 问题:RequestMappingInfo.paths(pathPrefix) 返回的 RequestMappingInfo 对象里 pathPatternsCondition = null
|
||||
* 导致 combine() 方法抛出断言异常! 修复:创建 options 对象,并设置 PatternParser
|
||||
*/
|
||||
RequestMappingInfo.BuilderConfiguration options = new RequestMappingInfo.BuilderConfiguration();
|
||||
options.setPatternParser(PathPatternParser.defaultInstance);
|
||||
requestMappingInfo =
|
||||
RequestMappingInfo.paths(pathPrefix).options(options).build().combine(requestMappingInfo);
|
||||
}
|
||||
|
||||
// 过滤 API
|
||||
|
@@ -20,9 +20,9 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@@ -18,9 +18,9 @@ package top.charles7c.cnadmin.common.handler;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -132,18 +132,11 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(NotLoginException.class)
|
||||
public R handleNotLoginException(NotLoginException e, HttpServletRequest request) {
|
||||
log.error("请求地址 [{}],认证失败,无法访问系统资源。", request.getRequestURI(), e);
|
||||
String errorMsg;
|
||||
switch (e.getType()) {
|
||||
case NotLoginException.KICK_OUT:
|
||||
errorMsg = "您已被踢下线。";
|
||||
break;
|
||||
case NotLoginException.BE_REPLACED_MESSAGE:
|
||||
errorMsg = "您已被顶下线。";
|
||||
break;
|
||||
default:
|
||||
errorMsg = "您的登录状态已过期,请重新登录。";
|
||||
break;
|
||||
}
|
||||
String errorMsg = switch (e.getType()) {
|
||||
case NotLoginException.KICK_OUT -> "您已被踢下线。";
|
||||
case NotLoginException.BE_REPLACED_MESSAGE -> "您已被顶下线。";
|
||||
default -> "您的登录状态已过期,请重新登录。";
|
||||
};
|
||||
LogContextHolder.setErrorMsg(errorMsg);
|
||||
return R.fail(HttpStatus.UNAUTHORIZED.value(), errorMsg);
|
||||
}
|
||||
|
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* 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 top.charles7c.cnadmin.common.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.NoResponseAdvice;
|
||||
import top.charles7c.cnadmin.common.model.resp.R;
|
||||
|
||||
/**
|
||||
* 全局响应结果处理器
|
||||
*
|
||||
* @author BULL_BCLS
|
||||
* @since 2023/10/8 20:19
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@RequiredArgsConstructor
|
||||
public class GlobalResponseBodyAdviceHandler implements ResponseBodyAdvice<Object> {
|
||||
|
||||
private static final String[] EXCLUDE = {"MultipleOpenApiWebMvcResource", "SwaggerConfigResource",};
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@Override
|
||||
public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
return !methodParameter.getParameterType().isAssignableFrom(R.class)
|
||||
&& !methodParameter.hasMethodAnnotation(NoResponseAdvice.class)
|
||||
&& !StrUtil.equalsAny(methodParameter.getDeclaringClass().getSimpleName(), EXCLUDE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request,
|
||||
ServerHttpResponse response) {
|
||||
if (String.class.equals(returnType.getGenericParameterType())) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(R.ok(body));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return R.ok(body);
|
||||
}
|
||||
}
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.dto;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -30,6 +31,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class LogContext implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.dto;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
@@ -35,6 +36,7 @@ import top.charles7c.cnadmin.common.constant.SysConsts;
|
||||
@Data
|
||||
public class LoginUser implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.dto;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -31,6 +32,7 @@ import top.charles7c.cnadmin.common.enums.DataScopeEnum;
|
||||
@Data
|
||||
public class RoleDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,7 +16,9 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.query;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -24,7 +26,7 @@ import lombok.NoArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -46,6 +48,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
@Schema(description = "分页查询条件")
|
||||
public class PageQuery extends SortQuery {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 默认页码:1 */
|
||||
private static final int DEFAULT_PAGE = 1;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,7 @@ import top.charles7c.cnadmin.common.constant.StringConsts;
|
||||
@Schema(description = "排序查询条件")
|
||||
public class SortQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,9 +16,10 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -36,6 +37,7 @@ import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
@Schema(description = "修改状态信息")
|
||||
public class UpdateStatusReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Builder;
|
||||
@@ -34,6 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "验证码信息")
|
||||
public class CaptchaResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -37,6 +38,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@Schema(description = "键值对信息")
|
||||
public class LabelValueResp<T> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
@Schema(description = "分页信息")
|
||||
public class PageDataResp<L> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
@@ -39,6 +40,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
@Schema(description = "响应信息")
|
||||
public class R<T> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 是否成功 */
|
||||
|
@@ -19,7 +19,7 @@ package top.charles7c.cnadmin.common.util;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@@ -46,9 +46,8 @@ public class ExceptionUtils {
|
||||
* 异常
|
||||
*/
|
||||
public static void printException(Runnable runnable, Throwable throwable) {
|
||||
if (null == throwable && runnable instanceof Future<?>) {
|
||||
if (null == throwable && runnable instanceof Future<?> future) {
|
||||
try {
|
||||
Future<?> future = (Future<?>)runnable;
|
||||
if (future.isDone()) {
|
||||
future.get();
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
@@ -200,14 +200,14 @@ public class MailUtils {
|
||||
// 设置收信人
|
||||
// 抄送人
|
||||
if (CollUtil.isNotEmpty(ccs)) {
|
||||
messageHelper.setCc(ccs.toArray(new String[0]));
|
||||
messageHelper.setCc(ccs.toArray(String[]::new));
|
||||
}
|
||||
// 密送人
|
||||
if (CollUtil.isNotEmpty(bccs)) {
|
||||
messageHelper.setBcc(bccs.toArray(new String[0]));
|
||||
messageHelper.setBcc(bccs.toArray(String[]::new));
|
||||
}
|
||||
// 收件人
|
||||
messageHelper.setTo(tos.toArray(new String[0]));
|
||||
messageHelper.setTo(tos.toArray(String[]::new));
|
||||
|
||||
// 设置附件
|
||||
if (ArrayUtil.isNotEmpty(files)) {
|
||||
|
@@ -18,8 +18,8 @@ package top.charles7c.cnadmin.common.util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@@ -18,7 +18,7 @@ package top.charles7c.cnadmin.common.util.helper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -26,7 +26,7 @@ import lombok.NoArgsConstructor;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.constant.CacheConsts;
|
||||
@@ -58,7 +58,7 @@ public class LoginHelper {
|
||||
public static String login(LoginUser loginUser) {
|
||||
// 记录登录信息
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
loginUser.setClientIp(ServletUtil.getClientIP(request));
|
||||
loginUser.setClientIp(JakartaServletUtil.getClientIP(request));
|
||||
loginUser.setLocation(IpUtils.getCityInfo(loginUser.getClientIp()));
|
||||
loginUser.setBrowser(ServletUtils.getBrowser(request));
|
||||
LogContext logContext = LogContextHolder.get();
|
||||
|
@@ -64,7 +64,6 @@ public class QueryHelper {
|
||||
if (null == query) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
// 获取查询条件中所有的字段
|
||||
List<Field> fieldList = ReflectUtils.getNonStaticFields(query.getClass());
|
||||
fieldList.forEach(field -> buildQuery(query, field, queryWrapper));
|
||||
@@ -86,7 +85,7 @@ public class QueryHelper {
|
||||
* 查询数据类型
|
||||
*/
|
||||
private static <Q, R> void buildQuery(Q query, Field field, QueryWrapper<R> queryWrapper) {
|
||||
boolean accessible = field.isAccessible();
|
||||
boolean accessible = field.canAccess(query);
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
// 没有 @Query,直接返回
|
||||
@@ -149,54 +148,31 @@ public class QueryHelper {
|
||||
String columnName = StrUtil.toUnderlineCase(StrUtil.blankToDefault(property, fieldName));
|
||||
QueryTypeEnum queryType = queryAnnotation.type();
|
||||
switch (queryType) {
|
||||
case EQUAL:
|
||||
queryWrapper.eq(columnName, fieldValue);
|
||||
break;
|
||||
case NOT_EQUAL:
|
||||
queryWrapper.ne(columnName, fieldValue);
|
||||
break;
|
||||
case GREATER_THAN:
|
||||
queryWrapper.gt(columnName, fieldValue);
|
||||
break;
|
||||
case LESS_THAN:
|
||||
queryWrapper.lt(columnName, fieldValue);
|
||||
break;
|
||||
case GREATER_THAN_OR_EQUAL:
|
||||
queryWrapper.ge(columnName, fieldValue);
|
||||
break;
|
||||
case LESS_THAN_OR_EQUAL:
|
||||
queryWrapper.le(columnName, fieldValue);
|
||||
break;
|
||||
case BETWEEN:
|
||||
case EQUAL -> queryWrapper.eq(columnName, fieldValue);
|
||||
case NOT_EQUAL -> queryWrapper.ne(columnName, fieldValue);
|
||||
case GREATER_THAN -> queryWrapper.gt(columnName, fieldValue);
|
||||
case LESS_THAN -> queryWrapper.lt(columnName, fieldValue);
|
||||
case GREATER_THAN_OR_EQUAL -> queryWrapper.ge(columnName, fieldValue);
|
||||
case LESS_THAN_OR_EQUAL -> queryWrapper.le(columnName, fieldValue);
|
||||
case BETWEEN -> {
|
||||
List<Object> between = new ArrayList<>((List<Object>)fieldValue);
|
||||
ValidationUtils.throwIf(between.size() != 2, "[{}] 必须是一个范围", fieldName);
|
||||
queryWrapper.between(columnName, between.get(0), between.get(1));
|
||||
break;
|
||||
case LEFT_LIKE:
|
||||
queryWrapper.likeLeft(columnName, fieldValue);
|
||||
break;
|
||||
case INNER_LIKE:
|
||||
queryWrapper.like(columnName, fieldValue);
|
||||
break;
|
||||
case RIGHT_LIKE:
|
||||
queryWrapper.likeRight(columnName, fieldValue);
|
||||
break;
|
||||
case IN:
|
||||
}
|
||||
case LEFT_LIKE -> queryWrapper.likeLeft(columnName, fieldValue);
|
||||
case INNER_LIKE -> queryWrapper.like(columnName, fieldValue);
|
||||
case RIGHT_LIKE -> queryWrapper.likeRight(columnName, fieldValue);
|
||||
case IN -> {
|
||||
ValidationUtils.throwIfEmpty(fieldValue, "[{}] 不能为空", fieldName);
|
||||
queryWrapper.in(columnName, (List<Object>)fieldValue);
|
||||
break;
|
||||
case NOT_IN:
|
||||
}
|
||||
case NOT_IN -> {
|
||||
ValidationUtils.throwIfEmpty(fieldValue, "[{}] 不能为空", fieldName);
|
||||
queryWrapper.notIn(columnName, (List<Object>)fieldValue);
|
||||
break;
|
||||
case IS_NULL:
|
||||
queryWrapper.isNull(columnName);
|
||||
break;
|
||||
case IS_NOT_NULL:
|
||||
queryWrapper.isNotNull(columnName);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(String.format("暂不支持 [%s] 查询类型", queryType));
|
||||
}
|
||||
case IS_NULL -> queryWrapper.isNull(columnName);
|
||||
case IS_NOT_NULL -> queryWrapper.isNotNull(columnName);
|
||||
default -> throw new IllegalArgumentException(String.format("暂不支持 [%s] 查询类型", queryType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
@@ -19,10 +19,10 @@ package top.charles7c.cnadmin.monitor.filter;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
@@ -21,8 +21,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -43,7 +43,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import cn.hutool.json.JSONArray;
|
||||
@@ -217,7 +217,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
: request.getRequestURL().append(StringConsts.QUESTION_MARK).append(request.getQueryString()).toString());
|
||||
String method = request.getMethod();
|
||||
logDO.setRequestMethod(method);
|
||||
logDO.setRequestHeaders(this.desensitize(ServletUtil.getHeaderMap(request)));
|
||||
logDO.setRequestHeaders(this.desensitize(JakartaServletUtil.getHeaderMap(request)));
|
||||
String requestBody = this.getRequestBody(request);
|
||||
logDO.setCreateUser(ObjectUtil.defaultIfNull(logDO.getCreateUser(), LoginHelper.getUserId()));
|
||||
String requestURI = request.getRequestURI();
|
||||
@@ -241,11 +241,11 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
requestBody = JSONUtil.toJsonStr(requestBodyJsonObjList);
|
||||
} else {
|
||||
requestBody = this.desensitize(ServletUtil.getParamMap(request));
|
||||
requestBody = this.desensitize(JakartaServletUtil.getParamMap(request));
|
||||
}
|
||||
logDO.setRequestBody(requestBody);
|
||||
}
|
||||
logDO.setClientIp(ServletUtil.getClientIP(request));
|
||||
logDO.setClientIp(JakartaServletUtil.getClientIP(request));
|
||||
logDO.setLocation(IpUtils.getCityInfo(logDO.getClientIp()));
|
||||
logDO.setBrowser(ServletUtils.getBrowser(request));
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
int status = response.getStatus();
|
||||
logDO.setStatusCode(status);
|
||||
logDO.setStatus(status >= HttpStatus.HTTP_BAD_REQUEST ? LogStatusEnum.FAILURE : logDO.getStatus());
|
||||
logDO.setResponseHeaders(this.desensitize(ServletUtil.getHeadersMap(response)));
|
||||
logDO.setResponseHeaders(this.desensitize(JakartaServletUtil.getHeadersMap(response)));
|
||||
// 响应体(不记录非 JSON 响应数据)
|
||||
String responseBody = this.getResponseBody(response);
|
||||
if (StrUtil.isNotBlank(responseBody) && JSONUtil.isTypeJSON(responseBody)) {
|
||||
@@ -350,7 +350,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
return false;
|
||||
}
|
||||
// 2、检查是否需要记录内网 IP 操作
|
||||
boolean isInnerIp = IpUtils.isInnerIp(ServletUtil.getClientIP(request));
|
||||
boolean isInnerIp = IpUtils.isInnerIp(JakartaServletUtil.getClientIP(request));
|
||||
if (isInnerIp && Boolean.FALSE.equals(operationLogProperties.getIncludeInnerIp())) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -36,6 +37,7 @@ import top.charles7c.cnadmin.monitor.enums.LogStatusEnum;
|
||||
@TableName("sys_log")
|
||||
public class LogDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "登录日志查询条件")
|
||||
public class LoginLogQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "操作日志查询条件")
|
||||
public class OperationLogQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "系统日志查询条件")
|
||||
public class SystemLogQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -32,6 +33,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "仪表盘-访问趋势信息")
|
||||
public class DashboardAccessTrendResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "仪表盘-访客地域分布信息")
|
||||
public class DashboardGeoDistributionResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -35,6 +36,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@Schema(description = "仪表盘-热门模块信息")
|
||||
public class DashboardPopularModuleResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -35,6 +36,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@Schema(description = "仪表盘-总计信息")
|
||||
public class DashboardTotalResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -34,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@Data
|
||||
public class LogResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -32,6 +34,7 @@ import top.charles7c.cnadmin.monitor.enums.LogStatusEnum;
|
||||
@Schema(description = "登录日志信息")
|
||||
public class LoginLogResp extends LogResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -32,6 +34,7 @@ import top.charles7c.cnadmin.monitor.enums.LogStatusEnum;
|
||||
@Schema(description = "操作日志信息")
|
||||
public class OperationLogResp extends LogResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,6 +32,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "系统日志详情信息")
|
||||
public class SystemLogDetailResp extends LogResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,6 +32,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "系统日志信息")
|
||||
public class SystemLogResp extends LogResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -19,7 +19,6 @@ package top.charles7c.cnadmin.monitor.service.impl;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -91,8 +90,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
List<Map<String, Object>> locationIpStatistics = logService.listDashboardGeoDistribution();
|
||||
DashboardGeoDistributionResp geoDistribution = new DashboardGeoDistributionResp();
|
||||
geoDistribution.setLocationIpStatistics(locationIpStatistics);
|
||||
geoDistribution.setLocations(
|
||||
locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).collect(Collectors.toList()));
|
||||
geoDistribution.setLocations(locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).toList());
|
||||
return geoDistribution;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -38,6 +39,7 @@ import cn.hutool.core.date.DatePattern;
|
||||
@Schema(description = "在线用户查询条件")
|
||||
public class OnlineUserQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,9 +16,10 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -34,6 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "账号登录信息")
|
||||
public class AccountLoginReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -39,6 +40,7 @@ import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||
@Schema(description = "邮箱登录信息")
|
||||
public class EmailLoginReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -39,6 +40,7 @@ import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||
@Schema(description = "手机号登录信息")
|
||||
public class PhoneLoginReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Builder;
|
||||
@@ -34,6 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "令牌信息")
|
||||
public class LoginResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -32,6 +33,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "元数据信息")
|
||||
public class MetaResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -33,6 +34,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "在线用户信息")
|
||||
public class OnlineUserResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -36,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
public class RouteResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.auth.model.resp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -41,6 +42,7 @@ import top.charles7c.cnadmin.common.enums.GenderEnum;
|
||||
@Schema(description = "用户信息")
|
||||
public class UserInfoResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import top.charles7c.cnadmin.common.base.BaseDO;
|
||||
@TableName("sys_announcement")
|
||||
public class AnnouncementDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -33,6 +35,7 @@ import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
@TableName("sys_dept")
|
||||
public class DeptDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -32,6 +34,7 @@ import top.charles7c.cnadmin.common.base.BaseDO;
|
||||
@TableName("sys_dict")
|
||||
public class DictDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -32,6 +34,7 @@ import top.charles7c.cnadmin.common.base.BaseDO;
|
||||
@TableName("sys_dict_item")
|
||||
public class DictItemDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -34,6 +36,7 @@ import top.charles7c.cnadmin.common.enums.MenuTypeEnum;
|
||||
@TableName("sys_menu")
|
||||
public class MenuDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -38,6 +39,7 @@ import top.charles7c.cnadmin.common.enums.MessageTypeEnum;
|
||||
@TableName("sys_message")
|
||||
public class MessageDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -36,6 +37,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@TableName("sys_option")
|
||||
public class OptionDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -34,6 +36,7 @@ import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
@TableName("sys_role")
|
||||
public class RoleDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@TableName("sys_role_dept")
|
||||
public class RoleDeptDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@TableName("sys_role_menu")
|
||||
public class RoleMenuDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -36,6 +37,7 @@ import top.charles7c.cnadmin.common.enums.GenderEnum;
|
||||
@TableName("sys_user")
|
||||
public class UserDO extends BaseDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@TableName("sys_user_role")
|
||||
public class UserRoleDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -35,6 +36,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@TableName("sys_user_social")
|
||||
public class UserSocialDO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -35,6 +36,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "公告查询条件")
|
||||
public class AnnouncementQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -35,6 +36,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "部门查询条件")
|
||||
public class DeptQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import top.charles7c.cnadmin.common.annotation.Query;
|
||||
@Schema(description = "字典项查询条件")
|
||||
public class DictItemQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import top.charles7c.cnadmin.common.annotation.Query;
|
||||
@Schema(description = "字典查询条件")
|
||||
public class DictQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -35,6 +36,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "菜单查询条件")
|
||||
public class MenuQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -38,6 +39,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "参数查询条件")
|
||||
public class OptionQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -34,6 +35,7 @@ import top.charles7c.cnadmin.common.annotation.Query;
|
||||
@Schema(description = "角色查询条件")
|
||||
public class RoleQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||
@Schema(description = "用户查询条件")
|
||||
public class UserQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,9 +16,10 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -38,6 +39,7 @@ import top.charles7c.cnadmin.common.base.BaseReq;
|
||||
@Schema(description = "创建或修改公告信息")
|
||||
public class AnnouncementReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,12 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -42,6 +44,7 @@ import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
@Schema(description = "创建或修改部门信息")
|
||||
public class DeptReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,7 +16,9 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -36,6 +38,7 @@ import top.charles7c.cnadmin.common.base.BaseReq;
|
||||
@Schema(description = "创建或修改字典项信息")
|
||||
public class DictItemReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,7 +16,9 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -37,6 +39,7 @@ import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||
@Schema(description = "创建或修改字典信息")
|
||||
public class DictReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,9 +16,12 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -27,6 +30,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseReq;
|
||||
import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||
import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
import top.charles7c.cnadmin.common.enums.MenuTypeEnum;
|
||||
|
||||
@@ -40,6 +44,7 @@ import top.charles7c.cnadmin.common.enums.MenuTypeEnum;
|
||||
@Schema(description = "创建或修改菜单信息")
|
||||
public class MenuReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@@ -61,7 +66,7 @@ public class MenuReq extends BaseReq {
|
||||
*/
|
||||
@Schema(description = "菜单标题", example = "用户管理")
|
||||
@NotBlank(message = "菜单标题不能为空")
|
||||
@Length(max = 30, message = "菜单标题长度不能超过 {max} 个字符")
|
||||
@Pattern(regexp = RegexConsts.GENERAL_NAME, message = "菜单标题长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
|
@@ -16,8 +16,10 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -38,6 +40,7 @@ import top.charles7c.cnadmin.common.enums.MessageTypeEnum;
|
||||
@Schema(description = "创建消息信息")
|
||||
public class MessageReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,7 +16,9 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -36,6 +38,7 @@ import top.charles7c.cnadmin.common.base.BaseReq;
|
||||
@Schema(description = "修改参数信息")
|
||||
public class OptionReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -35,6 +36,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "参数重置信息")
|
||||
public class OptionResetValueReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,12 +16,13 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -44,6 +45,7 @@ import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
@Schema(description = "创建或修改角色信息")
|
||||
public class RoleReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,11 +16,12 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -39,6 +40,7 @@ import top.charles7c.cnadmin.common.enums.GenderEnum;
|
||||
@Schema(description = "用户基础信息修改信息")
|
||||
public class UserBasicInfoUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -39,6 +40,7 @@ import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||
@Schema(description = "用户邮箱修改信息")
|
||||
public class UserEmailUpdateRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,9 +16,10 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -34,6 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "用户密码修改信息")
|
||||
public class UserPasswordUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -39,6 +40,7 @@ import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||
@Schema(description = "用户手机号修改信息")
|
||||
public class UserPhoneUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,12 +16,13 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -44,6 +45,7 @@ import top.charles7c.cnadmin.common.enums.GenderEnum;
|
||||
@Schema(description = "创建或修改用户信息")
|
||||
public class UserReq extends BaseReq {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.req;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -35,6 +36,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "用户角色修改信息")
|
||||
public class UserRoleUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user