mirror of
https://github.com/rulego/gflow-engine.git
synced 2026-12-05 16:02:03 +00:00
chore: 清理活动名死代码并修正批量分类注释
This commit is contained in:
1 parent
877cd4ccf1
commit
befe0171d9
3 files changed
+3
-21
No files matched your search
@@ -28,7 +28,7 @@ type ProcessService interface {
|
||||
Get(ctx context.Context, processID string) (*model.WfProcess, error)
|
||||
|
||||
// CategoriesByIDs 批量取流程分类(id → category,空串/缺失不计入 map)。
|
||||
// 统计聚合按分类分组用:只投影两列,避免逐 ID Get 全量定义行(含 definition_json)。
|
||||
// 统计聚合按分类分组用:一次批量查询替代逐 ID Get,消除 N+1。
|
||||
CategoriesByIDs(ctx context.Context, ids []string) (map[string]string, error)
|
||||
|
||||
// GetByKey 根据Key获取最新版本的流程定义
|
||||
|
||||
@@ -547,8 +547,8 @@ func isUniqueViolation(err error) bool {
|
||||
strings.Contains(msg, "duplicate key") || strings.Contains(msg, "UNIQUE constraint failed")
|
||||
}
|
||||
|
||||
// CategoriesByIDs 批量取流程分类(id → category):只投影 id/category 两列,
|
||||
// 供统计聚合按分类分组,替代逐 ID Get 全量定义行(含 definition_json)的 N+1。
|
||||
// CategoriesByIDs 批量取流程分类(id → category):一次批量查询替代逐 ID Get
|
||||
// 全量定义行的 N+1,供统计聚合按分类分组。
|
||||
func (s *ProcessServiceImpl) CategoriesByIDs(ctx context.Context, ids []string) (map[string]string, error) {
|
||||
out := make(map[string]string, len(ids))
|
||||
if len(ids) == 0 {
|
||||
|
||||
@@ -82,21 +82,3 @@ func resolveInstanceActivityNameCached(instance *model.WfInstance, cache map[str
|
||||
}
|
||||
return nodeID
|
||||
}
|
||||
|
||||
// resolveInstanceActivityName 按实例 CurrentActivity 节点 ID 从关联流程定义解析节点名;
|
||||
// 解析失败、节点缺失或无流程定义时回退节点 ID,保证列表"当前节点"列不空。
|
||||
func resolveInstanceActivityName(instance *model.WfInstance) string {
|
||||
if instance == nil || instance.CurrentActivity == nil || *instance.CurrentActivity == "" {
|
||||
return ""
|
||||
}
|
||||
nodeID := *instance.CurrentActivity
|
||||
if instance.Process == nil {
|
||||
return nodeID
|
||||
}
|
||||
if rc, err := instance.Process.ToRuleChain(); err == nil && rc != nil {
|
||||
if node, ok := rc.GetNode(nodeID); ok && node.Name != "" {
|
||||
return node.Name
|
||||
}
|
||||
}
|
||||
return nodeID
|
||||
}
|
||||
Reference in new issue
Block a user