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:
@@ -591,10 +591,11 @@ namespace OpenAuth.App
|
||||
var result = new TableData();
|
||||
var user = _auth.GetCurrentUser();
|
||||
|
||||
if (request.type == "wait") //待办事项
|
||||
string sql = String.Empty;
|
||||
|
||||
if (request.type == "wait") //待办事项(即我待办过的流程)
|
||||
{
|
||||
//包括加签人包含当前用户,审批人包含当前用户且没有加签节点的
|
||||
var query = SugarClient.SqlQueryable<FlowInstance>($@"
|
||||
sql = $@"
|
||||
SELECT fi.Id,
|
||||
fi.CreateUserName,
|
||||
fi.ActivityName,
|
||||
@@ -626,16 +627,11 @@ namespace OpenAuth.App
|
||||
FROM FlowApprover fa
|
||||
WHERE fa.Status = 0
|
||||
AND fa.ApproverId = '{user.User.Id}') AS UniqueInstanceIds
|
||||
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);
|
||||
ON fi.Id = UniqueInstanceIds.Id";
|
||||
}
|
||||
else if (request.type == "disposed") //已办事项(即我参与过的流程)
|
||||
{
|
||||
var finalQuery = SugarClient.SqlQueryable<FlowInstance>($@"
|
||||
sql = $@"
|
||||
SELECT fi.Id,
|
||||
fi.CreateUserName,
|
||||
fi.ActivityName,
|
||||
@@ -662,16 +658,11 @@ namespace OpenAuth.App
|
||||
WHERE fa.Status <> 0
|
||||
AND fa.ApproverId = '{user.User.Id}') AS UniqueInstanceIds
|
||||
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 //我的流程(包含知会我的)
|
||||
{
|
||||
var sql = $@"
|
||||
sql = $@"
|
||||
SELECT fi.Id,
|
||||
fi.CreateUserName,
|
||||
fi.ActivityName,
|
||||
@@ -709,15 +700,19 @@ namespace OpenAuth.App
|
||||
where a.`Key` = '{Define.INSTANCE_NOTICE_ROLE}') AS UniqueInstanceIds
|
||||
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("`User`", "\"User\"");
|
||||
break;
|
||||
}
|
||||
|
||||
var finalQuery = SugarClient.SqlQueryable<FlowInstance>(sql)
|
||||
@@ -726,7 +721,6 @@ namespace OpenAuth.App
|
||||
result.count = await finalQuery.CountAsync();
|
||||
result.data = await finalQuery.OrderByDescending(u => u.CreateDate)
|
||||
.ToPageListAsync(request.page, request.limit);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user