total.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. from sqlalchemy import Column, Integer, String, Text, BigInteger, SmallInteger
  2. from database import Base
  3. class User(Base):
  4. """用户表"""
  5. __tablename__ = "user"
  6. id = Column(Integer, primary_key=True, autoincrement=True)
  7. username = Column(String(50), unique=True, nullable=False, comment="用户名")
  8. password = Column(String(255), nullable=False, comment="密码")
  9. email = Column(String(100), unique=True, comment="邮箱")
  10. phone = Column(String(20), comment="手机号")
  11. nickname = Column(String(50), comment="昵称")
  12. avatar = Column(String(255), comment="头像URL")
  13. status = Column(SmallInteger, default=1, comment="状态 1:正常 0:禁用")
  14. role = Column(String(20), default='user', comment="角色")
  15. points = Column(Integer, default=0, comment="积分余额")
  16. created_at = Column(BigInteger, comment="创建时间")
  17. updated_at = Column(BigInteger, comment="更新时间")
  18. deleted_at = Column(BigInteger, comment="删除时间")
  19. is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")
  20. class RecommendQuestion(Base):
  21. """推荐问题表"""
  22. __tablename__ = "recommend_question"
  23. id = Column(Integer, primary_key=True, autoincrement=True)
  24. question = Column(String(255), nullable=False, comment="问题")
  25. created_at = Column(BigInteger, comment="创建时间")
  26. updated_at = Column(BigInteger, comment="更新时间")
  27. deleted_at = Column(BigInteger, comment="删除时间")
  28. is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")
  29. class FeedbackQuestion(Base):
  30. """反馈问题表"""
  31. __tablename__ = "feedback_question"
  32. id = Column(Integer, primary_key=True, autoincrement=True)
  33. feedback_type = Column(SmallInteger, nullable=False, comment="反馈类型(1、问题反馈,2、界面优化,3、体验问题,4、其他)")
  34. feedback_content = Column(String(255), nullable=False, comment="反馈内容")
  35. feedback_user_phone = Column(String(255), nullable=False, comment="反馈用户手机号")
  36. feedback_img = Column(String(255), default="", comment="反馈图片")
  37. user_id = Column(Integer, nullable=False, comment="用户ID")
  38. created_at = Column(BigInteger, comment="创建时间")
  39. updated_at = Column(BigInteger, comment="更新时间")
  40. deleted_at = Column(BigInteger, comment="删除时间")
  41. is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")
  42. class PolicyFile(Base):
  43. """政策文件表"""
  44. __tablename__ = "policy_file"
  45. id = Column(Integer, primary_key=True, autoincrement=True)
  46. policy_name = Column(String(255), nullable=False, comment="政策名称")
  47. policy_content = Column(String(255), default="", comment="政策内容")
  48. policy_type = Column(SmallInteger, nullable=False, comment="政策类型(0、全部,1、国家法规,2、行业法规,3、地方法规,4、内部条例)")
  49. policy_file_url = Column(String(255), nullable=False, comment="政策文件URL")
  50. policy_department = Column(String(255), default="", comment="政策部门")
  51. view_count = Column(Integer, default=0, comment="查看次数")
  52. file_type = Column(SmallInteger, default=0, comment="文件类型(0、pdf,1、word,2、excel,3、ppt,4、txt,5、其他)")
  53. file_tag = Column(String(255), default="", comment="文件标签")
  54. publish_time = Column(BigInteger, default=0, comment="颁布时间")
  55. created_at = Column(BigInteger, comment="创建时间")
  56. updated_at = Column(BigInteger, comment="更新时间")
  57. deleted_at = Column(BigInteger, comment="删除时间")
  58. is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")
  59. class FunctionCard(Base):
  60. """AI问答和安全培训功能卡片表"""
  61. __tablename__ = "function_card"
  62. id = Column(Integer, primary_key=True, autoincrement=True)
  63. function_title = Column(String(255), nullable=False, comment="功能标题")
  64. function_type = Column(SmallInteger, nullable=False, comment="功能类型(0、AI问答,1、安全培训)")
  65. function_content = Column(String(255), nullable=False, comment="功能内容")
  66. function_icon = Column(String(255), default="", comment="图标")
  67. created_at = Column(BigInteger, comment="创建时间")
  68. updated_at = Column(BigInteger, comment="更新时间")
  69. deleted_at = Column(BigInteger, comment="删除时间")
  70. is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")
  71. class HotQuestion(Base):
  72. """AI问答和安全培训底部热点问题表"""
  73. __tablename__ = "hot_question"
  74. id = Column(Integer, primary_key=True, autoincrement=True)
  75. question = Column(String(255), nullable=False, comment="问题")
  76. question_type = Column(SmallInteger, nullable=False, comment="问题类型(0、AI问答,1、安全培训)")
  77. question_icon = Column(String(255), default="", comment="图标")
  78. click_count = Column(Integer, default=0, comment="点击量")
  79. created_at = Column(BigInteger, comment="创建时间")
  80. updated_at = Column(BigInteger, comment="更新时间")
  81. deleted_at = Column(BigInteger, comment="删除时间")
  82. is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")