test一轮完成的版本

This commit is contained in:
2026-09-12 20:55:36 +08:00
parent 004fd75a46
commit c4ae803a34
8 changed files with 50 additions and 68 deletions
+9 -9
View File
@@ -14,16 +14,16 @@ class Advisor(Base):
__tablename__ = "advisor"
id = Column(Integer, primary_key=True, autoincrement=True, comment="顾问编号")
name = Column(String(50), nullable=False, index=True, comment="顾问姓名")
gender = Column(String(8), comment="性别")
phone = Column(String(20), index=True, comment="手机号")
email = Column(String(64), comment="邮箱")
region = Column(String(64), comment="负责区域/招生渠道")
adv_id = Column(Integer, primary_key=True, autoincrement=True, comment="顾问编号")
adv_name = Column(String(50), nullable=False, index=True, comment="顾问姓名")
adv_gender = Column(String(8), comment="性别")
adv_phone = Column(String(20), index=True, comment="手机号")
adv_email = Column(String(64), comment="邮箱")
adv_region = Column(String(64), comment="负责区域/招生渠道")
is_deleted = Column(SmallInteger,nullable=False, default=0,server_default="0",
index=True,comment="1=已删除",)
students = relationship("Student",primaryjoin="and_(Advisor.id == Student.advisor_id, Student.is_deleted == 0)",
foreign_keys="Student.advisor_id",viewonly=True,lazy="selectin",)
#下面的内容临时注释,在main导入时,SQLAlchemy 在配置映射时就会报错,错误大概是:ArgumentError: Could not locate any relevant foreign key columns for primary join condition ...
# students = relationship("Student",primaryjoin="and_(Advisor.id == stu_id, Student.is_deleted == 0)",
# foreign_keys="stu_id",viewonly=True,lazy="selectin",)