Skip to content

Commit a2e1e1e

Browse files
committed
perf: 代码生成do模板补充表描述
1 parent 2ea6347 commit a2e1e1e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

ruoyi-fastapi-backend/module_generator/templates/python/do.py.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class {{ ClassName }}(Base):
1313
"""
1414

1515
__tablename__ = '{{ tableName }}'
16+
__table_args__ = {'comment': '{{ tableComment }}'}
1617

1718
{% for column in columns %}
1819
{{ column.column_name }} = Column({{ column.column_type | get_sqlalchemy_type }}, {% if column.pk %}primary_key=True, {% endif %}{% if column.increment %}autoincrement=True, {% endif %}{% if column.required or column.pk %}nullable=False{% else %}nullable=True{% endif %}, comment='{{ column.column_comment }}')

ruoyi-fastapi-backend/utils/template_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def prepare_context(cls, gen_table: GenTableModel):
7373
context = {
7474
'tplCategory': tpl_category,
7575
'tableName': gen_table.table_name,
76+
'tableComment': gen_table.table_comment,
7677
'functionName': function_name if StringUtil.is_not_empty(function_name) else '【请填写功能名称】',
7778
'ClassName': class_name,
7879
'className': class_name.lower(),

0 commit comments

Comments
 (0)