You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
package model |
|
|
|
import "time" |
|
|
|
type Workflow struct { |
|
BaseModel |
|
Name string `json:"name"` |
|
Description string `json:"description"` |
|
Status int `json:"status"` // 1-启用 2-禁用 |
|
Nodes []WorkflowNode `json:"nodes"` |
|
} |
|
|
|
type WorkflowNode struct { |
|
BaseModel |
|
WorkflowID uint `json:"workflow_id"` |
|
Name string `json:"name"` |
|
Type string `json:"type"` // start, end, task, approval等 |
|
Handler string `json:"handler"` // 处理函数 |
|
NextNodes string `json:"next_nodes"` // 逗号分隔的下个节点ID |
|
Position int `json:"position"` |
|
} |
|
|
|
type WorkflowInstance struct { |
|
BaseModel |
|
WorkflowID uint `json:"workflow_id"` |
|
Status string `json:"status"` // running, completed, canceled |
|
CurrentNodeID uint `json:"current_node_id"` |
|
Data string `json:"data" gorm:"type:text"` // JSON格式的业务数据 |
|
Tasks []WorkflowTask `json:"tasks"` |
|
} |
|
|
|
type WorkflowTask struct { |
|
BaseModel |
|
InstanceID uint `json:"instance_id"` |
|
NodeID uint `json:"node_id"` |
|
Status string `json:"status"` // pending, processing, completed, canceled |
|
Result string `json:"result" gorm:"type:text"` // JSON格式的处理结果 |
|
Handler string `json:"handler"` |
|
Assignee uint `json:"assignee"` // 处理人 |
|
StartTime time.Time `json:"start_time"` |
|
EndTime time.Time `json:"end_time"` |
|
}
|
|
|