init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""环境因子(气象) 数据模型"""
|
||||
from decimal import Decimal
|
||||
|
||||
from sqlalchemy import ForeignKey, Index, Integer, Numeric, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.base_model import MappedBase, ModelMixin, UserMixin
|
||||
|
||||
|
||||
class EnvironmentConditionModel(ModelMixin, UserMixin, MappedBase):
|
||||
"""环境因子(规格 §3.9;G×E 协变量,site×year 唯一)。"""
|
||||
|
||||
__tablename__ = "bre_environment_condition"
|
||||
|
||||
site_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("bre_site.id"), index=True, nullable=False, comment="试验基地"
|
||||
)
|
||||
|
||||
year: Mapped[int] = mapped_column(Integer, nullable=False, comment="年份")
|
||||
|
||||
chilling_hours: Mapped[Decimal | None] = mapped_column(
|
||||
Numeric(8, 1), nullable=True, comment="需冷量(小时)", default=None
|
||||
)
|
||||
|
||||
growing_degree_days: Mapped[Decimal | None] = mapped_column(
|
||||
Numeric(8, 1), nullable=True, comment="生长度日 GDD", default=None
|
||||
)
|
||||
|
||||
rainfall_mm: Mapped[Decimal | None] = mapped_column(
|
||||
Numeric(8, 1), nullable=True, comment="降水量(mm)", default=None
|
||||
)
|
||||
|
||||
temp_avg: Mapped[Decimal | None] = mapped_column(
|
||||
Numeric(6, 1), nullable=True, comment="年均温度(℃)", default=None
|
||||
)
|
||||
|
||||
soil_moisture: Mapped[Decimal | None] = mapped_column(
|
||||
Numeric(6, 1), nullable=True, comment="土壤湿度", default=None
|
||||
)
|
||||
|
||||
source: Mapped[str | None] = mapped_column(String(32), nullable=True, comment="数据来源", default=None)
|
||||
|
||||
remark: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="备注", default=None)
|
||||
|
||||
__table_args__ = (
|
||||
Index("ix_bre_environment_condition_created_deleted", "created_time", "is_deleted"),
|
||||
Index("uq_env_site_year", "site_id", "year", unique=True),
|
||||
)
|
||||
Reference in New Issue
Block a user