WiiCITMS/models/oa/workflow_node.go
2025-11-07 14:14:34 +08:00

52 lines
2.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package oa
import (
"WiiGoLibrary/framework/db/v1/utils/mssql/unique"
"WiiGoLibrary/framework/db/v1/utils/tool"
"WiiGoLibrary/framework/hub/v1/dblib"
"time"
)
// WorkflowNodeTable 工作流节点表名
const WorkflowNodeTable = "oa_u_workflow_node"
// WorkflowNodeModel 工作流节点模型
type WorkflowNodeModel struct {
RecordGuid unique.UUID `gorm:"column:RecordGuid;type:UNIQUEIDENTIFIER;primaryKey;not null;default:newid();" json:"RecordGuid"`
NodeID int64 `gorm:"column:NodeID;type:BIGINT;not null;" json:"NodeID"`
WorkflowGuid unique.UUID `gorm:"column:WorkflowGuid;type:UNIQUEIDENTIFIER;index;not null;" json:"WorkflowGuid"` // 所属工作流
NodeName string `gorm:"column:NodeName;type:NVARCHAR(50);not null;" json:"NodeName"` // 节点名称
NodeType int16 `gorm:"column:NodeType;type:SMALLINT;not null;" json:"NodeType"` // 节点类型1-开始, 2-审批, 3-抄送, 4-条件, 5-结束
NodeOrder int `gorm:"column:NodeOrder;type:INT;not null;" json:"NodeOrder"` // 节点顺序
ApproverType int16 `gorm:"column:ApproverType;type:SMALLINT;" json:"ApproverType"` // 审批人类型1-指定人, 2-角色, 3-部门负责人
ApproverValue string `gorm:"column:ApproverValue;type:NVARCHAR(MAX);" json:"ApproverValue"` // 审批人值用户ID、角色ID或JSON
ConditionExp string `gorm:"column:ConditionExp;type:NVARCHAR(MAX);" json:"ConditionExp"` // 条件表达式(如果是条件节点)
Description string `gorm:"column:Description;type:NVARCHAR(255);" json:"Description"` // 节点描述
RecordType int16 `gorm:"column:RecordType;not null;" json:"RecordType"`
RecordStatus int16 `gorm:"column:RecordStatus;not null;default:0;" json:"RecordStatus"`
CreateTime time.Time `gorm:"column:CreateTime;type:DATETIME;default:CURRENT_TIMESTAMP;<-:create;" json:"CreateTime"`
UpdateTime time.Time `gorm:"column:UpdateTime;type:DATETIME;default:CURRENT_TIMESTAMP;autoUpdateTime;" json:"UpdateTime"`
}
func init() {
dblib.DBIns.RegisterAutoMigrateModel(&WorkflowNodeModel{})
}
// TableName 返回表名
func (wn *WorkflowNodeModel) TableName() string {
return WorkflowNodeTable
}
// WorkflowNodeInstance 创建工作流节点实例
func WorkflowNodeInstance() *WorkflowNodeModel {
return &WorkflowNodeModel{
RecordGuid: unique.NewV4(),
NodeID: tool.GenerateID(),
WorkflowGuid: unique.NilUUID,
NodeType: 0,
NodeOrder: 0,
RecordType: 0,
RecordStatus: 0,
}
}