#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime from sqlalchemy import Column, Integer, String, DateTime, Float, BOOLEAN, JSON, TEXT from db import BaseORMModel class Paper(BaseORMModel): """作业标准卷 """ __tablename__ = "papers" id = Column(Integer, primary_key=True, autoincrement=True) category_id = Column(Integer, nullable=False, comment="资源分类ID") name = Column(String(255), nullable=False, comment="试卷名称") pno = Column(String(32), nullable=False, comment="试卷编号") pages = Column(Integer, default=0, comment="试卷页数") size = Column(String(16), nullable=False, comment="试卷大小") imgs = Column(JSON, default=[], comment="原始试卷图片URL列表") uploaded = Column(BOOLEAN(), default=False, comment="试卷图片是否上传") points = Column(JSON, default=[], comment="标准定位点") ans_points = Column(JSON, default=[], comment="答题卡定位点") std_x_list = Column(JSON, default=[], comment="答题卡x定位点") std_y_list = Column(JSON, default=[], comment="答题卡y定位点") attach_url = Column(String(1000), default="", comment="电子附件URL") attached = Column(BOOLEAN(), default=False, comment="电子附件是否上传") cut = Column(Integer, default=False, comment="切割状态") score = Column(Integer, default=0, comment="总分") question_amount = Column(Integer, default=0, comment="试题数量") objective_question_amount = Column(Integer, default=0, comment="客观题数量") subjective_question_amount = Column(Integer, default=0, comment="主观题数量") creator_id = Column(Integer, nullable=False, comment="创建人ID") creator_name = Column(String(32), nullable=False, comment="创建人名称") created_at = Column(DateTime, default=datetime.datetime.now) editor_id = Column(Integer, nullable=False, comment="最后编辑人ID") editor_name = Column(String(32), nullable=False, comment="最后编辑人名称") updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now) ptype = Column(String(4), nullable=False,default="work",comment="任务类型,work/exam") subject = Column(String(50), nullable=False,default="",comment="科目") ans_url = Column(String(1000), default="", comment="答题卡") studentno_points = Column(JSON, default=[], comment="考生信息定位点") class PaperQuestion(BaseORMModel): """作业标准卷试题 """ __tablename__ = "paper_questions" id = Column(Integer, primary_key=True, autoincrement=True) pid = Column(Integer, nullable=False, comment="试卷ID") page = Column(Integer, default=0, comment="试卷第几页") pno = Column(String(32), nullable=False, comment="试卷编号") qno = Column(String(32), nullable=False, comment="题号") sqno = Column(String(32), default="", comment="子题号") qtype = Column(String(6), default="", comment="单选题/多选题/判断题/主观题") imgtype = Column(Integer, default=0, comment="图片类型") points = Column(JSON, default=[], comment="试题标准坐标点") std_points = Column(JSON, default=[], comment="选择题标准坐标点") imgs = Column(JSON, default=[], comment="试题图片URL列表") full_img = Column(String(1000), default="", comment="完整图片URL") stuff_points = Column(JSON, default=[], comment="材料标准坐标点") stuff_imgs = Column(JSON, default=[], comment="材料图片URL列表") full_stuff_img = Column(String(1000), default="", comment="完整材料图片URL") answer = Column(String(200), default="", comment="标准答案") analysis = Column(TEXT, default="", comment="答案解析") level = Column(String(50), default="", comment="难度,简单/中等/困难") lpoints = Column(String(1000), default="", comment="知识点") score = Column(Float, default=0, comment="试题分数") stem = Column(TEXT, default="", comment="试题题干") creator_id = Column(Integer, nullable=False, comment="创建人ID") creator_name = Column(String(32), nullable=False, comment="创建人名称") created_at = Column(DateTime, default=datetime.datetime.now) editor_id = Column(Integer, nullable=False, comment="最后编辑人ID") editor_name = Column(String(32), nullable=False, comment="最后编辑人名称") updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now) usage = Column(Integer, default=1, comment="用途1/切割使用,0/切割展示用")