init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""无性系(单株系) 数据模型"""
|
||||
from sqlalchemy import ForeignKey, Index, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.base_model import MappedBase, ModelMixin, UserMixin
|
||||
|
||||
|
||||
class CloneModel(ModelMixin, UserMixin, MappedBase):
|
||||
"""无性系(单株系) 主数据表。"""
|
||||
|
||||
__tablename__ = "bre_clone"
|
||||
|
||||
clone_code: Mapped[str] = mapped_column(String(32), nullable=False, comment="无性系编号")
|
||||
|
||||
combination_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("bre_cross_combination.id", ondelete="CASCADE"),
|
||||
index=True, nullable=False, comment="来源杂交组合"
|
||||
)
|
||||
|
||||
female_parent_id: Mapped[int | None] = mapped_column(
|
||||
Integer, ForeignKey("bre_germplasm.id", ondelete="SET NULL"),
|
||||
index=True, nullable=True, comment="母本(种质)"
|
||||
)
|
||||
|
||||
male_parent_id: Mapped[int | None] = mapped_column(
|
||||
Integer, ForeignKey("bre_germplasm.id", ondelete="SET NULL"),
|
||||
index=True, nullable=True, comment="父本(种质)"
|
||||
)
|
||||
|
||||
planting_year: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="定植年份", default=None)
|
||||
|
||||
generation: Mapped[str | None] = mapped_column(String(16), nullable=True, comment="世代", default=None)
|
||||
|
||||
status: Mapped[str] = mapped_column(String(1), nullable=False, default="1", comment="状态(1:在圃 0:淘汰)")
|
||||
|
||||
remark: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="备注", default=None)
|
||||
|
||||
# 无 status 列:覆盖基类默认 ix_<表>_status_deleted 索引,
|
||||
# 仅保留 (created_time, is_deleted) 复合索引用于数据权限过滤。
|
||||
__table_args__ = (
|
||||
Index("ix_bre_clone_created_deleted", "created_time", "is_deleted"),
|
||||
Index("uq_bre_clone_code", "clone_code", unique=True),
|
||||
)
|
||||
Reference in New Issue
Block a user