test-backend/README.md

45 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ghb-base 后端jeecg-boot
> 这是 **ghb-base 基础框架**的后端。以后每个新系统都基于本框架开发——业务代码只写在 `ghb-module-business`框架层core/system不改。
> 基于 JeecgBoot 3.9.2 精简。
## 技术栈
- Spring Boot 3.5.5 / Java **17**
- MyBatis-Plus / Shiro + JWT / MySQL 8 / Redis 6
- 包名 `com.ghb.base` 数据库 `ghb_base` 上下文路径 `/ghb`
## 环境要求
- JDK 17+、Maven 3.8+、MySQL 8.0+、Redis 6.0+
## 第一次启动
1. 建库 `ghb_base`,导入初始化脚本:`../ghb_base_init.sql`(在 base 根目录)
2. 改连接:`ghb-module-system/ghb-system-start/src/main/resources/application-dev.yml`MySQL、Redis 地址)
3. 启动:
```bash
cd ghb-module-system/ghb-system-start
mvn spring-boot:run -Pdev
```
主类 `com.ghb.base.GhbSystemApplication`,端口 **8080**,访问前缀 `/ghb`(如 `http://localhost:8080/ghb`)。
## 模块结构(哪能改哪不能改)
```
jeecg-boot/
├── ghb-base-core/ 核心框架 ← 不改
├── ghb-module-system/ 租户/用户/角色/菜单/字典/日志 ← 不改
│ └── ghb-system-start/ 启动模块(含 application*.yml
├── ghb-module-business/ 业务代码 ← 写这里
└── ghb-server-cloud/ 微服务(网关/Nacos/监控)
```
## 新人必读(开始写代码前全部读完)
1. **`CLAUDE.md`**(本目录)/ base 根 `../CLAUDE.md` — AI 开发总纲
2. **`../.claude/`** 下全部规则:`contract.md`(契约/返回格式/同步铁律)、`backend.md`(分层/命名/CRUD 模板/检查表)、`database.md`、`git.md`、`security.md`、`testing.md`
3. **`../contract/`** — 接口契约(独立 git submodule。**改接口前必须先更新契约。**
## 铁律速记(详见 .claude/
- 返回一律 `Result` 包装,禁止裸 `return data;`
- Controller 只做参数校验 + 调 Service + 返回,方法体别超 20 行、别写 if/else 业务
- 手写 `@Select` SQL 必须带 `tenant_id` 条件(多租户,否则数据泄露)
- 新增表必须有 `create_time`/`update_time`/`del_flag`/`COMMENT`,金额字段用 `DECIMAL`
- commit 要带 `[AI: xxx]` 标注;改 entity/controller 后重新打包重启