暂存一下,防止丢失
This commit is contained in:
31
internal/model/approval_instance.go
Normal file
31
internal/model/approval_instance.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
// ApprovalInstance 是渠道无关的通用审批实例持久化模型。
|
||||
type ApprovalInstance struct {
|
||||
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
BusinessType string `gorm:"column:business_type;type:varchar(64);not null;uniqueIndex:uq_approval_instance_business,priority:1" json:"business_type"`
|
||||
BusinessID uint `gorm:"column:business_id;not null;uniqueIndex:uq_approval_instance_business,priority:2" json:"business_id"`
|
||||
SubmitterAccountID uint `gorm:"column:submitter_account_id;not null;index" json:"submitter_account_id"`
|
||||
SubmitterSnapshot datatypes.JSON `gorm:"column:submitter_snapshot;type:jsonb;not null" json:"submitter_snapshot"`
|
||||
Provider string `gorm:"column:provider;type:varchar(32);not null" json:"provider"`
|
||||
ExternalRef string `gorm:"column:external_ref;type:varchar(128);not null;default:''" json:"external_ref"`
|
||||
Status int `gorm:"column:status;type:int;not null;default:0;index:idx_approval_instance_status_changed,priority:1" json:"status"`
|
||||
RequestSnapshot datatypes.JSON `gorm:"column:request_snapshot;type:jsonb;not null" json:"request_snapshot"`
|
||||
DecisionSnapshot datatypes.JSON `gorm:"column:decision_snapshot;type:jsonb" json:"decision_snapshot,omitempty"`
|
||||
CorrelationID string `gorm:"column:correlation_id;type:varchar(100);not null;index" json:"correlation_id"`
|
||||
Version int `gorm:"column:version;type:int;not null;default:1" json:"version"`
|
||||
StatusChangedAt time.Time `gorm:"column:status_changed_at;type:timestamptz;not null;index:idx_approval_instance_status_changed,priority:2" json:"status_changed_at"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null;autoCreateTime" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null;autoUpdateTime" json:"updated_at"`
|
||||
}
|
||||
|
||||
// TableName 返回通用审批实例表名。
|
||||
func (ApprovalInstance) TableName() string {
|
||||
return "tb_approval_instance"
|
||||
}
|
||||
Reference in New Issue
Block a user