Files
MES/yawei-mes/.sql/2026-02-24_v2.0.000_周启威_ATS.sql
2026-04-02 10:39:03 +08:00

38 lines
2.0 KiB
SQL
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.

-- =============================================
-- ATS批量任务表
-- 作者: 周启威
-- 日期: 2026-02-24
-- 版本: v2.0.0
-- 说明: 用于存储批量自动完成任务的状态和进度信息
-- =============================================
-- 创建批量任务表
CREATE TABLE `pro_batch_task` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
`task_id` varchar(50) NOT NULL COMMENT '任务编号',
`status` varchar(20) NOT NULL COMMENT '任务状态PENDING-待处理/PROCESSING-处理中/COMPLETED-已完成/FAILED-失败',
`total_count` int(11) NOT NULL DEFAULT 0 COMMENT '总订单数',
`processed_count` int(11) NOT NULL DEFAULT 0 COMMENT '已处理数量',
`success_count` int(11) NOT NULL DEFAULT 0 COMMENT '成功数量',
`failed_count` int(11) NOT NULL DEFAULT 0 COMMENT '失败数量',
`completed_count` int(11) NOT NULL DEFAULT 0 COMMENT '已完成(跳过)数量',
`start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
`estimated_seconds` int(11) DEFAULT NULL COMMENT '预计耗时(秒)',
`error_message` text COMMENT '错误信息',
`result_data` text COMMENT '结果数据(JSON格式)',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_task_id` (`task_id`),
KEY `idx_status` (`status`),
KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='批量任务表';
-- 插入测试数据(可选)
-- INSERT INTO `pro_batch_task` (`task_id`, `status`, `total_count`, `processed_count`, `success_count`, `failed_count`, `completed_count`, `start_time`, `estimated_seconds`, `create_by`)
-- VALUES ('TASK_20260224_001', 'COMPLETED', 10, 10, 9, 1, 0, NOW(), 10, 'system');