文档更新

This commit is contained in:
sansen
2026-07-30 17:57:09 +08:00
parent e358a01ee7
commit 2361721c21
3 changed files with 67 additions and 47 deletions
+33 -7
View File
@@ -29,33 +29,59 @@ Each module has its own `CLAUDE.md` with module-specific architecture and conven
## Build & Run Commands
### Database Setup
```bash
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS weather_data_system DEFAULT CHARSET utf8mb4"
mysql -u root -p weather_data_system < system-admin/db/weather_data_system.sql
mysql -u root -p weather_data_system < system-admin/db/init_system_params.sql
```
### Backend
```bash
# Build everything (skip tests)
mvn clean package -DskipTests
# Build everything with tests
mvn clean package
# Build only system-admin module
cd system-admin && mvn package -DskipTests
# Run with dev profile
# Run a single test class
cd system-admin && mvn test -Dtest=RedisTest -DfailIfNoTests=false
# Run with dev profile (most common for local dev)
cd system-admin && mvn spring-boot:run -Dspring-boot.run.profiles=dev
# Run with other profiles
cd system-admin && mvn spring-boot:run -Dspring-boot.run.profiles=test
cd system-admin && mvn spring-boot:run -Dspring-boot.run.profiles=prod
```
Main entry: `system-admin/src/main/java/com/weather/AdminApplication.java`
Main entry: `system-admin/src/main/java/com/weather/AdminApplication.java`. Default account: `admin` / `admin`.
Backend is served at `http://localhost:8080/system-admin`. API docs at `http://localhost:8080/system-admin/doc.html`. Druid monitoring at `http://localhost:8080/system-admin/druid/`.
### Frontend
```bash
cd weather-data-ui
npm install
npm run dev # dev server on port 8001
npm run build # production build
npm run dev # dev server on port 8001, proxies /system-admin to backend
npm run build # production build, outputs to dist/
npm run lint # ESLint on src/**/*.{vue,ts}
npm run serve # build + vite preview
```
The Vite dev server proxies `/system-admin` requests to the backend. Edit `weather-data-ui/.env.development` and set `VITE_APP_API` to change the backend URL.
## Key Configuration
- **Dev profile**: `system-admin/src/main/resources/application-dev.yml` -- local MySQL (weather_data_system), Redis 127.0.0.1:6379
- **Prod profile**: `application-prod.yml` -- production configuration with external DB/Redis
- **project-options.redis.open**: toggles Redis caching globally (set via sys_params)
- **Dev profile** (`application-dev.yml`): local MySQL (weather_data_system), Redis 127.0.0.1:6379
- **Test profile** (`application-test.yml`): test server MySQL (192.168.2.186), Redis 192.168.2.186:6379
- **Prod profile** (`application-prod.yml`): production configuration with external DB/Redis
- **project-options.redis.open**: toggles Redis caching globally (set via sys_params table)
- **Tests are skipped by default**: `maven-surefire-plugin` has `<skipTests>true</skipTests>`. Tests use JUnit 4 with `SpringRunner` (`@SpringBootTest`). Override with `-DskipTests=false` or run individual tests via `-Dtest=`.
- **JDBC URL** uses `rewriteBatchedStatements=true` for MySQL batch INSERT optimization.