ERPTurbo_Server/.claude/skills/add-field/SKILL.md
shenyifei e677ecde66 feat(biz): 添加对账管理功能
- 创建对账控制器实现增删改查接口
- 定义对账服务接口和数据传输对象
- 实现对账业务逻辑处理和数据转换
- 添加对账数据库实体和网关接口
- 集成对账发货单关联关系处理
- 更新经销商账户流水查询参数配置
2026-01-12 17:33:56 +08:00

79 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: "add-database-field"
description: "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:
```markdown
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