42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from fastapi import FastAPI
|
|
from sqlalchemy import DateTime,Date,create_engine,Column,Integer,ForeignKey,Boolean
|
|
from sqlalchemy.orm import declarative_base
|
|
from pydantic import BaseModel
|
|
|
|
|
|
db_url = "mysql+pymysql://root:123456@127.0.0.1:3306/ai0824?charset=utf8mb4"
|
|
engine = create_engine(db_url)
|
|
|
|
Base = declarative_base()
|
|
|
|
class ClassManagement(Base):
|
|
__tablename__ = "wl_class"
|
|
|
|
class_id= Column(Integer, primary_key=True, autoincrement=True,comment='班级编号')
|
|
|
|
start_class_date = Column(Date,comment='开课时间')
|
|
|
|
head_teacher_id= Column(Integer,ForeignKey('wl_teacher.id'),comment='班主任')
|
|
|
|
class_teacher_id = Column(Integer,ForeignKey('wl_teacher.id'),comment='授课教师')
|
|
|
|
Entry_date= Column(DateTime,comment='录入时间')
|
|
|
|
update_date = Column(DateTime,comment='更新时间')
|
|
|
|
delete_status = Column(
|
|
Boolean,
|
|
nullable=False,
|
|
default=False,
|
|
server_default='0',
|
|
comment='删除状态:0未删除,1已删除'
|
|
)
|
|
delete_time = Column(DateTime, nullable=True, comment='删除时间')
|
|
|
|
app=FastAPI(title='学生管理系统班级管理')
|
|
|
|
class ClassRequest(BaseModel):
|
|
class_id: int | None = None
|
|
|
|
|