mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
feat: sql解析器替换、工单统一由‘我的流程’发起、流程定义支持自定义条件触发审批、资源隐藏编号、model支持物理删除等
This commit is contained in:
@@ -5,17 +5,21 @@ import (
|
||||
"mayfly-go/pkg/enumx"
|
||||
"mayfly-go/pkg/logx"
|
||||
"mayfly-go/pkg/model"
|
||||
"mayfly-go/pkg/utils/collx"
|
||||
"mayfly-go/pkg/utils/stringx"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 流程定义信息
|
||||
type Procdef struct {
|
||||
model.Model
|
||||
|
||||
Name string `json:"name" form:"name"` // 名称
|
||||
DefKey string `json:"defKey" form:"defKey"` //
|
||||
Tasks string `json:"tasks"` // 审批节点任务信息
|
||||
Status ProcdefStatus `json:"status"` // 状态
|
||||
Remark string `json:"remark"`
|
||||
Name string `json:"name" form:"name"` // 名称
|
||||
DefKey string `json:"defKey" form:"defKey"` //
|
||||
Tasks string `json:"tasks"` // 审批节点任务信息
|
||||
Status ProcdefStatus `json:"status"` // 状态
|
||||
Condition *string `json:"condition"` // 触发审批的条件(计算结果返回1则需要启用该流程)
|
||||
Remark *string `json:"remark"`
|
||||
}
|
||||
|
||||
func (p *Procdef) TableName() string {
|
||||
@@ -34,6 +38,19 @@ func (p *Procdef) GetTasks() []*ProcdefTask {
|
||||
return tasks
|
||||
}
|
||||
|
||||
// MatchCondition 是否匹配审批条件,匹配则需要启用该流程
|
||||
// @param bizType 业务类型
|
||||
// @param param 业务参数
|
||||
// Condition返回值为1,则表面该操作需要启用流程
|
||||
func (p *Procdef) MatchCondition(bizType string, param map[string]any) bool {
|
||||
if p.Condition == nil || *p.Condition == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
res := stringx.TemplateResolve(*p.Condition, collx.Kvs("bizType", bizType, "param", param))
|
||||
return strings.TrimSpace(res) == "1"
|
||||
}
|
||||
|
||||
type ProcdefTask struct {
|
||||
Name string `json:"name" form:"name"` // 审批节点任务名称
|
||||
TaskKey string `json:"taskKey" form:"taskKey"` // 任务key
|
||||
|
||||
Reference in New Issue
Block a user