from sqlalchemy import Column, Integer, String, Text, BigInteger, SmallInteger from database import Base class User(Base): """用户表""" __tablename__ = "user" id = Column(Integer, primary_key=True, autoincrement=True) username = Column(String(50), unique=True, nullable=False, comment="用户名") password = Column(String(255), nullable=False, comment="密码") email = Column(String(100), unique=True, comment="邮箱") phone = Column(String(20), comment="手机号") nickname = Column(String(50), comment="昵称") avatar = Column(String(255), comment="头像URL") status = Column(SmallInteger, default=1, comment="状态 1:正常 0:禁用") role = Column(String(20), default='user', comment="角色") points = Column(Integer, default=0, comment="积分余额") created_at = Column(BigInteger, comment="创建时间") updated_at = Column(BigInteger, comment="更新时间") deleted_at = Column(BigInteger, comment="删除时间") is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否") class RecommendQuestion(Base): """推荐问题表""" __tablename__ = "recommend_question" id = Column(Integer, primary_key=True, autoincrement=True) question = Column(String(255), nullable=False, comment="问题") created_at = Column(BigInteger, comment="创建时间") updated_at = Column(BigInteger, comment="更新时间") deleted_at = Column(BigInteger, comment="删除时间") is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否") class FeedbackQuestion(Base): """反馈问题表""" __tablename__ = "feedback_question" id = Column(Integer, primary_key=True, autoincrement=True) feedback_type = Column(SmallInteger, nullable=False, comment="反馈类型(1、问题反馈,2、界面优化,3、体验问题,4、其他)") feedback_content = Column(String(255), nullable=False, comment="反馈内容") feedback_user_phone = Column(String(255), nullable=False, comment="反馈用户手机号") feedback_img = Column(String(255), default="", comment="反馈图片") user_id = Column(Integer, nullable=False, comment="用户ID") created_at = Column(BigInteger, comment="创建时间") updated_at = Column(BigInteger, comment="更新时间") deleted_at = Column(BigInteger, comment="删除时间") is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否") class PolicyFile(Base): """政策文件表""" __tablename__ = "policy_file" id = Column(Integer, primary_key=True, autoincrement=True) policy_name = Column(String(255), nullable=False, comment="政策名称") policy_content = Column(String(255), default="", comment="政策内容") policy_type = Column(SmallInteger, nullable=False, comment="政策类型(0、全部,1、国家法规,2、行业法规,3、地方法规,4、内部条例)") policy_file_url = Column(String(255), nullable=False, comment="政策文件URL") policy_department = Column(String(255), default="", comment="政策部门") view_count = Column(Integer, default=0, comment="查看次数") file_type = Column(SmallInteger, default=0, comment="文件类型(0、pdf,1、word,2、excel,3、ppt,4、txt,5、其他)") file_tag = Column(String(255), default="", comment="文件标签") publish_time = Column(BigInteger, default=0, comment="颁布时间") created_at = Column(BigInteger, comment="创建时间") updated_at = Column(BigInteger, comment="更新时间") deleted_at = Column(BigInteger, comment="删除时间") is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否") class FunctionCard(Base): """AI问答和安全培训功能卡片表""" __tablename__ = "function_card" id = Column(Integer, primary_key=True, autoincrement=True) function_title = Column(String(255), nullable=False, comment="功能标题") function_type = Column(SmallInteger, nullable=False, comment="功能类型(0、AI问答,1、安全培训)") function_content = Column(String(255), nullable=False, comment="功能内容") function_icon = Column(String(255), default="", comment="图标") created_at = Column(BigInteger, comment="创建时间") updated_at = Column(BigInteger, comment="更新时间") deleted_at = Column(BigInteger, comment="删除时间") is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否") class HotQuestion(Base): """AI问答和安全培训底部热点问题表""" __tablename__ = "hot_question" id = Column(Integer, primary_key=True, autoincrement=True) question = Column(String(255), nullable=False, comment="问题") question_type = Column(SmallInteger, nullable=False, comment="问题类型(0、AI问答,1、安全培训)") question_icon = Column(String(255), default="", comment="图标") click_count = Column(Integer, default=0, comment="点击量") created_at = Column(BigInteger, comment="创建时间") updated_at = Column(BigInteger, comment="更新时间") deleted_at = Column(BigInteger, comment="删除时间") is_deleted = Column(Integer, default=0, comment="是否删除 1:是 0:否")