2026-09-14 12:12:29 +08:00
|
|
|
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
|
2026-09-13 22:46:47 +08:00
|
|
|
from sqlalchemy.orm import relationship
|
2026-09-12 16:30:43 +08:00
|
|
|
|
2026-09-13 22:06:43 +08:00
|
|
|
from database import Base
|
|
|
|
|
|
2026-09-12 16:30:43 +08:00
|
|
|
|
2026-09-12 20:55:36 +08:00
|
|
|
class Emp(Base):
|
2026-09-12 16:30:43 +08:00
|
|
|
__tablename__ = "wl_emp"
|
|
|
|
|
|
2026-09-13 22:46:47 +08:00
|
|
|
# 学号做主键,同时做外键指向学生表,长度跟 Student.stu_no 保持一致
|
|
|
|
|
stu_no = Column(String(20), ForeignKey('wl_student.stu_no'), primary_key=True)
|
2026-09-14 12:12:29 +08:00
|
|
|
emp_open_time = Column(DateTime)
|
|
|
|
|
offer_time = Column(DateTime)
|
2026-09-12 16:30:43 +08:00
|
|
|
company_name = Column(String(100), nullable=False)
|
|
|
|
|
salary = Column(Integer, nullable=False, default=15000)
|
|
|
|
|
|
2026-09-13 22:06:43 +08:00
|
|
|
student = relationship("Student", back_populates="emp")
|
2026-09-12 16:30:43 +08:00
|
|
|
|
2026-09-13 22:46:47 +08:00
|
|
|
# 逻辑删除:0 正常 1 已删除
|
|
|
|
|
is_deleted = Column(Integer, default=0, comment='逻辑删除: 0正常 1删除')
|
2026-09-12 16:30:43 +08:00
|
|
|
|
2026-09-13 22:46:47 +08:00
|
|
|
def __repr__(self):
|
|
|
|
|
return f"<Emp(stu_no={self.stu_no}, company='{self.company_name}')>"
|
2026-09-14 12:12:29 +08:00
|
|
|
|