from sqlalchemy import DATETIME,Column,Integer,String,DATE,ForeignKey,Numeric from datetime import datetime from util.database import Base,engine class Student_Model(Base): __tablename__ = 'wl_student' stu_id = Column(Integer , primary_key=True , autoincrement=True ,comment='学生编号') class_id = Column(Integer ,ForeignKey('wl_class.class_id') ,comment='班级编号' ) stu_name=Column(String(100),comment='学生姓名') age=Column(Integer,comment='年龄') gender=Column(String(50),comment='性别') native_place=Column(String(200),comment='籍贯') birthday=Column(DATE,comment='生日') school=Column(String(100),comment='毕业学校') major=Column(String(50),comment='专业') degree=Column(String(50),comment='学历') admission_date=Column(DATE,comment='入学日期') graduation_date=Column(DATE,comment='毕业日期') progress=Column(Integer,default=0,comment='课程进度:学习中=0,求职中=1,已就业=2') create_date=Column(DATETIME ,default=datetime.now) update_date=Column(DATETIME ,default=datetime.now ,onupdate=datetime.now) delete_status = Column( Integer,default=0,comment='删除状态:0未删除,1已删除') delete_time = Column(DATETIME,comment='删除时间') class ClassManagement(Base): __tablename__ = "wl_class" class_id= Column(Integer, primary_key=True, autoincrement=True,comment='班级编号') class_name = Column(String(100), comment='班级姓名') start_class_date = Column(DATE,comment='开课时间') head_teacher_id= Column(Integer,ForeignKey('wl_teacher.teac_id'),comment='班主任') class_teacher_id = Column(Integer,ForeignKey('wl_teacher.teac_id'),comment='授课教师') Entry_date= Column(DATETIME,default=datetime.now,comment='录入时间') update_date = Column(DATETIME,default=datetime.now,onupdate=datetime.now,comment='更新时间') delete_status = Column(Integer,default=0,comment='删除状态:0未删除,1已删除') delete_time = Column(DATETIME,comment='删除时间') class Teacher_Model(Base): __tablename__ = 'wl_teacher' teac_id=Column(Integer,primary_key=True,autoincrement=True,comment='老师编号') teac_name=Column(String(100),comment='老师姓名') teac_gender=Column(String(100),comment='老师性别') teac_age=Column(Integer,comment='老师年龄') teac_position =Column(String(100),comment='老师职位') create_date=Column(DATETIME,default=datetime.now) update_date=Column(DATETIME,default=datetime.now,onupdate=datetime.now) delete_status = Column(Integer,default=0,comment='删除状态:0未删除,1已删除') delete_time = Column(DATETIME,comment='删除时间') class Employment_info(Base): __tablename__ = 'wl_employment' emp_id = Column(Integer ,primary_key=True ,autoincrement=True ,comment='序号' ) stu_id = Column(Integer ,ForeignKey('wl_student.stu_id') ,nullable=False ,comment='学生编号' ) email = Column(String(50) ,unique=True ,comment='邮箱' ) employment_opening_date = Column(DATE ,comment='就业开放日期' ) offer_issuance_date = Column(DATE ,comment='offer下发日期' ) company_name = Column(String(50) ,comment='就业公司名称' ) company_address = Column(String(100) ,comment='就业公司地址' ) salary = Column(Integer ,comment='薪资' ) create_time = Column(DATETIME ,default=datetime.now ,comment='创建时间' ) update_time = Column(DATETIME ,default=datetime.now ,onupdate=datetime.now ,comment='更新时间' ) delete_status = Column( Integer,default=0,comment='删除状态:0未删除,1已删除') delete_time = Column(DATETIME,default=None,comment='删除时间') class WlScore(Base): __tablename__ = 'wl_score' score_id = Column(Integer ,primary_key=True ,autoincrement=True ,comment='序号' ) stu_id = Column( Integer ,ForeignKey('wl_student.stu_id') ,comment='学生编号') exam_order = Column(Integer , nullable=False , comment="考核序次") score=Column(Numeric(5, 2) , comment="成绩") create_time = Column(DATETIME , nullable=False , default=datetime.now , comment="作成时间") update_time = Column(DATETIME , nullable=False , default=datetime.now , onupdate=datetime.now , comment="更新时间") delete_status = Column( Integer,default=0,comment='删除状态:0未删除,1已删除') delete_time = Column(DATETIME,comment='删除时间') Base.metadata.create_all(engine)