Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:28:30 +08:00
commit 171acedaa4
220 changed files with 85967 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# CRUD Reference (Quick)
- Status codes: POST 201, GET 200, PUT/PATCH 200, DELETE 204.
- Validation: jakarta.validation annotations on DTOs.
- Repositories: feature-scoped interfaces + Spring Data adapters.

View File

@@ -0,0 +1,12 @@
# Product Feature Examples (Skeleton)
Feature structure:
- domain/model/Product.java
- domain/repository/ProductRepository.java
- infrastructure/persistence/ProductEntity.java
- infrastructure/persistence/ProductJpaRepository.java
- infrastructure/persistence/ProductRepositoryAdapter.java
- application/service/ProductService.java
- presentation/dto/ProductRequest.java
- presentation/dto/ProductResponse.java
- presentation/rest/ProductController.java

View File

@@ -0,0 +1,35 @@
# CRUD Generator Usage
Quick start:
```
python skills/spring-boot/spring-boot-crud-patterns/scripts/generate_crud_boilerplate.py \
--spec skills/spring-boot/spring-boot-crud-patterns/assets/specs/product.json \
--package com.example.product \
--output ./generated \
--templates-dir skills/spring-boot/spring-boot-crud-patterns/templates [--lombok]
```
Spec (JSON/YAML):
- entity: PascalCase name (e.g., Product)
- id: { name, type (Long|UUID|...), generated: true|false }
- fields: array of { name, type }
- relationships: optional (currently model as FK ids in fields)
What gets generated:
- REST controller at /v1/{resources} with POST 201 + Location header
- Pageable list endpoint returning PageResponse<T>
- Application mapper (application/mapper/${Entity}Mapper) for DTO↔Domain
- Exception types: ${Entity}NotFoundException, ${Entity}ExistException + ${Entity}ExceptionHandler
- GlobalExceptionHandler with validation + DataIntegrityViolationException→409
DTOs:
- Request excludes id when id.generated=true
- Response always includes id
JPA entity:
- @Id with @GeneratedValue(IDENTITY) for numeric generated ids
Notes:
- Provide all templates in templates/ (see templates/README.md)
- Use --lombok to add Lombok annotations without introducing blank lines between annotations

View File

@@ -0,0 +1,5 @@
# Spring Docs Pointers
- Spring Boot Reference Guide
- Spring Data JPA Reference
- Validation (Jakarta Validation)