paper.py 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import datetime
  4. from sqlalchemy import Column, Integer, String, DateTime, Float, BOOLEAN, JSON, TEXT
  5. from db import BaseORMModel
  6. class Paper(BaseORMModel):
  7. """作业标准卷
  8. """
  9. __tablename__ = "papers"
  10. id = Column(Integer, primary_key=True, autoincrement=True)
  11. category_id = Column(Integer, nullable=False, comment="资源分类ID")
  12. name = Column(String(255), nullable=False, comment="试卷名称")
  13. pno = Column(String(32), nullable=False, comment="试卷编号")
  14. pages = Column(Integer, default=0, comment="试卷页数")
  15. size = Column(String(16), nullable=False, comment="试卷大小")
  16. imgs = Column(JSON, default=[], comment="原始试卷图片URL列表")
  17. uploaded = Column(BOOLEAN(), default=False, comment="试卷图片是否上传")
  18. points = Column(JSON, default=[], comment="标准定位点")
  19. ans_points = Column(JSON, default=[], comment="答题卡定位点")
  20. std_x_list = Column(JSON, default=[], comment="答题卡x定位点")
  21. std_y_list = Column(JSON, default=[], comment="答题卡y定位点")
  22. attach_url = Column(String(1000), default="", comment="电子附件URL")
  23. attached = Column(BOOLEAN(), default=False, comment="电子附件是否上传")
  24. cut = Column(Integer, default=False, comment="切割状态")
  25. score = Column(Integer, default=0, comment="总分")
  26. question_amount = Column(Integer, default=0, comment="试题数量")
  27. objective_question_amount = Column(Integer, default=0, comment="客观题数量")
  28. subjective_question_amount = Column(Integer, default=0, comment="主观题数量")
  29. creator_id = Column(Integer, nullable=False, comment="创建人ID")
  30. creator_name = Column(String(32), nullable=False, comment="创建人名称")
  31. created_at = Column(DateTime, default=datetime.datetime.now)
  32. editor_id = Column(Integer, nullable=False, comment="最后编辑人ID")
  33. editor_name = Column(String(32), nullable=False, comment="最后编辑人名称")
  34. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  35. ptype = Column(String(4), nullable=False,default="work",comment="任务类型,work/exam")
  36. subject = Column(String(50), nullable=False,default="",comment="科目")
  37. ans_url = Column(String(1000), default="", comment="答题卡")
  38. studentno_points = Column(JSON, default=[], comment="考生信息定位点")
  39. class PaperQuestion(BaseORMModel):
  40. """作业标准卷试题
  41. """
  42. __tablename__ = "paper_questions"
  43. id = Column(Integer, primary_key=True, autoincrement=True)
  44. pid = Column(Integer, nullable=False, comment="试卷ID")
  45. page = Column(Integer, default=0, comment="试卷第几页")
  46. pno = Column(String(32), nullable=False, comment="试卷编号")
  47. qno = Column(String(32), nullable=False, comment="题号")
  48. sqno = Column(String(32), default="", comment="子题号")
  49. qtype = Column(String(6), default="", comment="单选题/多选题/判断题/主观题")
  50. imgtype = Column(Integer, default=0, comment="图片类型")
  51. points = Column(JSON, default=[], comment="试题标准坐标点")
  52. std_points = Column(JSON, default=[], comment="选择题标准坐标点")
  53. imgs = Column(JSON, default=[], comment="试题图片URL列表")
  54. full_img = Column(String(1000), default="", comment="完整图片URL")
  55. stuff_points = Column(JSON, default=[], comment="材料标准坐标点")
  56. stuff_imgs = Column(JSON, default=[], comment="材料图片URL列表")
  57. full_stuff_img = Column(String(1000), default="", comment="完整材料图片URL")
  58. answer = Column(String(200), default="", comment="标准答案")
  59. analysis = Column(TEXT, default="", comment="答案解析")
  60. level = Column(String(50), default="", comment="难度,简单/中等/困难")
  61. lpoints = Column(String(1000), default="", comment="知识点")
  62. score = Column(Float, default=0, comment="试题分数")
  63. stem = Column(TEXT, default="", comment="试题题干")
  64. creator_id = Column(Integer, nullable=False, comment="创建人ID")
  65. creator_name = Column(String(32), nullable=False, comment="创建人名称")
  66. created_at = Column(DateTime, default=datetime.datetime.now)
  67. editor_id = Column(Integer, nullable=False, comment="最后编辑人ID")
  68. editor_name = Column(String(32), nullable=False, comment="最后编辑人名称")
  69. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  70. usage = Column(Integer, default=1, comment="用途1/切割使用,0/切割展示用")