product_parameter.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. """商品参数码表模型"""
  2. from datetime import datetime
  3. from sqlalchemy import Column, String, DateTime, Integer, Boolean, Text
  4. from app.core.database import Base
  5. class BasProductParameter(Base):
  6. """商品参数码表"""
  7. __tablename__ = "bas_product_parameter"
  8. id = Column(String(32), primary_key=True, comment="主键ID")
  9. name = Column(String(100), nullable=False, comment="参数名称")
  10. code = Column(String(50), nullable=False, unique=True, comment="参数编码")
  11. param_type = Column(String(20), nullable=False, default="text", comment="参数类型:text-文本输入, select-单选下拉, multi_select-多选")
  12. options = Column(Text, nullable=True, comment="可选值列表,JSON数组")
  13. placeholder = Column(String(100), nullable=True, comment="输入提示文字")
  14. is_required = Column(Integer, default=0, comment="是否必填:0-否, 1-是")
  15. is_active = Column(Integer, default=1, comment="是否启用:0-禁用, 1-启用")
  16. is_del = Column(Integer, default=0, comment="是否删除:0-否, 1-是")
  17. sort_order = Column(Integer, default=0, comment="排序")
  18. remark = Column(String(500), nullable=True, comment="备注说明")
  19. create_at = Column(DateTime, default=datetime.now, comment="创建时间")
  20. create_by = Column(String(32), nullable=True, comment="创建人ID")
  21. create_name = Column(String(100), nullable=True, comment="创建人姓名")
  22. update_at = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment="修改时间")
  23. update_by = Column(String(32), nullable=True, comment="修改人ID")
  24. class BasProductParameterHis(Base):
  25. """商品参数码表历史表"""
  26. __tablename__ = "bas_product_parameter_his"
  27. id = Column(String(32), primary_key=True, nullable=False, comment="主键ID")
  28. name = Column(String(100), nullable=True, comment="参数名称")
  29. code = Column(String(50), nullable=True, comment="参数编码")
  30. param_type = Column(String(20), default="text", comment="参数类型")
  31. options = Column(Text, nullable=True, comment="可选值列表")
  32. placeholder = Column(String(100), nullable=True, comment="输入提示文字")
  33. is_required = Column(Integer, default=0, comment="是否必填")
  34. is_active = Column(Integer, default=1, comment="是否启用")
  35. sort_order = Column(Integer, default=0, comment="排序")
  36. remark = Column(String(500), nullable=True, comment="备注说明")
  37. create_at = Column(DateTime, nullable=True, comment="创建时间")
  38. create_by = Column(String(32), nullable=True, comment="创建人ID")
  39. create_name = Column(String(100), nullable=True, comment="创建人姓名")
  40. update_at = Column(DateTime, nullable=True, comment="修改时间")
  41. update_by = Column(String(32), nullable=True, comment="修改人ID")
  42. his_create_at = Column(DateTime, default=datetime.now, comment="历史记录创建时间")