42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
"""
|
||
告警记录表模型
|
||
"""
|
||
|
||
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})>" |