Files
dpb/backend/app/api/v1/module_bre/alert/model.py
T
34047007@qq.com b95053c52c init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
2026-08-06 00:17:49 +08:00

29 lines
1.3 KiB
Python
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.
"""超期预警 数据模型(批3:每日扫描 job 落库,open→resolved 生命周期)"""
from sqlalchemy import Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import MappedBase, ModelMixin, UserMixin
class AlertModel(ModelMixin, UserMixin, MappedBase):
"""超期预警。
alert_type 三类:tree_undecided 单株多年未决策 / pollen_expiry 花粉批次过期 /
seed_lot_expiry 种子批超期。生成侧为每日定时 job,直接 db.add(不经 CRUDBase
避免自审计噪声);created_id 记录处理人,job 自动生成时为空。
"""
__tablename__ = "bre_alert"
alert_type: Mapped[str] = mapped_column(
String(32), index=True, nullable=False,
comment="预警类型(tree_undecided/pollen_expiry/seed_lot_expiry)",
)
entity_type: Mapped[str] = mapped_column(String(64), nullable=False, comment="实体类型(业务表名)")
entity_id: Mapped[int] = mapped_column(Integer, index=True, nullable=False, comment="实体ID")
message: Mapped[str | None] = mapped_column(Text, nullable=True, comment="预警内容", default=None)
status: Mapped[str] = mapped_column(
String(16), nullable=False, default="open", comment="状态(open未处理/resolved已处理)"
)