增加导出日志
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LogExport struct {
|
||||
ExportId int64 `gorm:"column:export_id;type:bigint(19);primary_key;comment:主键id" json:"export_id"`
|
||||
AdminUserId int64 `gorm:"column:admin_user_id;type:bigint(19);comment:后台用户id" json:"admin_user_id"`
|
||||
ExportModule string `gorm:"column:export_module;type:varchar(255);comment:导出模块" json:"export_module"`
|
||||
ExportFile string `gorm:"column:export_file;type:varchar(255);comment:导出文件名称" json:"export_file"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *LogExport) TableName() string {
|
||||
return "gdxz_log_export"
|
||||
}
|
||||
|
||||
func (m *LogExport) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.ExportId == 0 {
|
||||
m.ExportId = global.Snowflake.Generate().Int64()
|
||||
}
|
||||
|
||||
m.CreatedAt = LocalTime(time.Now())
|
||||
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||
|
||||
m.UpdatedAt = LocalTime(time.Now())
|
||||
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user