优化GEO
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
小蚂蚁云 (EasyGoAdmin) — a Chinese-language enterprise admin platform. A **monolith assembled from a Maven multi-module backend** (Java 17, Spring Boot 3.3.0) plus a **Vue 3 SPA frontend** in `xiaomayi-ui/`. Despite module names suggesting microservices, all services are packaged as library jars into single deployable apps (`xiaomayi-admin`, `xiaomayi-web`, `xiaomayi-uniapp`) that component-scan `com.xiaomayi.*`.
|
||||
|
||||
Code comments, commit messages, and UI text are in Chinese.
|
||||
|
||||
## Commands
|
||||
|
||||
### Backend (Maven, run from repo root)
|
||||
|
||||
```bash
|
||||
mvn clean install # build all modules
|
||||
mvn clean package -P prod # build with profile: local (default) | dev | test | uat | prod
|
||||
mvn -pl xiaomayi-modules/xiaomayi-admin -am spring-boot:run # run admin app
|
||||
```
|
||||
|
||||
The admin app can also be started from the IDE via `com.xiaomayi.admin.XMAdminApplication`. It listens on port **8081** with context path `/api`. There are no backend tests in the repo.
|
||||
|
||||
### Frontend (`xiaomayi-ui/`, uses pnpm)
|
||||
|
||||
```bash
|
||||
pnpm install # or: pnpm bootstrap
|
||||
pnpm dev # dev server on port 8001, proxies /api -> http://127.0.0.1:8081/api
|
||||
pnpm build # production build (same as build:prod)
|
||||
pnpm build:test # test-env build
|
||||
pnpm type:check # vue-tsc type check
|
||||
pnpm lint:eslint # eslint --fix on src/
|
||||
pnpm lint:stylelint # stylelint --fix
|
||||
pnpm lint:prettier # prettier --write
|
||||
```
|
||||
|
||||
Lint tooling: ESLint + Prettier + Stylelint + commitlint (conventional) + husky/lint-staged. There is no test suite.
|
||||
|
||||
## Backend Architecture
|
||||
|
||||
Module layout (parent `pom.xml` at root, version managed via `flatten-maven-plugin` + `${revision}`):
|
||||
|
||||
- **`xiaomayi-common/`** — ~35 independent starter-style libs, one directory per capability (`xiaomayi-security`, `xiaomayi-redis`, `xiaomayi-mybatis`, `xiaomayi-oss`, `xiaomayi-sms`, `xiaomayi-tenant`, `xiaomayi-datasource`, …). `xiaomayi-all` is the BOM aggregating them. Feature starters follow Spring Boot auto-configuration conventions.
|
||||
- **`xiaomayi-services/`** — business domains: `system`, `cms`, `product`, `order`, `member`, `logistics`, `invoice`, `quartz` (scheduling), `generator` (code generator). Each follows `controller / service / mapper / entity / dto / vo` under `com.xiaomayi.<domain>`, with MyBatis mapper XML in `src/main/resources/mapper/`.
|
||||
- **`xiaomayi-modules/`** — deployable applications that wire services + starters together:
|
||||
- `xiaomayi-admin` — the admin backend (main entry: `XMAdminApplication`)
|
||||
- `xiaomayi-web` — public website backend
|
||||
- `xiaomayi-uniapp` — mobile/API backend
|
||||
- **`xiaomayi-visual/`** — `xiaomayi-monitor` (Spring Boot Admin-style monitoring).
|
||||
|
||||
### Configuration layering (important)
|
||||
|
||||
`XMAdminApplication` excludes the default DataSource/Druid/MyBatis-Plus/Security auto-config; these are wired manually via the common starters. Config resolution:
|
||||
|
||||
1. `xiaomayi-modules/xiaomayi-admin/src/main/resources/application.yml` — imports shared feature configs from `configs/application-*.yml` (mybatis, security, tenant, springdoc, knife4j, payment, …).
|
||||
2. Maven profile (`-P local|dev|test|uat|prod`) sets `package.environment` → `spring.profiles.active` → loads `application-{env}.yml`.
|
||||
3. Each env yml imports env-specific overrides from `configs/{env}/` (redis, minio, aliyun OSS/SMS, email, token, elastic, dingtalk). Datasource config lives in `application-{env}.yml`.
|
||||
|
||||
To change behavior for one environment only, edit `configs/{env}/…`; for a cross-cutting feature, edit the shared `configs/application-*.yml`.
|
||||
|
||||
Database: MySQL, dynamic-datasource (multi-datasource capable, Druid pool), default `easygoadmin.web` at localhost:3306 (root/root in dev). Init SQL: `document/easygoadmin.web.sql`.
|
||||
|
||||
## Frontend Architecture (`xiaomayi-ui/`)
|
||||
|
||||
Vue 3 + TypeScript + Vite 3 + Element Plus + Pinia + vue-router 4 + TailwindCSS. Path alias `@` → `src/`.
|
||||
|
||||
- **Dynamic routes**: menus and routes come from the backend menu API (`src/api/system/menu`), formatted by `routerGenerator` in `src/router/generator-routers.ts`. `LAYOUT`/`IFRAME` are virtual components mapped in `router-guards.ts`. Adding a new admin page requires a menu record in the DB (component path points at the view file under `src/views/`), not just a router entry.
|
||||
- **HTTP**: centralized Axios wrapper in `src/utils/http/axios/` (transform hooks, cancel, error handling). API modules under `src/api/` mirror the backend domains and the page folders in `src/views/`.
|
||||
- **Env vars**: `.env` (base), `.env.development`, `.env.test`, `.env.production`. `VITE_PROXY` in `.env.development` controls the dev proxy.
|
||||
- **Build**: `build/` holds Vite plugin factory, proxy helper, and a post-build script (`build/script/postBuild.ts`); output goes to `dist/`.
|
||||
|
||||
## Deployment
|
||||
|
||||
`Dockerfile` (root) runs `xiaomayi-elevue.jar` on OpenJDK 17 alpine, port 8081. `docker-compose.yml` builds it with `network_mode: host`, mounting `./logs` → `/data/java/logs` and `./upload` → `/data/java/uploads` (file uploads land in `upload/`).
|
||||
Reference in New Issue
Block a user