37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"hospital-admin-api/global"
|
|
"time"
|
|
)
|
|
|
|
// OrderOperationLog 订单操作日志表
|
|
type OrderOperationLog struct {
|
|
OperationLogId int64 `gorm:"column:operation_log_id;type:bigint(19);primary_key;comment:主键id" json:"operation_log_id"`
|
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" json:"order_id"`
|
|
OrderNo string `gorm:"column:order_no;type:varchar(255);comment:系统订单编号" json:"order_no"`
|
|
OrderType int `gorm:"column:order_type;type:tinyint(1);comment:订单类型(1:问诊 2:药品 3:检测)" json:"order_type"`
|
|
OperatorId int64 `gorm:"column:operator_id;type:bigint(19);comment:操作人id(后台用户)" json:"operator_id"`
|
|
OperationContent string `gorm:"column:operation_content;type:varchar(255);comment:操作内容" json:"operation_content"`
|
|
Model
|
|
}
|
|
|
|
func (m *OrderOperationLog) TableName() string {
|
|
return "gdxz_order_operation_log"
|
|
}
|
|
|
|
func (m *OrderOperationLog) BeforeCreate(tx *gorm.DB) error {
|
|
if m.OperationLogId == 0 {
|
|
m.OperationLogId = 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
|
|
}
|