Files
aiot-platform-cloud/sql/mysql/ops_order_security_ext.sql
lzh d53d1c4584 feat(ops): 新增安保模块数据模型与 Mapper
新增安保区域人员绑定表 ops_area_security_user 和安保工单扩展表
ops_order_security_ext,以及对应的 DO 和 Mapper 接口。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:32:56 +08:00

42 lines
2.4 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数组',
-- 关键时间点
`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;