ERPTurbo_Server/.claude/skills/add-field/SKILL.md
shenyifei 00efacd14c feat(dealer): 添加经销商账款明细管理功能
- 创建经销商账款明细控制器,提供完整的CRUD接口
- 定义经销商账款明细服务接口和实现类
- 添加创建、查询、更新、删除经销商账款明细的数据传输对象
- 实现经销商账款明细的领域实体和网关接口
- 集成订单发货单的应收金额和调整总额字段
- 添加分页查询中发货时间范围筛选功能
- 实现经销商账款明细的数据访问对象和转换器
2026-01-09 18:02:23 +08:00

2.7 KiB
Raw Blame History

name description
Add Database Field Standardized field addition tool for ERPTurbo project. Automatically adds fields to DO, VO, Cmd, and Domain Entity classes with proper type mapping, annotations, and generates DDL migration script. Supports snake_case to camelCase conversion, BigDecimal for decimal types, and proper Java imports.

Add Database Field

Add fields to ERPTurbo project entities following the standard DDD layered architecture.

⚠️ 重要规则

仅操作 erp-turbo-business 模块,禁止修改 erp-turbo-svc 模块!

详见:.claude/PROJECT_RULES.md

Workflow

Input Format

Provide field information in this format:

Field: field_name | java_type | default_value | comment

Example:

Field: receivable_amount | BigDecimal | 0.00 | 应收金额(元)
Field: adjusted_amount | BigDecimal | 0.00 | 调整总额(元)

Supported Java Types

Database Type Java Type Import
DECIMAL(p,s) BigDecimal java.math.BigDecimal
INT / BIGINT Long (primitive)
VARCHAR String (primitive)
DATETIME LocalDateTime java.time.LocalDateTime
DATE LocalDate java.time.LocalDate
BOOLEAN / TINYINT Boolean (primitive)
DOUBLE / FLOAT Double (primitive)

Workflow

  1. Locate Entity File: Find *DO.java in erp-turbo-business/erp-turbo-biz/.../infrastructure/entity/ 跳过 erp-turbo-svc
  2. Find Related Files: Locate corresponding VO, Cmd, common DTO, and domain Entity files仅在 erp-turbo-business 模块
  3. Add Import: Add java.math.BigDecimal if needed
  4. Add Field: Insert after remark field with proper annotations:
    • DO: @TableField(value = "snake_case_name")
    • VO: @Schema(title = "comment")
    • Cmd: @Schema(title = "comment")
    • Domain Entity: No annotations
  5. Generate DDL: Output migration script

Output Example

✅ 已完成字段添加
========================================
文件变更:
✅ biz/.../entity/OrderShipDO.java
✅ api/.../vo/OrderShipVO.java
✅ api/.../cmd/OrderShipCreateCmd.java
✅ api/.../cmd/OrderShipUpdateCmd.java
✅ api/.../common/OrderShip.java
✅ biz/.../domain/entity/OrderShip.java

⚠️ 请执行数据库迁移:
ALTER TABLE order_ship
ADD COLUMN receivable_amount DECIMAL(16, 2) DEFAULT 0.00 NULL COMMENT '应收金额(元)',
ADD COLUMN adjusted_amount DECIMAL(16, 2) DEFAULT 0.00 NULL COMMENT '调整总额(元)';

Naming Convention

  • Database: snake_case (e.g., receivable_amount)
  • Java: camelCase (e.g., receivableAmount)
  • Comment: Chinese description with unit if applicable