You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.1 KiB
26 lines
1.1 KiB
"""
|
|
{{ table.comment }} Model - 对齐JAVA Entity
|
|
|
|
@author: {{ author }}
|
|
@date: {{ date }}
|
|
"""
|
|
from sqlalchemy import Column, Integer, BigInteger, SmallInteger, String, DateTime, Boolean, Float, Text, Numeric, JSON, ForeignKey
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.database import Base
|
|
|
|
class {{ table.entity }}Model(Base):
|
|
"""
|
|
{{ table.comment }} - 对齐JAVA Entity
|
|
"""
|
|
__tablename__ = "{{ table.name }}"
|
|
|
|
id = Column(Integer, primary_key=True, index=True, autoincrement=True, comment="主键ID")
|
|
{% for field in fields %}
|
|
{{ field.name }} = Column({{ field.sqlalchemy_type }}, {% if field.nullable %}nullable=True{% else %}nullable=False{% endif %}, comment="{{ field.comment }}")
|
|
{% endfor %}
|
|
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
|
|
created_by = Column(String(50), comment="创建人")
|
|
updated_by = Column(String(50), comment="更新人")
|
|
is_deleted = Column(Boolean, default=False, comment="是否删除")
|
|
|