Files
wvp-platform/数据库/aiot/迁移-添加离岗倒计时参数.sql
16337 346e0fc5fe feat(aiot): 数据库schema更新 - 添加离岗倒计时参数
问题描述:
- 离岗检测算法param_schema缺少leave_countdown_sec参数
- 部分默认值不符合业务需求

修改内容:
1. 初始化-mysql-aiot.sql (Line 76)
   - leave_post算法新增参数:
     "leave_countdown_sec": {"type":"int","default":300,"min":0}
   - 修正默认值:
     confirm_leave_sec: 10 → 30秒
     cooldown_sec: 300 → 600秒

2. 新增迁移脚本:迁移-添加离岗倒计时参数.sql
   - UPDATE wvp_ai_algorithm表的param_schema
   - 适用于已部署的生产环境数据库升级

参数说明:
- confirm_on_duty_sec: 上岗确认期(默认10秒)
- confirm_leave_sec: 离岗确认期(默认30秒)
- leave_countdown_sec: 离岗倒计时(默认300秒=5分钟)
- cooldown_sec: 告警冷却期(默认600秒=10分钟)

业务流程:
人离开 → 30s确认离岗 → 300s倒计时 → 触发告警

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 15:06:59 +08:00

20 lines
991 B
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.

-- ============================================================
-- AIoT 离岗检测算法参数更新迁移脚本
-- 功能:添加 leave_countdown_sec离岗倒计时参数
-- 执行时间2026-02-12
-- ============================================================
-- 更新 leave_post 算法的 param_schema
-- 添加 leave_countdown_sec (默认300秒 = 5分钟)
-- 修正 confirm_leave_sec 默认值从10秒改为30秒
-- 修正 cooldown_sec 默认值从300秒改为600秒
UPDATE wvp_ai_algorithm
SET param_schema = '{"confirm_on_duty_sec":{"type":"int","default":10,"min":1},"confirm_leave_sec":{"type":"int","default":30,"min":1},"leave_countdown_sec":{"type":"int","default":300,"min":0},"cooldown_sec":{"type":"int","default":600,"min":0},"working_hours":{"type":"list","default":[]}}',
update_time = NOW()
WHERE algo_code = 'leave_post';
-- 验证更新结果
SELECT algo_code, algo_name, param_schema, update_time
FROM wvp_ai_algorithm
WHERE algo_code = 'leave_post';