# M1 DDD聚合领域静态模型 (v2.2:EmployeeAggregate 增审核统计字段 auditApproveCount/auditRejectCount/remark/lastAuditTime;订单审核字段见 Order) # 领域聚合唯一数据源:前端所有拖拽组件强制绑定本层字段,禁止自定义字段。 aggregates: # 聚合1:客户聚合 CustomerAggregate - aggregateId: CustomerAggregate description: 客户主数据聚合,独立事务边界 aggregateRoot: name: Customer identifier: customerId attributes: - name: customerName type: string - name: contactPhone type: string constraints: pattern: "^\\d{11}$" patternMessage: 手机号需为 11 位数字 - name: registerTime type: datetime - name: customerLevel type: string entities: [] valueObjects: [] # 聚合2:产品聚合 ProductAggregate - aggregateId: ProductAggregate description: 商品主数据聚合,独立事务边界 aggregateRoot: name: Product identifier: productId attributes: - name: productName type: string - name: skuCode type: string constraints: unique: true - name: category type: string - name: saleCurrency type: string - name: salePrice type: decimal constraints: exclusiveMin: 0 - name: stockNum type: int constraints: min: 0 - name: isOnSale type: boolean entities: [] valueObjects: [] # 聚合3:订单聚合 OrderAggregate - aggregateId: OrderAggregate description: 订单业务聚合,独立事务边界 aggregateRoot: name: Order identifier: orderId attributes: - name: createTime type: datetime - name: totalCurrency type: string - name: totalAmount type: decimal - name: customerId type: string refAggregate: CustomerAggregate refRoot: Customer refIdentifier: customerId description: 客户ID,引用客户聚合根主键 # 审核相关字段:由 AuditOrder 命令的 bizSteps 指令程序通用填充(非订单专用引擎代码) - name: orderStatus type: string description: 订单状态(如 CREATED/PASS/REJECT),AuditOrder 按审核结果置位 - name: auditorId type: string refAggregate: EmployeeAggregate refRoot: Employee refIdentifier: employeeId description: 审核人工号,引用员工聚合根主键 - name: auditorName type: string - name: auditTime type: datetime - name: auditRemark type: string - name: auditResult type: string description: 审核结论(PASS/REJECT)——AuditOrder 命令入参,仅用于 CONDITION_SET_FIELD 派生 orderStatus;未在 M3 建列,故为不落库的瞬态字段 relations: - ref: OrderItem relationType: composition - ref: PaymentTerm relationType: composition - ref: DeliveryAddressEntity relationType: composition entities: - name: OrderItem localIdentifier: itemId attributes: - name: productId type: string refAggregate: ProductAggregate refRoot: Product refIdentifier: productId description: 商品ID,引用产品聚合根主键 - name: quantity type: int constraints: min: 1 - name: itemCurrency type: string - name: itemPrice type: decimal - name: PaymentTerm localIdentifier: termId attributes: - name: paymentType type: string - name: dueDays type: int constraints: min: 0 - name: depositRatio type: decimal constraints: min: 0 max: 1 - name: settleCurrency type: string - name: settleAmount type: decimal - name: DeliveryAddressEntity localIdentifier: addrId attributes: - name: province type: string - name: city type: string - name: district type: string - name: streetDetail type: string - name: receiverName type: string - name: receiverPhone type: string constraints: pattern: "^\\d{11}$" patternMessage: 收货手机号需为 11 位数字 valueObjects: [] # 聚合4:员工聚合 EmployeeAggregate(供 AuditOrder 的 REMOTE_QUERY_SET_FIELD 查审核人姓名; # 并承载审核统计——AuditOrder 的 bizSteps 条件程序按审核结果通用地回写这些字段) - aggregateId: EmployeeAggregate description: 员工主数据聚合,独立事务边界 aggregateRoot: name: Employee identifier: employeeId attributes: - name: employeeName type: string - name: department type: string - name: auditApproveCount type: int constraints: min: 0 description: 累计审核通过数——AuditOrder 命中 PASS 时 REMOTE_INCREMENT_FIELD +1 - name: auditRejectCount type: int constraints: min: 0 description: 累计审核驳回数——AuditOrder 命中 REJECT 时 REMOTE_INCREMENT_FIELD +1 - name: remark type: string description: 备注——AuditOrder 在订单金额>100 时以 REMOTE_SET_FIELD 覆盖写入审核备注 - name: lastAuditTime type: datetime description: 上次审核时间——AuditOrder 每次审核以 REMOTE_SET_FIELD 覆盖为本次审核时间 entities: [] valueObjects: [] globalConstraints: - crossAggRefRule: 跨聚合仅允许引用对方【聚合根唯一标识】,禁止引用对方内部实体、值对象 - transactionBoundary: 一次事务只能修改同一个聚合内对象,跨聚合拆分为多个事务 - cascadeDelete: 聚合根删除时,级联删除自身内部所有组合子实体 - foreignKeyStrategy: "业务层做引用校验,默认不创建数据库物理外键;如需物理外键增加 dbForeignKey: true"