M3-deploy.yaml 3.7 KB
# M3 服务与数据库部署映射 (v2.1:新增 EmployeeAggregate→t_employee_main、AuditOrder API 与订单审核列映射)
# 领域实体 -> 物理表/字段映射;引擎据此自动建表并生成动态SQL,前端无硬编码URL。
deploymentMappings:
  globalConfig:
    dbEngine: mysql8
    defaultSchema: trade_db
    idGen: snowflake

  aggregateMappingList:
    - aggregateId: CustomerAggregate
      serviceName: customer-service
      commandApi:
        CreateCustomer: /api/v1/customer/create
        ModifyCustomerInfo: /api/v1/customer/modify
      tableMappings:
        - domainEntity: Customer
          table: t_customer_main
          pk: customer_id
          fieldMap:
            customerId: customer_id
            customerName: cust_name
            contactPhone: phone
            registerTime: register_time
            customerLevel: cust_level

    - aggregateId: ProductAggregate
      serviceName: product-service
      commandApi:
        CreateProduct: /api/v1/product/create
        ModifyProductPrice: /api/v1/product/price
        StockDeduct: /api/v1/product/stock/deduct
      tableMappings:
        - domainEntity: Product
          table: t_product_main
          pk: product_id
          fieldMap:
            productId: product_id
            productName: prod_name
            skuCode: sku_code
            category: category
            saleCurrency: currency
            salePrice: sale_price
            stockNum: stock_num
            isOnSale: is_on_sale

    - aggregateId: OrderAggregate
      serviceName: order-service
      commandApi:
        CreateOrder: /api/v1/order/create
        ModifyOrderDeliveryAddress: /api/v1/order/addr
        CancelOrder: /api/v1/order/cancel
        AuditOrder: /api/v1/order/audit
      tableMappings:
        - domainEntity: Order
          table: t_order_main
          pk: order_id
          fieldMap:
            orderId: order_id
            createTime: create_time
            totalCurrency: total_currency
            totalAmount: total_amt
            customerId: cust_id
            orderStatus: order_status
            auditorId: auditor_id
            auditorName: auditor_name
            auditTime: audit_time
            auditRemark: audit_remark
        - domainEntity: OrderItem
          table: t_order_item
          pk: item_id
          fieldMap:
            itemId: item_id
            productId: product_id
            quantity: buy_qty
            itemCurrency: item_currency
            itemPrice: item_price
        - domainEntity: PaymentTerm
          table: t_order_payment_term
          pk: term_id
          fieldMap:
            termId: term_id
            paymentType: pay_type
            dueDays: due_days
            depositRatio: deposit_ratio
            settleCurrency: settle_currency
            settleAmount: settle_amt
        - domainEntity: DeliveryAddressEntity
          table: t_order_address
          pk: addr_id
          fieldMap:
            addrId: addr_id
            province: province
            city: city
            district: district
            streetDetail: street
            receiverName: receiver_name
            receiverPhone: receiver_phone

    - aggregateId: EmployeeAggregate
      serviceName: employee-service
      commandApi:
        CreateEmployee: /api/v1/employee/create
        ModifyEmployee: /api/v1/employee/modify
      tableMappings:
        - domainEntity: Employee
          table: t_employee_main
          pk: employee_id
          fieldMap:
            employeeId: employee_id
            employeeName: emp_name
            department: dept
            auditApproveCount: approve_count
            auditRejectCount: reject_count
            remark: remark
            lastAuditTime: last_audit_time