25 lines
1.8 KiB
Go
25 lines
1.8 KiB
Go
|
|
package models
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"time"
|
|||
|
|
|
|||
|
|
"git.apinb.com/bsm-sdk/core/database"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// AuditOperationLog 对应 audit_operation_log,保存平台敏感维护操作的不可变审计快照。
|
|||
|
|
type AuditOperationLog struct {
|
|||
|
|
Entity // 公共实体字段
|
|||
|
|
OperatorIdentity string `gorm:"column:operator_identity;type:varchar(36);not null;index" json:"operator_identity"` // 操作平台账户唯一标识
|
|||
|
|
OperatorName string `gorm:"column:operator_name;type:varchar(64);not null" json:"operator_name"` // 操作平台账户登录名快照
|
|||
|
|
ResourceType string `gorm:"column:resource_type;type:varchar(64);not null;index" json:"resource_type"` // 被维护资源类型
|
|||
|
|
ResourceIdentity string `gorm:"column:resource_identity;type:varchar(36);not null;index" json:"resource_identity"` // 被维护资源唯一标识
|
|||
|
|
Action string `gorm:"column:action;type:varchar(64);not null;index" json:"action"` // 审计动作编码
|
|||
|
|
BeforeValue string `gorm:"column:before_value;type:text;not null" json:"before_value"` // 修复前字段 JSON 快照
|
|||
|
|
AfterValue string `gorm:"column:after_value;type:text;not null" json:"after_value"` // 修复后字段 JSON 快照
|
|||
|
|
OccurredAt time.Time `gorm:"column:occurred_at;type:timestamptz;not null;index" json:"occurred_at"` // 操作实际发生时间
|
|||
|
|
Remark string `gorm:"column:remark;type:varchar(255);not null;default:''" json:"remark"` // 操作原因或补充说明
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func init() { database.AppendMigrate(&AuditOperationLog{}) }
|
|||
|
|
func (table *AuditOperationLog) TableName() string { return "audit_operation_log" }
|