feat: 代码生成功能适配pg数据库

This commit is contained in:
insistence
2025-02-18 11:36:33 +08:00
parent 15686b44ad
commit 2a486dc01e
11 changed files with 322 additions and 184 deletions

View File

@@ -75,7 +75,7 @@ class {{ BusinessName }}Service:
{% set parentheseIndex = column.column_comment.find("") %}
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
{% if column.required %}
if not await cls.check_{{ column.python_field | camel_to_snake }}_unique_services(query_db, page_object)
if not await cls.check_{{ column.python_field | camel_to_snake }}_unique_services(query_db, page_object):
raise ServiceException(message=f'新增{{ functionName }}{page_object.{{ column.python_field | camel_to_snake }}}失败,{{ comment }}已存在')
{% endif %}
{% endfor %}
@@ -83,8 +83,8 @@ class {{ BusinessName }}Service:
{% if table.sub %}
add_{{ businessName }} = await {{ BusinessName }}Dao.add_{{ businessName }}_dao(query_db, page_object)
if add_{{ businessName }}:
for sub_table in page_object.{{ subclassName }}_list:
await {{ BusinessName }}Dao.add_{{ subTable.business_name }}_dao(query_db, sub_table)
for sub_table in page_object.{{ subclassName }}_list:
await {{ BusinessName }}Dao.add_{{ subTable.business_name }}_dao(query_db, sub_table)
{% else %}
await {{ BusinessName }}Dao.add_{{ businessName }}_dao(query_db, page_object)
{% endif %}
@@ -110,7 +110,7 @@ class {{ BusinessName }}Service:
{% set parentheseIndex = column.column_comment.find("") %}
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
{% if column.required %}
if not await cls.check_{{ column.python_field | camel_to_snake }}_unique_services(query_db, page_object)
if not await cls.check_{{ column.python_field | camel_to_snake }}_unique_services(query_db, page_object):
raise ServiceException(message=f'修改{{ functionName }}{page_object.{{ column.python_field | camel_to_snake }}}失败,{{ comment }}已存在')
{% endif %}
{% endfor %}