Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/app/admin/schema/opera_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class OperaLogSchemaBase(SchemaBase):
trace_id: str = Field(description='追踪 ID')
username: str | None = Field(None, description='用户名')
method: str = Field(description='请求方法')
title: str = Field(description='操作标题')
title: str | None = Field(None, description='操作标题')
path: str = Field(description='请求路径')
ip: str = Field(description='IP 地址')
country: str | None = Field(None, description='国家')
Expand Down
2 changes: 1 addition & 1 deletion backend/plugin/code_generator/api/v1/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@router.get('/tables', summary='获取数据库表')
async def get_all_tables(
table_schema: Annotated[str, Query(description='数据库名')] = 'fba',
) -> ResponseSchemaModel[list[dict[str, str]]]:
) -> ResponseSchemaModel[list[dict[str, str | None]]]:
data = await gen_service.get_tables(table_schema=table_schema)
return response_base.success(data=data)

Expand Down
4 changes: 3 additions & 1 deletion backend/plugin/code_generator/crud/crud_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async def get_all_tables(db: AsyncSession, table_schema: str) -> Sequence[RowMap
WHERE table_name NOT LIKE 'sys_gen_%'
AND table_schema = :table_schema;
"""
stmt = text(sql).bindparams(table_schema=table_schema)
else:
sql = """
SELECT c.relname AS table_name, obj_description(c.oid) AS table_comment
Expand All @@ -36,7 +37,7 @@ async def get_all_tables(db: AsyncSession, table_schema: str) -> Sequence[RowMap
AND n.nspname = 'public' -- schema 通常是 'public'
AND c.relname NOT LIKE 'sys_gen_%';
"""
stmt = text(sql).bindparams(table_schema=table_schema)
stmt = text(sql)
result = await db.execute(stmt)
return result.mappings().all()

Expand All @@ -63,6 +64,7 @@ async def get_table(db: AsyncSession, table_name: str) -> Row[tuple]:
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind = 'r'
AND n.nspname = 'public' -- schema 通常是 'public'
AND c.relname = :table_name
AND c.relname NOT LIKE 'sys_gen_%';
"""
stmt = text(sql).bindparams(table_name=table_name)
Expand Down