fix: log add tenant name

This commit is contained in:
2024-06-24 20:33:30 +08:00
parent b14d777876
commit 4120483b17
3 changed files with 6 additions and 0 deletions

View File

@@ -120,6 +120,7 @@ func OperateLog(options Options) gin.HandlerFunc {
OperLocation: location,
OperName: loginUser.User.UserName,
DeptName: loginUser.User.Dept.DeptName,
TenantName: loginUser.User.Tenant.TenantName,
}
if loginUser.User.UserType == "sys" {

View File

@@ -34,4 +34,6 @@ type SysLogOperate struct {
OperTime int64 `json:"operTime"`
// 消耗时间(毫秒)
CostTime int64 `json:"costTime"`
// Tenant name refer to tenant_name of sys_tenant
TenantName string `json:"tenantName"`
}

View File

@@ -253,6 +253,9 @@ func (r *SysLogOperateImpl) InsertSysLogOperate(SysLogOperate model.SysLogOperat
if SysLogOperate.CostTime > 0 {
params["cost_time"] = SysLogOperate.CostTime
}
if SysLogOperate.TenantName != "" {
params["tenant_name"] = SysLogOperate.TenantName
}
// 构建执行语句
keys, placeholder, values := repo.KeyPlaceholderValueByInsert(params)