generated from youfool-project/youfool-prj-springboot-template
初始化
This commit is contained in:
parent
5f42096e55
commit
29794e033e
|
|
@ -0,0 +1,126 @@
|
|||
# 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
|
||||
```bash
|
||||
# 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
|
||||
```bash
|
||||
# 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 package
|
||||
- `controller/` - REST API controllers and web controllers
|
||||
- `service/` - Business logic layer with service interfaces and implementations
|
||||
- `mapper/` - MyBatis data access layer
|
||||
- `entity/` - JPA/MyBatis entity classes
|
||||
- `config/` - Configuration classes including datasource setup
|
||||
- `common/` - Shared utilities and constants
|
||||
- `dev/` - 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.java` and `application.yml`
|
||||
|
||||
#### Authentication System
|
||||
- Sa-Token based authentication with JWT support
|
||||
- OAuth2 integration with Gitea
|
||||
- Session management with custom `UserBaseExtend` entity
|
||||
- Default admin credentials: username `admin`, password `123456`
|
||||
|
||||
#### Entity Relationships
|
||||
Core entities:
|
||||
- `Course` - Main course entity with ID, date, name, description
|
||||
- `CourseVideo` - Course video attachments
|
||||
- `CourseAttachment` - General course attachments
|
||||
- `CourseComment` - Course discussion/comments
|
||||
- `SysUser` - System user management
|
||||
|
||||
#### Code Generation
|
||||
The project includes code generation tools:
|
||||
- `TableCodeGen` - Generates entity, mapper, service, controller from database tables
|
||||
- `ConstantCodeGen` - Generates constants
|
||||
- `EnumsCodeGen` - 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 settings
|
||||
- `application-dev.yml` - Development environment configuration
|
||||
- `application-prod.yml` - Production environment configuration
|
||||
- `checkstyle-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 via `LOG_PATH` environment variable)
|
||||
- Caching is enabled via `@EnableCaching`
|
||||
- The application extends `SpringBootServletInitializer` for WAR deployment
|
||||
Loading…
Reference in New Issue