- 翻译41个控制器的所有@Tag和@Operation注解为中文 - Admin系列控制器:9个 - School系列控制器:13个 - Teacher系列控制器:9个 - Parent系列控制器:4个 - AuthController和FileUploadController:2个 - 翻译41个实体类的类注释为中文 - 管理员/教师/学生/家长/租户等核心实体 - 课程/课时/任务/成长档案等业务实体 - 各类关系映射实体 - 翻译21个DTO的@Schema注解为中文 - Request DTOs: 19个(创建/更新请求) - Response DTOs: 4个(登录/用户信息/课程/租户响应) - 新增CLAUDE.md项目文档 所有翻译确保符合上下文语义,保持代码功能不变。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5.4 KiB
5.4 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Kindergarten Course Management System (少儿智慧阅读平台) with a Spring Boot backend and Vue 3 frontend. The system manages courses, lessons, tasks, and student growth records for kindergartens.
Architecture
Backend (reading-platform-java)
- Framework: Spring Boot 3.2.3 + Java 17
- Persistence: MyBatis-Plus 3.5.5
- Security: Spring Security + JWT
- API Docs: Knife4j (Swagger OpenAPI 3)
- Database: MySQL 8.0
- Migration: Flyway
Frontend (reading-platform-frontend)
- Framework: Vue 3 + TypeScript + Vite
- UI: Ant Design Vue
- State: Pinia
- API: Axios with auto-generated TypeScript clients via Orval
Multi-Tenant Architecture
The system supports multiple kindergartens (tenants):
adminrole: Super admin (no tenant, manages system-wide courses)schoolrole: School administrator (manages school's teachers, students, classes)teacherrole: Teacher (manages lessons, tasks for their tenant)parentrole: Parent (views child's progress and tasks)
Each entity (except admin_users) has a tenant_id field. System courses have tenant_id = NULL.
Project Structure
kindergarten_java/
├── reading-platform-java/ # Spring Boot backend
│ ├── src/main/java/.../controller/
│ │ ├── admin/ # Super admin endpoints (/api/v1/admin/*)
│ │ ├── school/ # School admin endpoints (/api/v1/school/*)
│ │ ├── teacher/ # Teacher endpoints (/api/v1/teacher/*)
│ │ └── parent/ # Parent endpoints (/api/v1/parent/*)
│ ├── entity/ # Database entities (27 tables)
│ ├── mapper/ # MyBatis-Plus mappers
│ ├── service/ # Service layer interface + impl
│ ├── common/
│ │ ├── annotation/RequireRole # Role-based access control
│ │ ├── security/ # JWT authentication
│ │ ├── enums/ # UserRole, CourseStatus, etc.
│ │ ├── response/ # Result<T>, PageResult<T>
│ │ └── config/ # Security, MyBatis, OpenAPI configs
│ └── resources/
│ ├── db/migration/ # Flyway migration scripts
│ └── mapper/ # MyBatis XML files
│
├── reading-platform-frontend/ # Vue 3 frontend
│ ├── src/views/
│ │ ├── admin/ # Super admin pages
│ │ ├── school/ # School admin pages
│ │ ├── teacher/ # Teacher pages
│ │ └── parent/ # Parent pages
│ ├── api/generated/ # Auto-generated API clients
│ ├── api-spec.yml # OpenAPI specification
│ └── router/index.ts # Vue Router config
│
├── docker-compose.yml # Backend + Frontend services
└── docs/开发协作指南.md # Development guide (Chinese)
Key Patterns
1. Role-Based Access Control
Use @RequireRole annotation on controllers/services:
@RequireRole(UserRole.SCHOOL) // Only school admins can access
2. Tenant Isolation
Use SecurityUtils.getCurrentTenantId() in school/teacher/parent endpoints to filter data by current tenant.
3. Unified Response Format
Result<T> success(T data) // { code: 200, message: "success", data: ... }
Result<T> error(code, msg) // { code: xxx, message: "...", data: null }
4. OpenAPI-Driven Development
- Backend: Annotate controllers with
@Operation,@Parameter,@Schema - Frontend: Run
npm run api:updateto regenerate TypeScript clients fromapi-spec.yml
Development Commands
Backend
# Run with Docker Compose (recommended)
docker compose up --build
# Run locally (requires MySQL running)
cd reading-platform-java
mvn spring-boot:run
# Build
mvn clean package -DskipTests
Frontend
cd reading-platform-frontend
npm install
npm run dev
npm run build
# Update API clients from backend spec
npm run api:update
Database Migration
- Add new migration scripts to
reading-platform-java/src/main/resources/db/migration/V{n}__description.sql - Flyway runs automatically on backend startup (dev mode only)
Database Schema (27 Tables)
- Tenant: tenants, tenant_courses
- Users: admin_users, teachers, students, parents, parent_students
- Class: classes, class_teachers, student_class_history
- Course: courses, course_versions, course_resources, course_scripts, course_script_pages, course_activities
- Lesson: lessons, lesson_feedbacks, student_records
- Task: tasks, task_targets, task_completions, task_templates
- Growth: growth_records
- Resource: resource_libraries, resource_items
- Schedule: schedule_plans, schedule_templates
- System: system_settings, notifications, operation_logs, tags
Test Accounts
| Role | Username | Password |
|---|---|---|
| Admin | admin | admin123 |
| School | school | 123456 |
| Teacher | teacher1 | 123456 |
| Parent | parent1 | 123456 |
API Documentation
- Access: http://localhost:8080/doc.html (after backend starts)