Files
1/model/wl_advisor_model.py
2026-09-21 20:16:09 +08:00

30 lines
1.1 KiB
Python

from sqlalchemy import ( Column,Date,DateTime,
ForeignKey,
Integer,
SmallInteger,
String,
func,
)
from sqlalchemy.orm import relationship
from database import Base
class Advisor(Base):
__tablename__ = "advisor"
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=已删除",)
#下面的内容临时注释,在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",)