init: 初始化 dpb 桃育种系统代码库

前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
This commit is contained in:
34047007@qq.com
2026-08-06 00:17:49 +08:00
commit b95053c52c
1469 changed files with 322298 additions and 0 deletions
@@ -0,0 +1,67 @@
"""授粉管理 数据模型"""
from datetime import date, datetime
from sqlalchemy import Date, Float, ForeignKey, Index, Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import MappedBase, ModelMixin, UserMixin
class PollinationModel(ModelMixin, UserMixin, MappedBase):
"""授粉管理 主数据表。"""
__tablename__ = "bre_pollination"
combination_id: Mapped[int] = mapped_column(
Integer, ForeignKey("bre_cross_combination.id", ondelete="CASCADE"),
index=True, nullable=False, comment="杂交组合"
)
plot_id: Mapped[int] = mapped_column(
Integer, ForeignKey("bre_plot.id", ondelete="CASCADE"),
index=True, nullable=True, comment="试验地块"
)
pollination_date: Mapped[str | None] = mapped_column(String(20), nullable=True, comment="授粉日期", default=None)
flower_count: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="花朵数", default=None)
effective_count: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="有效坐果数", default=None)
bre_personnel_id: Mapped[int] = mapped_column(
Integer, ForeignKey("bre_personnel.id", ondelete="CASCADE"),
index=True, nullable=True, comment="授粉人"
)
pollinator: Mapped[str | None] = mapped_column(String(100), nullable=True, comment="授粉者(遗留自由文本,已由授粉人外键取代)")
bagging_date: Mapped[date | None] = mapped_column(Date, nullable=True, comment="套袋日期", default=None)
emasculation_date: Mapped[date | None] = mapped_column(Date, nullable=True, comment="去雄日期", default=None)
female_tree_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_tree.id", ondelete="SET NULL"),
index=True, nullable=True, comment="母本树"
)
male_tree_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_tree.id", ondelete="SET NULL"),
index=True, nullable=True, comment="父本树"
)
pollination_method: Mapped[str | None] = mapped_column(
String(32), nullable=True, comment="授粉方式(人工点授/喷粉/涂抹…)", default=None
)
pollen_lot_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_pollen.id", ondelete="SET NULL"),
index=True, nullable=True, comment="花粉批次"
)
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_pollination_created_deleted", "created_time", "is_deleted"),
)