Files
effekt-interface/app/api/model/productModel.py
2026-05-07 19:21:19 +08:00

20 lines
1020 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from sqlalchemy import BigInteger, Column, Integer, SmallInteger, String, TIMESTAMP, Text, text
from sqlalchemy.ext.declarative import declarative_base
from common.sqlSession import to_dict
Base = declarative_base()
Base.to_dict = to_dict
class Product(Base):
__tablename__ = 'product'
id = Column(BigInteger, primary_key=True, autoincrement=True, comment='id')
name = Column(String(128), nullable=False, comment='产品名称')
code = Column(String(64), unique=True, nullable=False, comment='产品编码')
description = Column(Text, comment='产品描述')
status = Column(SmallInteger, default=1, comment='1:启用 0:禁用')
is_delete = Column(Integer, default=0, comment='0未删除1已删除')
created_time = Column(TIMESTAMP, server_default=text('CURRENT_TIMESTAMP'), nullable=True, comment='创建时间')
updated_time = Column(TIMESTAMP, server_default=text('CURRENT_TIMESTAMP'), server_onupdate=text('CURRENT_TIMESTAMP'), nullable=True, comment='修改时间')