from sqlalchemy import Column, Integer, String, Float, ForeignKey from sqlalchemy.orm import relationship from app.models.base import Base, MYSQL_TABLE_ARGS class Hotword(Base): __tablename__ = "biz_hotword" __table_args__ = MYSQL_TABLE_ARGS id = Column(Integer, primary_key=True, index=True) word = Column(String(255), nullable=False, comment="热词") pinyin = Column(String(255), nullable=True, comment="拼音") weight = Column(Float, default=1.0, comment="权重") scope = Column(String(50), default="personal", comment="作用域: personal/public") user_id = Column(Integer, ForeignKey("sys_user.user_id"), nullable=True, comment="创建人") creator = relationship("User")