kindergarten_java/reading-platform-java
Claude Opus 4.6 066b1f2257 refactor: 代码合规性审查修复 - 三层架构、API路径、文档规范
## P0 三层架构违规修复 (4项)
- 创建 SchoolStatsService/TeacherStatsService,移除Controller直接调用Mapper
- 修复 AdminCourseController 使用 Service 层方法
- 修复 TeacherCourseController 使用 ClassService 获取班级
- 新增 ClassService.getActiveClassesByTenantId()
- 新增 CourseService.createSystemCourse()

## P1 API 路径统一 (8项)
后端路径统一为 /api/v1/admin/*:
- AdminCourseController: /api/admin/courses → /api/v1/admin/courses
- AdminTenantController: /api/admin/tenants → /api/v1/admin/tenants

前端配置调整:
- vite.config.ts: 移除代理重写规则
- src/api/index.ts: baseURL /api/v1 → /api
- 更新 admin.ts, lesson.ts, package.ts, theme.ts 使用 /v1/admin/* 路径

## P2 文档规范更新 (5项)
- 更新 CLAUDE.md 前端 API 调用文档
- 新增三种调用方式说明(http/适配层/Orval客户端)
- 新增 API 路径规范表格
- 更新前端目录结构说明

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:13:46 +08:00
..
src/main refactor: 代码合规性审查修复 - 三层架构、API路径、文档规范 2026-03-13 14:13:46 +08:00
db_migrate.py feat: Java后端迁移完成 - 资源管理API修复与文档更新 2026-03-12 19:49:48 +08:00
db-migrate.sh feat: Java后端迁移完成 - 资源管理API修复与文档更新 2026-03-12 19:49:48 +08:00
init-users.sql fix: 修复登录问题 - 所有角色登录功能正常 2026-03-12 20:02:48 +08:00
pom.xml feat: Java后端迁移完成 - 资源管理API修复与文档更新 2026-03-12 19:49:48 +08:00
README.md 提交说明 2026-02-28 16:41:39 +08:00

Reading Platform Java Backend

Spring Boot + MyBatis-Plus backend for the Reading Platform.

Tech Stack

  • Java: 17
  • Spring Boot: 3.2.3
  • MyBatis-Plus: 3.5.5
  • MySQL: 8.0+
  • Spring Security + JWT: Authentication
  • Knife4j: API Documentation (Swagger)
  • Lombok: Boilerplate reduction

Project Structure

reading-platform-java/
├── pom.xml                          # Maven dependencies
├── src/main/java/com/reading/platform/
│   ├── ReadingPlatformApplication.java
│   ├── common/                      # Common components
│   │   ├── config/                  # Configuration classes
│   │   ├── exception/               # Exception handling
│   │   ├── response/                # Unified response
│   │   ├── security/                # JWT security
│   │   ├── annotation/              # Custom annotations
│   │   ├── enums/                   # Enum classes
│   │   ├── aspect/                  # AOP aspects
│   │   └── util/                    # Utilities
│   ├── entity/                      # Entity classes (27)
│   ├── mapper/                      # MyBatis-Plus mappers (27)
│   ├── service/                     # Service interfaces
│   ├── service/impl/                # Service implementations
│   ├── controller/                  # REST controllers
│   │   ├── admin/                   # Super admin endpoints
│   │   ├── school/                  # School admin endpoints
│   │   ├── teacher/                 # Teacher endpoints
│   │   └── parent/                  # Parent endpoints
│   └── dto/                         # Data Transfer Objects
│       ├── request/
│       └── response/
└── src/main/resources/
    ├── application.yml              # Main configuration
    ├── application-dev.yml          # Dev environment config
    ├── mapper/                      # MyBatis XML files
    └── db/migration/                # SQL scripts

Quick Start

1. Prerequisites

  • JDK 17+
  • Maven 3.6+
  • MySQL 8.0+

2. Database Setup

# Create database and import schema
mysql -u root -p < src/main/resources/db/migration/V1__init_schema.sql

3. Configuration

Edit src/main/resources/application-dev.yml:

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/reading_platform
    username: your_username
    password: your_password

4. Build and Run

# Build
mvn clean package -DskipTests

# Run
java -jar target/reading-platform-1.0.0.jar

# Or run with Maven
mvn spring-boot:run

5. API Documentation

After starting the application, access the API documentation at:

API Endpoints

Authentication

  • POST /api/auth/login - User login
  • GET /api/auth/me - Get current user info
  • POST /api/auth/change-password - Change password

Admin Endpoints

  • /api/admin/tenants - Tenant management
  • /api/admin/courses - System course management

School Endpoints

  • /api/school/teachers - Teacher management
  • /api/school/students - Student management
  • /api/school/classes - Class management
  • /api/school/parents - Parent management
  • /api/school/tasks - Task management
  • /api/school/growth-records - Growth record management

Teacher Endpoints

  • /api/teacher/courses - View courses
  • /api/teacher/lessons - Lesson management
  • /api/teacher/tasks - Task management
  • /api/teacher/growth-records - Growth record management
  • /api/teacher/notifications - Notifications

Parent Endpoints

  • /api/parent/children - Child information
  • /api/parent/tasks - View and complete tasks
  • /api/parent/growth-records - Growth record management
  • /api/parent/notifications - Notifications

Test Accounts

Role Username Password
Admin admin admin123

School, teacher, and parent accounts need to be created through the admin interface.

Database Tables (27)

Module 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

Development

Adding a New Entity

  1. Create entity class in entity/
  2. Create mapper interface in mapper/
  3. Create service interface in service/
  4. Create service implementation in service/impl/
  5. Create controller in appropriate controller/ subdirectory

Code Style

  • Use Lombok annotations to reduce boilerplate
  • Follow Spring Boot conventions
  • Use @RequireRole annotation for role-based access control

License

MIT License