CreateOrderCommand
Command for creating a new order with items and shipping address. Package:com.ecommerce.order.sdk.command.order
Fields
List of order items. Cannot be empty.Validation:
@NotEmpty - “订单项不能为空” (Order items cannot be empty)Shipping address for the order.Validation:
@NotNull - “订单地址不能为空” (Order address cannot be empty)Example
OrderItemCommand
Represents a single item within an order. Package:com.ecommerce.order.sdk.command.order
Fields
Unique identifier of the product.Validation:
@NotBlank - “产品ID不能为空” (Product ID cannot be empty)Quantity of the product.Validation:
@Min(1) - “产品数量必须大于0” (Product quantity must be greater than 0)Unit price of the product.Validation:
@NotNull - “产品单价不能为空” (Product unit price cannot be empty)Example
ChangeAddressDetailCommand
Command for updating the detailed address of an existing order. Package:com.ecommerce.order.sdk.command.order
Fields
New detailed address string.Validation:
@NotNull - “详细地址不能为空” (Detailed address cannot be empty)Example
ChangeProductCountCommand
Command for updating the quantity of a specific product in an order. Package:com.ecommerce.order.sdk.command.order
Fields
ID of the product to update.Validation:
@NotBlank - “产品ID不能为空” (Product ID cannot be empty)New quantity for the product.Validation:
@Min(1) - “产品数量必须大于0” (Product quantity must be greater than 0)Example
PayOrderCommand
Command for processing payment for an order. Package:com.ecommerce.order.sdk.command.order
Fields
Amount paid by the customer.Validation:
@NotNull - “支付金额不能为空” (Payment amount cannot be empty)Example
Validation
All command classes use Bean Validation (JSR 303) annotations. When using these commands with Spring Boot, validation is automatically performed when the@Valid annotation is present on controller method parameters.