Files
aiot-platform-cloud/sql/mysql/ops_order_security_ext.sql
lzh c9d443a75b feat(sql): 安保工单扩展表新增 false_alarm 字段,附增量迁移脚本
- DDL: ops_order_security_ext 新增 false_alarm tinyint(1) 列
- 增量迁移: ops_order_security_ext_migrate.sql 供已部署环境 ALTER TABLE

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 10:35:30 +08:00

43 lines
2.5 KiB
SQL
Raw 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.

-- ----------------------------
-- Table structure for ops_order_security_ext
-- ----------------------------
DROP TABLE IF EXISTS `ops_order_security_ext`;
CREATE TABLE `ops_order_security_ext` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`ops_order_id` bigint NOT NULL COMMENT '工单ID关联 ops_order.id',
-- 告警来源(告警工单必填,手动工单可空)
`alarm_id` varchar(64) DEFAULT NULL COMMENT '关联告警ID',
`alarm_type` varchar(50) DEFAULT NULL COMMENT '告警类型: intrusion/leave_post/fire/fence',
`camera_id` varchar(64) DEFAULT NULL COMMENT '摄像头ID',
`roi_id` varchar(64) DEFAULT NULL COMMENT 'ROI区域ID',
`image_url` varchar(512) DEFAULT NULL COMMENT '告警截图URL',
-- 处理人(冗余快照,创建时写入)
`assigned_user_id` bigint DEFAULT NULL COMMENT '处理人user_id',
`assigned_user_name` varchar(100) DEFAULT NULL COMMENT '处理人姓名',
`assigned_team_id` bigint DEFAULT NULL COMMENT '班组ID',
-- 处理结果(完成时提交)
`result` text DEFAULT NULL COMMENT '处理结果描述',
`result_img_urls` varchar(2048) DEFAULT NULL COMMENT '处理结果图片URLJSON数组',
`false_alarm` tinyint(1) DEFAULT NULL COMMENT '是否误报: 1=误报',
-- 关键时间点
`dispatched_time` datetime DEFAULT NULL COMMENT '派单时间',
`confirmed_time` datetime DEFAULT NULL COMMENT '确认时间',
`completed_time` datetime DEFAULT NULL COMMENT '完成时间',
-- 审计字段
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_ops_order_id` (`ops_order_id`, `deleted`) USING BTREE,
INDEX `idx_alarm_id` (`alarm_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '安保工单扩展表' ROW_FORMAT = Dynamic;