Files
student_management_system/model/employment_model.py
T

43 lines
1.1 KiB
Python
Raw Normal View History

2026-09-21 17:30:02 +08:00
# path: model/employment_model.py
# time:2026年9月12日10:24
# title:就业信息 ORM 模型
# author:周兴
# info:该文件用于定义就业表在数据库里长什么样,把MySQL的employment表映射成Python里面的Employment ORM类
from sqlalchemy import Column, Integer, String, DateTime, Float, ForeignKey
from database import Base
class Employment(Base):
__tablename__ = "employment" # Python 类对应 MySQL 里面的 employment 表。
id = Column(Integer,primary_key=True,autoincrement=True) # 主键
student_id = Column(Integer,ForeignKey('student.sid'),nullable=False,unique=True) # 学生ID,外键关联 student表的id
employment_start_time = Column(DateTime,nullable=True)
# offer下发时间
offer_time = Column(
DateTime,
nullable=True
)
# 公司名称
company_name = Column(
String(100),
nullable=True
)
# 薪资
salary = Column(
Float,
nullable=True
)
# 逻辑删除标记:1表示正常,0表示已删除
flag = Column(
Integer,
default=1,
nullable=False
)