mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-22 20:13:32 +08:00
fix IBITU5 流程代码重构后SQL语法报错
This commit is contained in:
@@ -513,7 +513,7 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
|
|
||||||
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
|
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
|
||||||
wfruntime.RejectNode(_httpClientFactory.CreateClient(),reqest);
|
wfruntime.RejectNode(_httpClientFactory.CreateClient(), reqest);
|
||||||
|
|
||||||
//给流程创建人发送通知信息
|
//给流程创建人发送通知信息
|
||||||
_messageApp.SendMsgTo(flowInstance.CreateUserId,
|
_messageApp.SendMsgTo(flowInstance.CreateUserId,
|
||||||
@@ -591,10 +591,11 @@ namespace OpenAuth.App
|
|||||||
var result = new TableData();
|
var result = new TableData();
|
||||||
var user = _auth.GetCurrentUser();
|
var user = _auth.GetCurrentUser();
|
||||||
|
|
||||||
if (request.type == "wait") //待办事项
|
string sql = String.Empty;
|
||||||
|
|
||||||
|
if (request.type == "wait") //待办事项(即我待办过的流程)
|
||||||
{
|
{
|
||||||
//包括加签人包含当前用户,审批人包含当前用户且没有加签节点的
|
sql = $@"
|
||||||
var query = SugarClient.SqlQueryable<FlowInstance>($@"
|
|
||||||
SELECT fi.Id,
|
SELECT fi.Id,
|
||||||
fi.CreateUserName,
|
fi.CreateUserName,
|
||||||
fi.ActivityName,
|
fi.ActivityName,
|
||||||
@@ -626,16 +627,11 @@ namespace OpenAuth.App
|
|||||||
FROM FlowApprover fa
|
FROM FlowApprover fa
|
||||||
WHERE fa.Status = 0
|
WHERE fa.Status = 0
|
||||||
AND fa.ApproverId = '{user.User.Id}') AS UniqueInstanceIds
|
AND fa.ApproverId = '{user.User.Id}') AS UniqueInstanceIds
|
||||||
ON fi.Id = UniqueInstanceIds.Id")
|
ON fi.Id = UniqueInstanceIds.Id";
|
||||||
.WhereIF(!string.IsNullOrEmpty(request.key), t => t.CustomName.Contains(request.key));
|
|
||||||
|
|
||||||
result.count = await query.CountAsync();
|
|
||||||
result.data = await query.OrderByDescending(u => u.CreateDate)
|
|
||||||
.ToPageListAsync(request.page, request.limit);
|
|
||||||
}
|
}
|
||||||
else if (request.type == "disposed") //已办事项(即我参与过的流程)
|
else if (request.type == "disposed") //已办事项(即我参与过的流程)
|
||||||
{
|
{
|
||||||
var finalQuery = SugarClient.SqlQueryable<FlowInstance>($@"
|
sql = $@"
|
||||||
SELECT fi.Id,
|
SELECT fi.Id,
|
||||||
fi.CreateUserName,
|
fi.CreateUserName,
|
||||||
fi.ActivityName,
|
fi.ActivityName,
|
||||||
@@ -662,16 +658,11 @@ namespace OpenAuth.App
|
|||||||
WHERE fa.Status <> 0
|
WHERE fa.Status <> 0
|
||||||
AND fa.ApproverId = '{user.User.Id}') AS UniqueInstanceIds
|
AND fa.ApproverId = '{user.User.Id}') AS UniqueInstanceIds
|
||||||
ON fi.Id = UniqueInstanceIds.InstanceId
|
ON fi.Id = UniqueInstanceIds.InstanceId
|
||||||
")
|
";
|
||||||
.WhereIF(!string.IsNullOrEmpty(request.key), t => t.CustomName.Contains(request.key));
|
|
||||||
|
|
||||||
result.data = await finalQuery.OrderByDescending(i => i.CreateDate)
|
|
||||||
.ToPageListAsync(request.page, request.limit);
|
|
||||||
result.count = await finalQuery.CountAsync();
|
|
||||||
}
|
}
|
||||||
else //我的流程(包含知会我的)
|
else //我的流程(包含知会我的)
|
||||||
{
|
{
|
||||||
var sql = $@"
|
sql = $@"
|
||||||
SELECT fi.Id,
|
SELECT fi.Id,
|
||||||
fi.CreateUserName,
|
fi.CreateUserName,
|
||||||
fi.ActivityName,
|
fi.ActivityName,
|
||||||
@@ -709,15 +700,19 @@ namespace OpenAuth.App
|
|||||||
where a.`Key` = '{Define.INSTANCE_NOTICE_ROLE}') AS UniqueInstanceIds
|
where a.`Key` = '{Define.INSTANCE_NOTICE_ROLE}') AS UniqueInstanceIds
|
||||||
ON fi.Id = UniqueInstanceIds.InstanceId
|
ON fi.Id = UniqueInstanceIds.InstanceId
|
||||||
";
|
";
|
||||||
|
|
||||||
if (SugarClient.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
|
||||||
{
|
|
||||||
sql = sql.Replace("`Key`", "[Key]");
|
|
||||||
sql = sql.Replace("from dual", "");
|
|
||||||
}
|
}
|
||||||
else if (SugarClient.CurrentConnectionConfig.DbType == DbType.Oracle)
|
|
||||||
|
switch (SugarClient.CurrentConnectionConfig.DbType)
|
||||||
{
|
{
|
||||||
|
case DbType.SqlServer:
|
||||||
|
sql = sql.Replace("`Key`", "[Key]");
|
||||||
|
sql = sql.Replace("`User`", "[User]");
|
||||||
|
sql = sql.Replace("from dual", "");
|
||||||
|
break;
|
||||||
|
case DbType.Oracle:
|
||||||
sql = sql.Replace("`Key`", "\"Key\"");
|
sql = sql.Replace("`Key`", "\"Key\"");
|
||||||
|
sql = sql.Replace("`User`", "\"User\"");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var finalQuery = SugarClient.SqlQueryable<FlowInstance>(sql)
|
var finalQuery = SugarClient.SqlQueryable<FlowInstance>(sql)
|
||||||
@@ -726,7 +721,6 @@ namespace OpenAuth.App
|
|||||||
result.count = await finalQuery.CountAsync();
|
result.count = await finalQuery.CountAsync();
|
||||||
result.data = await finalQuery.OrderByDescending(u => u.CreateDate)
|
result.data = await finalQuery.OrderByDescending(u => u.CreateDate)
|
||||||
.ToPageListAsync(request.page, request.limit);
|
.ToPageListAsync(request.page, request.limit);
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user