feat(workflow): 添加流程实例类型字段支持

- 在 ApiResult 中新增 Type 属性用于存储流程类型
- 优化 WorkflowEngineApp 构造函数参数格式化
- 移除待办分页注释以启用正确的分页逻辑
- 重构流程变量查询逻辑,统一获取 Title 和 Type 变量
- 添加类型转换解析并将值赋给返回结果的 Type 字段
main
陈伟 2026-02-05 14:41:27 +08:00
parent ec35690db8
commit db85156238
2 changed files with 8 additions and 5 deletions

View File

@ -116,6 +116,8 @@ public class FlowQuerySingleResultDto
/// 发起人姓名
/// </summary>
public string InitiatorName { get; set; } = string.Empty;
public int? Type;
}
/// <summary>

View File

@ -33,7 +33,7 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
private const long _supervisionDeptRoleId = 6;
public WorkflowEngineApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<SysCategoryType> repository,
IAuth auth,BusinessNoGenerator businessNoGenerator) : base(unitWork, repository, auth)
IAuth auth, BusinessNoGenerator businessNoGenerator) : base(unitWork, repository, auth)
{
_sqlSugar = Repository.AsSugarClient();
_businessNoGenerator = businessNoGenerator;
@ -315,7 +315,6 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
var pageIndex = pageQueryDto.page < 1 ? 1 : pageQueryDto.page;
var pageSize = pageQueryDto.limit < 1 ? 10 : pageQueryDto.limit;
// 待办逻辑:工作项状态为"ToDo"、处理人ID为当前用户
// todo 这种分页不行,这是内存分页要改
var nodeIdList = _sqlSugar.Queryable<ZyFlowNode>()
// 核心In(主表字段, 子查询Lambda表达式)
.In(
@ -351,15 +350,17 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
if (flowInstance == null)
continue;
var flowTitle = _sqlSugar.Queryable<ZyFlowVariable>()
.Where(v => v.InstanceId == flowInstance.InstanceId && v.VarKey == "Title")
.First()?.VarValue ?? string.Empty;
var zyflowVarList = _sqlSugar.Queryable<ZyFlowVariable>()
.Where(v => v.InstanceId == flowInstance.InstanceId);
var flowTitle = zyflowVarList.Where(v => v.VarKey == "Title").First().VarValue;
var type = zyflowVarList.Where(v => v.VarKey == "Type").First().VarValue;
dataList.Add(new FlowQuerySingleResultDto
{
InstanceId = flowInstance.InstanceId,
BusinessNo = flowInstance.BusinessNo,
Title = flowTitle,
Type = Int16.Parse(type),
NodeName = workitem.NodeName,
Status = flowInstance.Status,
CreateTime = flowInstance.CreateTime,