mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-13 12:49:30 +00:00
refactor: 移除param层并优化用户更新和查询逻辑
移除不再使用的param层文件和相关引用 优化用户服务中密码更新逻辑,直接排除密码字段 调整常量配置中不需要编辑、显示和查询的字段 重构模板中查询参数生成逻辑,简化条件判断 更新README文档以反映架构变更
This commit is contained in:
@@ -53,34 +53,34 @@ class {{ class_name }}QueryParam:
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for column in columns %}
|
||||
{% if column.query_type == 'EQ' and column.column_name != 'status' %}
|
||||
{% if column.query_type == 'EQ' %}
|
||||
{{ column.column_name }}: {{ column.python_type }} | None = Query(None, description="{{ column.column_comment }}"),
|
||||
{% elif column.query_type == 'EQ' and column.column_name == 'status' %}
|
||||
{{ column.column_name }}: str | None = Query(None, description="{{ column.column_comment }}"),
|
||||
{% elif table.created_time %}
|
||||
created_time: list[DateTimeStr] | None = Query(None, description="创建时间范围", example=["2025-01-01 00:00:00", "2025-12-31 23:59:59"]),
|
||||
{% elif table.updated_time %}
|
||||
updated_time: list[DateTimeStr] | None = Query(None, description="更新时间范围", example=["2025-01-01 00:00:00", "2025-12-31 23:59:59"]),
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if table.created_time %}
|
||||
created_time: list[DateTimeStr] | None = Query(None, description="创建时间范围", example=["2025-01-01 00:00:00", "2025-12-31 23:59:59"]),
|
||||
{% endif %}
|
||||
{% if table.updated_time %}
|
||||
updated_time: list[DateTimeStr] | None = Query(None, description="更新时间范围", example=["2025-01-01 00:00:00", "2025-12-31 23:59:59"]),
|
||||
{% endif %}
|
||||
|
||||
) -> None:
|
||||
|
||||
# 模糊查询字段
|
||||
{% for column in columns %}
|
||||
{% if column.query_type == 'LIKE' %}
|
||||
# 模糊查询字段
|
||||
self.{{ column.column_name }} = ("like", {{ column.column_name }})
|
||||
{% elif column.query_type == 'EQ' and column.column_name %}
|
||||
# 精确查询字段
|
||||
{% elif column.query_type == 'EQ' %}
|
||||
self.{{ column.column_name }} = {{ column.column_name }}
|
||||
{% elif table.created_time %}
|
||||
self.created_id = created_id
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if table.created_time %}
|
||||
# 时间范围查询
|
||||
if created_time and len(created_time) == 2:
|
||||
self.created_time = ("between", (created_time[0], created_time[1]))
|
||||
{% elif table.updated_time %}
|
||||
self.updated_id = updated_id
|
||||
{% endif %}
|
||||
{% if table.updated_time %}
|
||||
if updated_time and len(updated_time) == 2:
|
||||
self.updated_time = ("between", (updated_time[0], updated_time[1]))
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user