generated from youfool-project/youfool-prj-springboot-template
4.1 KiB
4.1 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 Spring Boot course management system (youfool-course) built with the youfool-framework-springboot3. It's a training course platform that handles course management, user authentication, and related functionality.
Technology Stack
- Java 21 - Latest LTS Java version
- Spring Boot 3.4.5 - Main framework
- PostgreSQL - Primary database
- MyBatis-Plus - ORM with dynamic datasource support
- Sa-Token - Authentication and authorization
- Thymeleaf - Template engine
- Knife4j - API documentation (Swagger)
- Druid - Database connection pool
- Lombok - Code generation
Development Commands
Build and Run
# Compile the project
mvn compile
# Run tests
mvn test
# Package the application
mvn package
# Run the application (development)
mvn spring-boot:run
# Run with specific profile
mvn spring-boot:run -Dspring-boot.run.profiles=dev
Code Quality
# Run checkstyle validation
mvn checkstyle:check
# Skip tests during build
mvn package -DskipTests=true
Database Operations
The project uses dynamic datasources with @DSTransactional instead of @Transactional for transaction management.
Architecture
Package Structure
com.chinaweal.youfool.course- Main application packagecontroller/- REST API controllers and web controllersservice/- Business logic layer with service interfaces and implementationsmapper/- MyBatis data access layerentity/- JPA/MyBatis entity classesconfig/- Configuration classes including datasource setupcommon/- Shared utilities and constantsdev/- Development tools including code generators
Key Components
Data Source Configuration
- Uses dynamic datasource from
苞米豆(baomidou) - Primary datasource:
master - Framework datasource:
youfool(for restLog storage) - Configuration in
PrjDataSource.javaandapplication.yml
Authentication System
- Sa-Token based authentication with JWT support
- OAuth2 integration with Gitea
- Session management with custom
UserBaseExtendentity - Default admin credentials: username
admin, password123456
Entity Relationships
Core entities:
Course- Main course entity with ID, date, name, descriptionCourseVideo- Course video attachmentsCourseAttachment- General course attachmentsCourseComment- Course discussion/commentsSysUser- System user management
Code Generation
The project includes code generation tools:
TableCodeGen- Generates entity, mapper, service, controller from database tablesConstantCodeGen- Generates constantsEnumsCodeGen- Generates enums- Configuration in
properties/codeGenerator.properties
Application URLs
When running locally:
- Application: http://localhost:8080/course
- API Documentation: http://localhost:8080/course/doc.html (admin/123456)
- Druid Monitor: http://localhost:8080/course/druid (admin/123456)
- CMS Backend: http://localhost:8080/course/cms (admin/123456)
Configuration Files
application.yml- Main configuration with datasource, security, and application settingsapplication-dev.yml- Development environment configurationapplication-prod.yml- Production environment configurationcheckstyle-v1.0.xml- Code style rules
Database Transaction Management
Important: When working with transactions, always use @DSTransactional instead of @Transactional due to the dynamic datasource configuration.
Security Configuration
- JWT tokens with configurable TTL (default 125 minutes)
- SM3 encryption for password storage
- File upload size limit: 100MB
- CORS and security filter configurations in
SpringMvcConfig
Development Notes
- The project uses Chinese comments and documentation
- Default context path is
/course - Logging directory:
../logs(configurable viaLOG_PATHenvironment variable) - Caching is enabled via
@EnableCaching - The application extends
SpringBootServletInitializerfor WAR deployment