# coding: utf-8 from sqlalchemy import CheckConstraint, Column, Date, DateTime, Float, ForeignKey, Index, String, TIMESTAMP, Text, text from sqlalchemy.dialects.mysql import BIGINT, INTEGER, MEDIUMTEXT from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class HatArticle(Base): __tablename__ = 'hat_article' __table_args__ = {'comment': '文章'} id = Column(BIGINT(20), primary_key=True, comment='ID') title = Column(String(300), comment='标题') content = Column(MEDIUMTEXT, comment='内容') cover_image = Column(String(300), nullable=False, server_default=text("''"), comment='封面图片路径') overview = Column(String(300), nullable=False, server_default=text("''"), comment='概述') type = Column(String(50), nullable=False, server_default=text("'采编'"), comment='类型:原创、转载、首发、采编') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') class HatArticleCategory(Base): __tablename__ = 'hat_article_category' __table_args__ = {'comment': '文章类别表'} id = Column(BIGINT(20), primary_key=True, comment='ID') category_name = Column(String(64), nullable=False, unique=True, server_default=text("''"), comment='类别名称') parent_id = Column(BIGINT(20), nullable=False, server_default=text("0"), comment='父类别ID(默认为0)') description = Column(String(500), nullable=False, server_default=text("''"), comment='类别描述') sort_order = Column(INTEGER(11), nullable=False, server_default=text("1"), comment='排序值') status = Column(INTEGER(11), nullable=False, index=True, server_default=text("0"), comment='状态(默认0,锁定1)') created_at = Column(TIMESTAMP, nullable=False, server_default=text("current_timestamp()")) created_by = Column(String(64), nullable=False, server_default=text("'API'")) updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()")) updated_by = Column(String(64), nullable=False, server_default=text("'API'")) class HatClass(Base): __tablename__ = 'hat_classes' __table_args__ = {'comment': '班级表'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') name = Column(String(100), nullable=False, comment='班级名称') year = Column(String(100), nullable=False, comment='班级年份') adviser = Column(String(255), nullable=False, comment='辅导员') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') class HatClassroom(Base): __tablename__ = 'hat_classroom' __table_args__ = {'comment': '教室'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') name = Column(String(50), nullable=False, comment='教室名称') total = Column(INTEGER(10), nullable=False, server_default=text("60"), comment='容纳人数') description = Column(String(500), comment='描述') class HatCourse(Base): __tablename__ = 'hat_course' __table_args__ = {'comment': '课程表,在专业教学计划表,学分对接表中关联'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') name = Column(String(255), nullable=False, unique=True, comment='课程名称') name_en = Column(String(255), comment='英文名称') code = Column(String(50), nullable=False, comment='课程代码') material = Column(String(1000), comment='所选教材') description = Column(Text, comment='课程描述') category = Column(String(50), nullable=False, comment='授课方(中方课程或外方课程)') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') class HatCourseSchedule(Base): __tablename__ = 'hat_course_schedule' __table_args__ = {'comment': '课表'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') academic_year = Column(String(32), nullable=False, comment='学年') semester = Column(String(64), nullable=False, comment='上课学期') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') class HatEnrollStudent(Base): __tablename__ = 'hat_enroll_student' __table_args__ = ( Index('hat_enroll_student_id_card_number_phone_un', 'id_card_number', 'phone', unique=True), {'comment': '学生报名信息表'} ) id = Column(BIGINT(20), primary_key=True, comment='ID') student_number = Column(String(50), nullable=False, index=True, comment='学号') name = Column(String(128), nullable=False, index=True, comment='姓名') gender = Column(String(10), nullable=False, comment='性别') native_place = Column(String(50), comment='籍贯') id_card_number = Column(String(50), nullable=False, comment='身份证') province = Column(String(128), nullable=False, index=True, comment='省') city = Column(String(128), comment='市') date_of_birth = Column(Date, comment='出生年月') politics_status = Column(String(50), comment='政治面貌') nation = Column(String(128), comment='民族') house_address = Column(String(255), nullable=False, comment='家庭地址') post_code = Column(String(10), nullable=False, comment='邮政编码') phone = Column(String(50), nullable=False, comment='学生手机') educational_level = Column(String(128), comment='文化程度') school_of_graduation = Column(String(128), index=True, comment='毕业学校') graduate_date = Column(Date, comment='毕业日期') awards = Column(String(128), comment='奖励') hobby = Column(String(128), comment='爱好特长') cee_id = Column(String(50), comment='准考证号') cee_scores = Column(String(50), comment='高考总分') cee_english = Column(String(50), comment='英语成绩') cee_chinese = Column(String(50), comment='语文成绩') cee_math = Column(String(50), comment='数学成绩') cee_type = Column(String(50), comment='高考科类') ielts = Column(String(50), comment='雅思成绩') no_cee_reasons = Column(String(128), comment='不参加高考原因') major = Column(String(128), comment='首选专业') major2 = Column(String(128), comment='次选专业') major3 = Column(String(128), comment='再选专业') accommodation = Column(String(10), comment='是否住宿') allocate = Column(String(50), comment='服从调配') abroad = Column(String(50), comment='出国留学') parent_name1 = Column(String(128), nullable=False, comment='家长姓名') parent_phone1 = Column(String(50), nullable=False, comment='电话') relation1 = Column(String(10), comment='关系') parent_name2 = Column(String(128), comment='家长姓名') parent_phone2 = Column(String(50), comment='电话') relation2 = Column(String(10), comment='关系') information_source = Column(String(128), comment='信息来源') referrer = Column(String(128), comment='推荐人') admission_major = Column(String(128), comment='录取专业') admission_at = Column(DateTime, comment='录取时间') intensive_training = Column(String(50), comment='强化训练') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') remark = Column(String(255), comment='备注') created_at = Column(DateTime, nullable=False, comment='创建时间') class HatMajor(Base): __tablename__ = 'hat_major' __table_args__ = {'comment': '专业'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') name = Column(String(255), nullable=False, unique=True, comment='专业名称') name_en = Column(String(255), comment='英文名称') code = Column(String(255), nullable=False, comment='专业代码') description = Column(Text, comment='介绍') discipline = Column(String(255), nullable=False, comment='学科门类') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') class HatPerson(Base): __tablename__ = 'hat_person' __table_args__ = ( Index('hat_person_name_cer_idx', 'name', 'cer_no', 'cer_type_name'), {'comment': '企业人员'} ) id = Column(BIGINT(20), primary_key=True, comment='ID') name = Column(String(100), nullable=False, server_default=text("''"), comment='姓名') sex = Column(String(1), nullable=False, server_default=text("''"), comment='性别') cer_type_name = Column(String(100), nullable=False, server_default=text("''"), comment='身份证件类型') cer_no = Column(String(40), nullable=False, server_default=text("''"), comment='证件号') tel = Column(String(110), nullable=False, server_default=text("''"), comment='联系电话') school = Column(String(200), nullable=False, server_default=text("''"), comment='毕业院校') edu_bac = Column(String(20), nullable=False, server_default=text("''"), comment='文化程度') major = Column(String(30), nullable=False, server_default=text("''"), comment='所学专业') lite_deg = Column(String(2), nullable=False, server_default=text("''"), comment='文化程度') edu_bac_code = Column(String(30), nullable=False, server_default=text("''"), comment='学历') title = Column(String(40), nullable=False, server_default=text("''"), comment='职称') com_addr = Column(String(512), nullable=False, server_default=text("''"), comment='通信地址') postal_code = Column(String(6), nullable=False, server_default=text("''"), comment='邮编编码') email = Column(String(100), nullable=False, server_default=text("''"), comment='电子邮箱') status = Column(String(64), nullable=False, server_default=text("''"), comment='状态') avatar = Column(String(300), server_default=text("''"), comment='头像') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') class HatStudent(Base): __tablename__ = 'hat_student' __table_args__ = {'comment': '学生信息表'} id = Column(BIGINT(20), primary_key=True, comment='ID') student_number = Column(String(50), nullable=False, comment='学号') name = Column(String(128), nullable=False, comment='姓名') gender = Column(String(10), nullable=False, comment='性别') native_place = Column(String(50), comment='籍贯') id_card_number = Column(String(50), nullable=False, comment='身份证') province = Column(String(128), nullable=False, comment='省') city = Column(String(128), comment='市') date_of_birth = Column(Date, comment='出生年月') politics_status = Column(String(50), comment='政治面貌') nation = Column(String(128), comment='民族') house_address = Column(String(255), nullable=False, comment='家庭地址') post_code = Column(String(10), nullable=False, comment='邮政编码') phone = Column(String(50), nullable=False, comment='学生手机') educational_level = Column(String(128), comment='文化程度') school_of_graduation = Column(String(128), comment='毕业学校') graduate_time = Column(Date, comment='毕业时间') awards = Column(String(128), comment='奖励') hobby = Column(String(128), comment='爱好特长') cee_id = Column(String(50), comment='准考证号') cee_scores = Column(String(50), comment='高考总分') cee_english = Column(String(50), comment='英语成绩') cee_chinese = Column(String(50), comment='语文成绩') cee_math = Column(String(50), comment='数学成绩') cee_type = Column(String(50), comment='高考科类') ielts = Column(String(50), comment='雅思成绩') major = Column(String(128), comment='专业') allocate = Column(String(50), comment='服从调配') abroad = Column(String(50), comment='出国留学') parent_name1 = Column(String(128), nullable=False, comment='家长姓名') parent_phone1 = Column(String(50), nullable=False, comment='电话') relation1 = Column(String(10), comment='关系') parent_name2 = Column(String(128), comment='家长姓名') parent_phone2 = Column(String(50), comment='电话') relation2 = Column(String(10), comment='关系') intensive_training = Column(String(50), comment='强化训练') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, comment='创建时间') class HatUser(Base): __tablename__ = 'hat_user' __table_args__ = {'comment': '用户'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') username = Column(String(255), nullable=False, unique=True, comment='用户名') password_hash = Column(String(255), nullable=False, comment='密码') password_reset_token = Column(String(255), comment='重置标记') auth_key = Column(String(255), comment='授权码') status = Column(INTEGER(11), nullable=False, server_default=text("0"), comment='用户状态') type = Column(String(64), nullable=False, server_default=text("'user'"), comment='用户类型') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='更新时间') class HatArticlePublish(Base): __tablename__ = 'hat_article_publish' __table_args__ = ( Index('hat_article_publish_un', 'article_id', 'category_id', unique=True), {'comment': '文章发布表'} ) id = Column(BIGINT(20), primary_key=True, comment='ID') article_id = Column(ForeignKey('hat_article.id', ondelete='CASCADE'), nullable=False, comment='文章ID') category_id = Column(ForeignKey('hat_article_category.id', ondelete='CASCADE'), nullable=False, index=True, comment='文章类别ID') sort_order = Column(INTEGER(11), nullable=False, index=True, server_default=text("0"), comment='排序') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') article = relationship('HatArticle') category = relationship('HatArticleCategory') class HatClassesStudent(Base): __tablename__ = 'hat_classes_student' __table_args__ = ( Index('classes_id_student_id_un', 'class_id', 'student_id', unique=True), {'comment': '班级学生关系表'} ) id = Column(BIGINT(20), primary_key=True, comment='系统编号') class_id = Column(ForeignKey('hat_classes.id', ondelete='CASCADE'), nullable=False, comment='班级编号') student_id = Column(ForeignKey('hat_student.id', ondelete='CASCADE'), nullable=False, index=True, comment='学生编号') created_at = Column(DateTime, nullable=False, comment='创建时间') updated_at = Column(DateTime, nullable=False, comment='更新时间') _class = relationship('HatClass') student = relationship('HatStudent') class HatCourseScheduleDetail(Base): __tablename__ = 'hat_course_schedule_detail' __table_args__ = {'comment': '课表明细'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') schedule_id = Column(ForeignKey('hat_course_schedule.id', ondelete='CASCADE'), nullable=False, index=True, comment='课表') course_id = Column(ForeignKey('hat_course.id'), nullable=False, index=True, comment='课程') classroom_id = Column(ForeignKey('hat_classroom.id'), nullable=False, index=True, comment='教室') teacher = Column(String(255), nullable=False, comment='任课老师') week_day = Column(INTEGER(20), nullable=False, comment='上课日期,0~1为周日~周六') sequence = Column(INTEGER(20), nullable=False, comment='序号,从1开始,代表是一天中的第几节课') classroom = relationship('HatClassroom') course = relationship('HatCourse') schedule = relationship('HatCourseSchedule') class HatExamPaper(Base): __tablename__ = 'hat_exam_paper' __table_args__ = {'comment': '考卷'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') name = Column(String(255), nullable=False, comment='考卷名称') course_id = Column(ForeignKey('hat_course.id'), nullable=False, index=True, comment='考试课程') score = Column(Float(asdecimal=True), server_default=text("0"), comment='分值') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') course = relationship('HatCourse') class HatExamination(Base): __tablename__ = 'hat_examination' __table_args__ = {'comment': '考务表'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') course_id = Column(ForeignKey('hat_course.id'), nullable=False, index=True, comment='考试课程') academic_year = Column(String(200), nullable=False, comment='学年') semester = Column(String(200), nullable=False, comment='学期') exam_time = Column(DateTime, nullable=False, comment='考试时间') classroom_id = Column(ForeignKey('hat_classroom.id'), index=True, comment='考场教室') exam_paper_id = Column(BIGINT(20), comment='考卷') exam_format = Column(String(50), nullable=False, comment='考试形式,线下、线上') exam_method = Column(String(50), nullable=False, comment='考试方式,开卷、闭卷') exam_type = Column(String(50), nullable=False, comment='考试性质,入学、期中、期末、补考、重修') time_length = Column(INTEGER(20), server_default=text("60"), comment='考试时长') chief_examiner = Column(String(50), nullable=False, comment='主考老师') invigilator = Column(String(50), comment='监考老师') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') classroom = relationship('HatClassroom') course = relationship('HatCourse') class HatQuestionMaterial(Base): __tablename__ = 'hat_question_material' __table_args__ = {'comment': '考题素材(考题用到的素材,目前仅支持文字素材,可增加附件用于增加其他素材,如图片、声音等)'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') title = Column(String(255), nullable=False, comment='标题') content = Column(Text, nullable=False, comment='文章内容') course_id = Column(ForeignKey('hat_course.id'), nullable=False, index=True, comment='课程') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') course = relationship('HatCourse') class HatStudentPortrait(Base): __tablename__ = 'hat_student_portrait' __table_args__ = {'comment': '学生头像'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') student_id = Column(ForeignKey('hat_student.id', ondelete='CASCADE'), nullable=False, unique=True, comment='考生') portrait = Column(String(500), nullable=False, comment='头像') created_at = Column(DateTime, nullable=False, comment='创建时间') updated_at = Column(DateTime, nullable=False, comment='更新时间') student = relationship('HatStudent') class HatStudentUnusual(Base): __tablename__ = 'hat_student_unusual' __table_args__ = {'comment': '学生异动'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') student_id = Column(ForeignKey('hat_student.id'), nullable=False, index=True, comment='考生') type = Column(String(100), nullable=False, comment='异动类型') memo = Column(String(1024), comment='备注') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') student = relationship('HatStudent') class HatUserPerson(Base): __tablename__ = 'hat_user_person' __table_args__ = {'comment': '用户人员'} id = Column(BIGINT(20), primary_key=True, comment='ID') user_id = Column(ForeignKey('hat_user.id'), nullable=False, unique=True, comment='用户ID') person_id = Column(ForeignKey('hat_person.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False, index=True, comment='人员ID') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='更新时间') person = relationship('HatPerson') user = relationship('HatUser') class HatEnrollStudentExam(Base): __tablename__ = 'hat_enroll_student_exam' __table_args__ = ( Index('hat_enroll_student_exam_un', 'examination_id', 'student_id', unique=True), {'comment': '参加入学考试的学生'} ) id = Column(BIGINT(20), primary_key=True, comment='系统编号') examination_id = Column(ForeignKey('hat_examination.id'), nullable=False, comment='考务编号') student_id = Column(ForeignKey('hat_enroll_student.id'), nullable=False, index=True, comment='考生') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') examination = relationship('HatExamination') student = relationship('HatEnrollStudent') class HatEnrollStudentScore(Base): __tablename__ = 'hat_enroll_student_score' __table_args__ = ( CheckConstraint('json_valid(`answer`)'), CheckConstraint('json_valid(`question_score`)'), Index('hat_enroll_student_score_un', 'examination_id', 'student_id', unique=True), {'comment': '入学考试成绩'} ) id = Column(BIGINT(20), primary_key=True, comment='系统编号') examination_id = Column(ForeignKey('hat_examination.id'), nullable=False, comment='考务安排') student_id = Column(ForeignKey('hat_enroll_student.id'), nullable=False, index=True, comment='考生') started_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='考试开始时间') submit_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='交卷时间') submit_method = Column(String(16), nullable=False, server_default=text("'N'"), comment='交卷方式') answer = Column(Text, nullable=False, comment='答案(JSON数据)') question_score = Column(Text, comment='各题得分') test_score = Column(String(100), nullable=False, comment='考试成绩') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='更新时间') examination = relationship('HatExamination') student = relationship('HatEnrollStudent') class HatQuestion(Base): __tablename__ = 'hat_question' __table_args__ = {'comment': '考题(可关联到素材表,对关联到同一素材的所有考题,按照时间先后排序)'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') question = Column(String(1800), nullable=False, comment='提问') options = Column(String(1800), comment='选项(json)') answer = Column(String(1800), nullable=False, comment='答案(json)') category = Column(String(50), nullable=False, comment='题型(判断题、单项选择题、多项选择题、不定项选择题、填空题、完形填空、阅读理解、简答题、论述题、作文)') course_id = Column(ForeignKey('hat_course.id'), nullable=False, index=True, comment='课程') material_id = Column(ForeignKey('hat_question_material.id'), index=True, comment='素材') score = Column(Float(asdecimal=True), server_default=text("0"), comment='分值') difficulty = Column(Float(asdecimal=True), server_default=text("1"), comment='难度系数') status = Column(INTEGER(20), nullable=False, server_default=text("10"), comment='当前状态') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') course = relationship('HatCourse') material = relationship('HatQuestionMaterial') class HatStudentAttendance(Base): __tablename__ = 'hat_student_attendance' __table_args__ = {'comment': '学生考勤'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') student_id = Column(ForeignKey('hat_student.id'), nullable=False, index=True, comment='考生') schedule_detail_id = Column(ForeignKey('hat_course_schedule_detail.id'), nullable=False, index=True, comment='课表明细编号') sequence = Column(INTEGER(20), nullable=False, comment='序号') time_at = Column(DateTime, nullable=False, comment='考勤时间') type = Column(String(100), nullable=False, comment='考勤类型') memo = Column(String(1024), comment='备注') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') schedule_detail = relationship('HatCourseScheduleDetail') student = relationship('HatStudent') class HatStudentExam(Base): __tablename__ = 'hat_student_exam' __table_args__ = ( Index('hat_student_exam_un', 'examination_id', 'student_id', unique=True), {'comment': '参加考试的学生'} ) id = Column(BIGINT(20), primary_key=True, comment='系统编号') examination_id = Column(ForeignKey('hat_examination.id', ondelete='CASCADE'), nullable=False, comment='考务编号') student_id = Column(ForeignKey('hat_student.id', ondelete='CASCADE'), nullable=False, index=True, comment='考生') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') created_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='创建者') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='修改时间') updated_by = Column(String(64), nullable=False, server_default=text("'API'"), comment='修改者') examination = relationship('HatExamination') student = relationship('HatStudent') class HatStudentScore(Base): __tablename__ = 'hat_student_score' __table_args__ = ( CheckConstraint('json_valid(`answer`)'), CheckConstraint('json_valid(`question_score`)'), Index('hat_student_score_un', 'examination_id', 'student_id', unique=True), {'comment': '考试成绩'} ) id = Column(BIGINT(20), primary_key=True, comment='系统编号') examination_id = Column(ForeignKey('hat_examination.id'), nullable=False, comment='考务安排') student_id = Column(ForeignKey('hat_student.id'), nullable=False, index=True, comment='考生') started_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='考试开始时间') submit_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='交卷时间') submit_method = Column(String(16), nullable=False, server_default=text("'N'"), comment='交卷方式') answer = Column(Text, nullable=False, comment='答案(JSON数据)') question_score = Column(Text, comment='各题得分') test_score = Column(String(100), nullable=False, comment='考试成绩') created_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='创建时间') updated_at = Column(DateTime, nullable=False, server_default=text("current_timestamp()"), comment='更新时间') examination = relationship('HatExamination') student = relationship('HatStudent') class HatStudentUnusualAttachment(Base): __tablename__ = 'hat_student_unusual_attachment' __table_args__ = {'comment': '学生异动附件'} id = Column(BIGINT(20), primary_key=True, comment='系统编号') unusual_id = Column(ForeignKey('hat_student_unusual.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False, index=True, comment='异动编号') name = Column(String(255), nullable=False, comment='附件名称') created_at = Column(DateTime, nullable=False, comment='创建时间') updated_at = Column(DateTime, nullable=False, comment='更新时间') unusual = relationship('HatStudentUnusual') class HatExamPaperQuestion(Base): __tablename__ = 'hat_exam_paper_question' __table_args__ = ( Index('hat_exam_paper_question_un', 'exam_paper_id', 'question_id', unique=True), {'comment': '考卷考题'} ) id = Column(BIGINT(20), primary_key=True, comment='系统编号') exam_paper_id = Column(ForeignKey('hat_exam_paper.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False, comment='考卷') question_id = Column(ForeignKey('hat_question.id'), nullable=False, index=True, comment='考题') sort = Column(INTEGER(20), nullable=False, server_default=text("0"), comment='排序') exam_paper = relationship('HatExamPaper') question = relationship('HatQuestion')