-- 销售台账工艺路线完成记录表
CREATE TABLE IF NOT EXISTS `sales_ledger_process_route_record` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `sales_ledger_id` bigint NOT NULL COMMENT '销售台账ID',
  `sales_ledger_process_route_id` bigint NOT NULL COMMENT '销售台账工艺路线ID',
  `is_completed` int DEFAULT 0 COMMENT '是否完成(0-否,1-是)',
  `completed_time` datetime DEFAULT NULL COMMENT '完成时间',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
  PRIMARY KEY (`id`),
  KEY `idx_slprr_sales_ledger_id` (`sales_ledger_id`),
  KEY `idx_slprr_sales_ledger_process_route_id` (`sales_ledger_process_route_id`),
  KEY `idx_slprr_completed_time` (`completed_time`),
  CONSTRAINT `fk_slprr_sales_ledger_process_route_id`
    FOREIGN KEY (`sales_ledger_process_route_id`) REFERENCES `sales_ledger_process_route` (`id`)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售台账工艺路线完成记录';