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

34 lines
1.3 KiB
Python

"""育种计划 数据模型"""
from datetime import datetime
from sqlalchemy import Float, ForeignKey, Index, Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import MappedBase, ModelMixin, UserMixin
class PlanModel(ModelMixin, UserMixin, MappedBase):
"""育种计划 主数据表。"""
__tablename__ = "bre_plan"
plan_code: Mapped[str] = mapped_column(String(64), nullable=False, comment="计划编号")
plan_name: Mapped[str] = mapped_column(String(128), nullable=False, comment="计划名称")
objective: Mapped[str | None] = mapped_column(Text, nullable=True, comment="计划目标", default=None)
start_year: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="起始年份", default=None)
end_year: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="结束年份", default=None)
leader: Mapped[str | None] = mapped_column(String(64), nullable=True, comment="负责人", default=None)
remark: Mapped[str | None] = mapped_column(Text, nullable=True, comment="备注", default=None)
# 无 status 列:覆盖基类默认 ix_<表>_status_deleted 索引,
# 仅保留 (created_time, is_deleted) 复合索引用于数据权限过滤。
__table_args__ = (
Index("ix_bre_plan_created_deleted", "created_time", "is_deleted"),
)