新增将监狱带出记录写进数据库

This commit is contained in:
zqc
2026-01-09 15:22:43 +08:00
parent 9f1ef55a6a
commit 18efe72b2c
3 changed files with 339 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
"""
告警记录表模型
"""
from sqlalchemy import Column, Integer, String, DateTime, Text, Float, JSON, func
from sqlalchemy.ext.declarative import declarative_base
from database.base import BaseModel
Base = declarative_base()
# 告警类型常量
class AlertType:
"""告警类型常量类"""
BLACKLIST = 0 # 人脸黑名单
WHITELIST = 1 # 人脸白名单
PRISONER_OUT = 5 # 监狱犯人带出
class SurAlertRecord(BaseModel):
"""告警记录表"""
__tablename__ = "sur_alert_record"
alert_type = Column(Integer, nullable=False, comment="类型 0=人脸黑名单1=人脸白名单5=监狱犯人带出")
alert_message = Column(Text, comment="消息")
alert_data = Column(JSON, comment="数据")
ori_video_url = Column(Text, comment="原始视频")
ori_img_url = Column(Text, comment="原始图片")
processed_video_url = Column(Text, comment="处理后视频")
processed_img_url = Column(Text, comment="处理后图片")
camera_id = Column(Integer, comment="摄像头")
room_id = Column(Integer, comment="房间")
room_name = Column(Text, comment="房间名称")
person_id = Column(Integer, comment="人员")
confidence = Column(Float, comment="置信度")
handled = Column(Integer, default=0, comment="处理状态0=未处理1=已处理")
handler_id = Column(Integer, comment="处理人")
handled_time = Column(DateTime, comment="处理时间")
handle_notes = Column(Text, comment="处理备注")
def __repr__(self) -> str:
return f"<SurAlertRecord(id={self.id}, alert_type={self.alert_type}, person_id={self.person_id})>"