Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
用户可能想知道他们提交的流程应用程序的状态是什么。我们将尝试通过创建一个列表来显示应用程序信息以及未决活动和未决用户,以解决这个问题。这样,请求者/用户将能够告诉他们的应用程序/流程实例的状态。
在本练习中,我们将使用人力资源费用索赔应用程序捆绑在Joget企业版中,将MySQL作为数据库。
图1:通过Datalist查看提交的应用程序
默认情况下,用户可以通过查看“个人支出”列表来查看提交的申请,但是无法分辨下一个活动是否在线,以及谁应该参加。这可以通过创建一个新的Datalist来解决。
SELECT a.*, sact.Name AS activityName, GROUP_CONCAT(DISTINCT sass.ResourceId SEPARATOR ', ') AS assignee FROM app_fd_hr_expense_claim a JOIN SHKActivities sact on a.id = sact.ProcessId JOIN SHKActivityStates ssta ON ssta.oid = sact.State INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId WHERE ssta.KeyValue = 'open.not_running.not_started' GROUP BY a.id
注意:如果您打算将其用于其他应用程序,请将代码“app_fd_hr_expense_claim”替换为您自己的表名称。
图2:将列添加到Datalist中
接下来,添加预期的列,并且最重要的是,添加“活动名称”和“受让人”以显示未决活动和受让人。
图3:数据显示未决活动和受让人
Datalist现在将列出所有人的未决活动。接下来,我们要过滤列表,使用户只会看到他们提交的内容。
图4:检索请求者信息
我们可以通过查找“索赔人”字段来确定索赔人是谁。
在Datalist的“SQL SELECT Query”中,将代码修改为以下内容:
SELECT a.*, sact.Name AS activityName, GROUP_CONCAT(DISTINCT sass.ResourceId SEPARATOR ', ') AS assignee FROM app_fd_hr_expense_claim a JOIN SHKActivities sact on a.id = sact.ProcessId JOIN SHKActivityStates ssta ON ssta.oid = sact.State INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId WHERE ssta.KeyValue = 'open.not_running.not_started' AND a.c_claimant = '#currentUser.firstName# #currentUser.lastName#' GROUP BY a.id
这是添加的新代码。
AND a.c_claimant = '#currentUser.firstName# #currentUser.lastName#'
通过上面所做的更改,我们现在可以列出与当前登录用户相关的记录。
图5:待处理活动和受让人的已过滤列表
附加信息:
以下查询是为MSSQL使用的。
SELECT dat.*, asg.activityName, asg.assignees FROM (SELECT id, activityName, assignees from (SELECT a.id, sact.Name AS activityName, sass.ResourceId AS assignee FROM app_fd_applications a JOIN SHKActivities sact on a.id = sact.ProcessId JOIN SHKActivityStates ssta ON ssta.oid = sact.State INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId WHERE ssta.KeyValue = 'open.not_running.not_started' group by sact.Name, sass.ResourceId, a.id) AS A CROSS APPLY (SELECT assignee + ',' FROM (SELECT a.id, sact.Name AS activityName, sass.ResourceId AS assignee FROM app_fd_applications a JOIN SHKActivities sact on a.id = sact.ProcessId JOIN SHKActivityStates ssta ON ssta.oid = sact.State INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId WHERE ssta.KeyValue = 'open.not_running.not_started' group by sact.Name, sass.ResourceId, a.id) AS B WHERE A.id = B.id AND A.activityName = B.activityName FOR XML PATH('')) D (assignees) GROUP BY id, activityName, assignees ) asg JOIN app_fd_applications dat ON asg.id = dat.id