Skip to content

Commit 7efa0a9

Browse files
committed
refactor: update logger decorator
1 parent ad7caef commit 7efa0a9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

backend/common/audit/models/log_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from sqlmodel import Field, SQLModel
1+
from sqlmodel import Field, SQLModel,BigInteger
22
from datetime import datetime
33
from typing import Optional
44
from enum import Enum
@@ -45,15 +45,15 @@ class SystemLog(SQLModel, table=True):
4545
id: Optional[int] = Field(default=None, primary_key=True)
4646
operation_type: str = Field(default=None)
4747
operation_detail: str = Field(default=None)
48-
user_id: Optional[int] = Field(default=None)
48+
user_id: Optional[int] = Field(default=None, sa_type=BigInteger())
4949
operation_status: str = Field(default=None)
5050
ip_address: Optional[str] = Field(default=None)
5151
user_agent: Optional[str] = Field(default=None)
52-
execution_time: int = Field(default=0, description="执行时间(毫秒)")
52+
execution_time: int = Field(default=0, description="执行时间(毫秒)", sa_type=BigInteger())
5353
error_message: Optional[str] = Field(default=None)
5454
create_time: datetime = Field(default_factory=datetime.now)
5555
module: Optional[str] = Field(default=None)
56-
oid: Optional[int] = Field(default=None)
56+
oid: Optional[int] = Field(default=None, sa_type=BigInteger())
5757
resource_id: Optional[str] = Field(default=None)
5858
request_method: Optional[str] = Field(default=None)
5959
request_path: Optional[str] = Field(default=None)

backend/common/audit/schemas/logger_decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ async def async_wrapper(*args, **kwargs):
509509
else:
510510
resource_id = -1
511511
oid = -1
512-
resource_name = '-' + input_account
512+
resource_name = input_account
513513
if config.operation_type == OperationType.DELETE:
514514
with Session(engine) as session:
515515
resource_name = get_resource_name_by_id_and_module(session, resource_id, config.module)

frontend/src/views/system/audit/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ const initOptions = () => {
301301
</el-table-column>
302302
<el-table-column prop="word" :label="$t('audit.oid_name')" width="120">
303303
<template #default="scope">
304-
{{ scope.row.oid_name }}
304+
{{ scope.row.oid_name === '-1' ? '-' : scope.row.oid_name }}
305305
</template>
306306
</el-table-column>
307307
<el-table-column prop="word" :label="$t('audit.operation_status')" width="100">

0 commit comments

Comments
 (0)