Files
zkxw/backend/app/models/product_parameter.py
T
2026-05-12 16:35:07 +08:00

51 lines
2.9 KiB
Python

"""商品参数码表模型"""
from datetime import datetime
from sqlalchemy import Column, String, DateTime, Integer, Boolean, Text
from app.core.database import Base
class BasProductParameter(Base):
"""商品参数码表"""
__tablename__ = "bas_product_parameter"
id = Column(String(32), primary_key=True, comment="主键ID")
name = Column(String(100), nullable=False, comment="参数名称")
code = Column(String(50), nullable=False, unique=True, comment="参数编码")
param_type = Column(String(20), nullable=False, default="text", comment="参数类型:text-文本输入, select-单选下拉, multi_select-多选")
options = Column(Text, nullable=True, comment="可选值列表,JSON数组")
placeholder = Column(String(100), nullable=True, comment="输入提示文字")
is_required = Column(Integer, default=0, comment="是否必填:0-否, 1-是")
is_active = Column(Integer, default=1, comment="是否启用:0-禁用, 1-启用")
is_del = Column(Integer, default=0, comment="是否删除:0-否, 1-是")
sort_order = Column(Integer, default=0, comment="排序")
remark = Column(String(500), nullable=True, comment="备注说明")
create_at = Column(DateTime, default=datetime.now, comment="创建时间")
create_by = Column(String(32), nullable=True, comment="创建人ID")
create_name = Column(String(100), nullable=True, comment="创建人姓名")
update_at = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment="修改时间")
update_by = Column(String(32), nullable=True, comment="修改人ID")
class BasProductParameterHis(Base):
"""商品参数码表历史表"""
__tablename__ = "bas_product_parameter_his"
id = Column(String(32), primary_key=True, nullable=False, comment="主键ID")
name = Column(String(100), nullable=True, comment="参数名称")
code = Column(String(50), nullable=True, comment="参数编码")
param_type = Column(String(20), default="text", comment="参数类型")
options = Column(Text, nullable=True, comment="可选值列表")
placeholder = Column(String(100), nullable=True, comment="输入提示文字")
is_required = Column(Integer, default=0, comment="是否必填")
is_active = Column(Integer, default=1, comment="是否启用")
sort_order = Column(Integer, default=0, comment="排序")
remark = Column(String(500), nullable=True, comment="备注说明")
create_at = Column(DateTime, nullable=True, comment="创建时间")
create_by = Column(String(32), nullable=True, comment="创建人ID")
create_name = Column(String(100), nullable=True, comment="创建人姓名")
update_at = Column(DateTime, nullable=True, comment="修改时间")
update_by = Column(String(32), nullable=True, comment="修改人ID")
his_create_at = Column(DateTime, default=datetime.now, comment="历史记录创建时间")