就业模块合并
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import *
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, func
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from database import Base
|
||||
|
||||
@@ -7,15 +7,17 @@ from database import Base
|
||||
class Emp(Base):
|
||||
__tablename__ = "wl_emp"
|
||||
|
||||
stu_id = Column(Integer,ForeignKey('wl_student.stu_id'), primary_key=True, autoincrement=True)
|
||||
# 学号做主键,同时做外键指向学生表,长度跟 Student.stu_no 保持一致
|
||||
stu_no = Column(String(20), ForeignKey('wl_student.stu_no'), primary_key=True)
|
||||
emp_open_time = Column(DateTime, default="2026-11-30 18:18:18")
|
||||
offer_time = Column(DateTime, default=func.now())
|
||||
company_name = Column(String(100), nullable=False)
|
||||
salary = Column(Integer, nullable=False, default=15000)
|
||||
|
||||
# Student.emp 用的是 back_populates="student",这个反向属性必须保留,否则 mapper 配置失败
|
||||
student = relationship("Student", back_populates="emp")
|
||||
|
||||
def __repr__(self):
|
||||
pass
|
||||
# 逻辑删除:0 正常 1 已删除
|
||||
is_deleted = Column(Integer, default=0, comment='逻辑删除: 0正常 1删除')
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Emp(stu_no={self.stu_no}, company='{self.company_name}')>"
|
||||
|
||||
Reference in New Issue
Block a user