Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
branches: [ main, dev, 2.x, 8.2.x, 17.3.x ]
pull_request:
branches: [ main, dev, 2.x, 8.2.x, 17.3.x ]

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: maven

- name: Compile
run: ./mvnw clean compile -P travis

- name: Test
run: ./mvnw test -P travis

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: springboot-starter/target/site/jacoco/jacoco.xml,springboot-starter-script/target/site/jacoco/jacoco.xml,springboot-starter-security/target/site/jacoco/jacoco.xml,springboot-starter-data-fast/target/site/jacoco/jacoco.xml,springboot-starter-data-authorization/target/site/jacoco/jacoco.xml
fail_ci_if_error: true
verbose: true

- name: Install
run: ./mvnw install -P travis -DskipTests
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ build/
.codegraph

### serena ###
.serena
.serena

### flatten-maven-plugin ###
.flattened-pom.xml
test.db*
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

42 changes: 20 additions & 22 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## 项目概述

springboot-framework 是一个基于 Spring Boot 3.3.5(Java 17)的多模块企业级开发框架,由 CodingApi 团队维护。核心定位是为领域驱动设计(DDD)与事件风暴提供开箱即用的基础设施,当前版本为 `3.4.55`
springboot-framework 是一个基于 Spring Boot 3.3.5(Java 17)的多模块企业级开发框架,由 CodingApi 团队维护。核心定位是为领域驱动设计(DDD)与事件风暴提供开箱即用的基础设施。当前开发版本为 `17.3.0-SNAPSHOT`,采用 Maven `${revision}` CI-Friendly 版本机制,正式发布时通过 `-Drevision=x.y.z` 指定正式版本号。版本号含义:17 = JDK 版本,3 = Spring Boot 大版本,第三位为补丁版本

**回复语言**:请使用中文进行回答。

Expand All @@ -19,30 +19,36 @@ springboot-framework 是一个基于 Spring Boot 3.3.5(Java 17)的多模块

# 运行单个模块的测试
./mvnw test -pl springboot-starter
./mvnw test -pl springboot-starter-flow
./mvnw test -pl springboot-starter-security

# 运行单个测试类
./mvnw test -pl springboot-starter -Dtest=SomeTestClass

# 运行 example 示例应用(端口 8090,H2 文件数据库)
./mvnw spring-boot:run -pl example/example-server

# 正式发布(通过 -Drevision 指定正式版本号,无需修改 pom)
./mvnw clean deploy -P ossrh -Drevision=17.3.0
```

### 前端(admin-ui / mobile-ui
### 前端(frontend monorepo

```bash
cd admin-ui # 或 mobile-ui
npm install
npm run dev # 开发模式(代理后端)
npm run mock # Mock 模式(前端 mock 数据)
npm run build # 生产构建
npm test # Jest 测试
cd frontend
pnpm install
pnpm dev:pc # PC 端开发模式(代理后端)
pnpm dev:mobile # 移动端开发模式(代理后端)
pnpm mock:pc # PC 端 Mock 模式(前端 mock 数据)
pnpm mock:mobile # 移动端 Mock 模式(前端 mock 数据)
pnpm build:pc # PC 端生产构建
pnpm build:mobile # 移动端生产构建
pnpm test:pc # PC 端 Jest 测试
pnpm test:mobile # 移动端 Jest 测试
```

- admin-ui 基于 React 18 + Ant Design 5 + Ant Design Pro Components + Rsbuild
- mobile-ui 基于 React 18 + Ant Design Mobile 5 + Rsbuild
- 两者都使用 Module Federation 做微前端集成
- apps/pc(原 admin-ui基于 React 18 + Ant Design 5 + Ant Design Pro Components + Rsbuild
- apps/mobile(原 mobile-ui基于 React 18 + Ant Design Mobile 5 + Rsbuild
- 两者由 pnpm workspace 统一管理,公共代码位于 packages/shared(@springboot-framework/shared);均使用 Module Federation 做微前端集成

## 模块架构

Expand All @@ -54,7 +60,6 @@ npm test # Jest 测试
| `springboot-starter-security` | Spring Security + JWT 无状态认证 / Redis 有状态认证,加解密支持 |
| `springboot-starter-data-fast` | JPA 增强:FastRepository 支持动态过滤查询、HQL 构建、SearchRequest |
| `springboot-starter-data-authorization` | 数据权限:通过 JDBC Connection/Statement 代理拦截 SQL,透明注入权限条件 |
| `springboot-starter-flow` | 工作流引擎:流程定义、节点流转、审批、委托、会签、数据快照、事件通知 |
| `springboot-starter-script` | Groovy 脚本引擎:运行时编译、LRU 缓存、热更新,提供 REST API |

### 自动配置注册
Expand All @@ -68,7 +73,6 @@ springboot-starter (核心,无外部依赖)
├── springboot-starter-security (依赖 starter)
├── springboot-starter-data-fast (依赖 starter)
├── springboot-starter-data-authorization (依赖 starter + JSqlParser)
├── springboot-starter-flow (依赖 starter)
└── springboot-starter-script (依赖 starter + Groovy)
```

Expand Down Expand Up @@ -102,7 +106,7 @@ MapResponse // Map 响应
```java
PageRequest request = PageRequest.of(0, 20);
request.addFilter("name", "张三");
request.addFilter("age", Relation.GT, 18);
request.addFilter("age", Relation.GREATER_THAN, 18);
Page<User> page = userRepository.findAll(request);
```

Expand All @@ -112,10 +116,6 @@ Page<User> page = userRepository.findAll(request);

`ConnectionProxy` → `PreparedStatementProxy` / `StatementProxy` 代理链,在 SQL 执行前通过 `SQLRunningContext.intercept(sql)` 注入权限条件,实现透明的行级数据过滤。使用 JSqlParser 解析和改写 SQL。

### 工作流引擎

核心流程:`FlowWork`(流程定义)→ `FlowNode`(节点)→ `FlowRecord`(审批记录)→ `FlowBackup`(版本快照)。发起流程通过 `FlowStartService.startFlow()` 驱动,审批通过 `FlowNodeService` 逐节点流转,每个状态变更推送 `FlowApprovalEvent`。

## DDD 示例项目结构(example 模块)

```
Expand All @@ -127,11 +127,9 @@ example/
example-app-cmd-domain — 命令服务(CQRS Command 侧,领域编排)
example-app-cmd-meta — 元数据命令服务
example-domain — 领域层
example-domain-leave — 请假领域(Entity、Repository、Service)
example-domain-user — 用户领域(Entity、Repository、Service、Event、Gateway)
example-infra — 基础设施层
example-infra-jpa — JPA 持久化实现
example-infra-flow — 工作流集成
example-infra-security — 安全配置
```

Expand All @@ -153,7 +151,7 @@ codingapi.framework.handler-thread-pool-size=20 # 事件异步线程池大小

## 关键依赖版本

见根 `pom.xml` 的 `<properties>` 区块。主要版本:Groovy 4.0.24、JSqlParser 5.0、Fastjson 2.0.53、JJWT 0.12.6、H2 2.3.232、Kryo 5.6.2
见根 `pom.xml` 的 `<properties>` 区块。主要版本:Groovy 4.0.24、JSqlParser 5.0、Fastjson 2.0.53、JJWT 0.12.6、H2 2.3.232。


<!-- PKR-START -->
Expand Down
22 changes: 19 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ Please make sure to read and observe our [Code of Conduct](./CODE_OF_CONDUCT.md)

### Setting up your development environment

You should have JDK 1.8 or later installed in your system.
You should have JDK 17 or later installed in your system.

The project ships with the Maven Wrapper, so there is no need to install Maven separately.

```bash
# Full build
./mvnw clean install

# Run the tests only (the same command CI uses)
./mvnw clean test -P travis
```

## Contributing

Expand All @@ -23,7 +33,13 @@ We are very glad to accept improvements for these aspects.

### GitHub workflow

We use the `dev` branch as the development branch, which indicates that this is a unstable branch.
Development mainly happens on version branches (e.g. `17.3.x`, `8.2.x`) and on the `dev` branch,
which is an unstable branch. The `main` branch stays stable, and CI runs on pushes and pull requests
targeting `main`, `dev`, `2.x`, `8.2.x` and `17.3.x`.

The project version (e.g. `17.3.0-SNAPSHOT`, where `17` is the JDK version, `3` is the Spring Boot
major version and the last number is the patch version) is managed with the Maven `${revision}`
CI-Friendly mechanism, so no `pom.xml` needs to be modified during development or for a release.

Here are the workflow for contributors:

Expand Down Expand Up @@ -74,4 +90,4 @@ All code should be well reviewed by one or more committers. Some principles:

#### Mailing list

If you have any questions or advice, please contact 1991wangliang@gmail.com.
If you have any questions or advice, please contact wangliang@codingapi.com.
Loading
Loading