CodeClinet 相关代码修改

main_dev_1.0
冉成楼 4 months ago
parent 4eca96b2c6
commit c247a8fa38

@ -16,6 +16,7 @@ using System.Text;
using System.Threading.Tasks;
using OpenAuth.Auth.Interface;
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
using NPOI.SS.Formula.Functions;
namespace OpenAuth.App.CodeTable
{
@ -84,14 +85,21 @@ namespace OpenAuth.App.CodeTable
/// <returns></returns>
public List<DbColumnInfo> GetTableColumnList(string code, string tableName)
{
//using (var db = this.CodeClient(code, _configuration))
//{
// //var list= this.Repository.AsSugarClient().DbMaintenance.GetTableInfoList(isCache);
// var list = db.DbMaintenance.GetColumnInfosByTableName(tableName,false);
// return list;
//}
return null;
var link = base.UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == code).First();
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection, link.DBType))
{
//var list= this.Repository.AsSugarClient().DbMaintenance.GetTableInfoList(isCache);
var list = db.DbMaintenance.GetColumnInfosByTableName(tableName, false);
return list;
}
}
else
{
return null;
}
}
/// <summary>
/// 导入表信息
@ -179,7 +187,7 @@ namespace OpenAuth.App.CodeTable
{
codeColumnsEntity.Id = oldColumn.Id;
updateList.Add(codeColumnsEntity);
}
}
}
// 获取需要删除的列
var deleteColumns = oldColumns.FindAll(t => updateList.FindIndex(t2 => t2.Id == t.Id) == -1);
@ -243,36 +251,47 @@ namespace OpenAuth.App.CodeTable
/// </summary>
/// <param name="tableName"></param>
/// <returns></returns>
//public List<dynamic> GetTableAndViewColumnList(string dbCode, string tableName)
//{
// using (var db = this.CodeClient(dbCode, _configuration))
// {
// string query = $@"
// SELECT
// c.column_name,
// d.description
// FROM
// information_schema.columns c
// LEFT JOIN
// pg_catalog.pg_class t ON t.relname = c.table_name
// LEFT JOIN
// pg_catalog.pg_attribute a ON a.attnum > 0
// AND a.attrelid = t.oid
// AND a.attname = c.column_name
// LEFT JOIN
// pg_catalog.pg_namespace n ON n.oid = t.relnamespace
// LEFT JOIN
// pg_catalog.pg_description d ON d.objoid = a.attrelid
// AND d.objsubid = a.attnum
// WHERE
// c.table_name = @tableName
// AND c.table_schema = 'public';";
// // 执行查询并获取结果
// var viewColumns = db.Ado.SqlQuery<dynamic>(query, new { tableName = tableName });
// return viewColumns;
// }
public List<dynamic> GetTableAndViewColumnList(string dbCode, string tableName)
{
var link = base.UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == code).First();
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection, link.DBType))
{
string query = $@"
SELECT
c.column_name,
d.description
FROM
information_schema.columns c
LEFT JOIN
pg_catalog.pg_class t ON t.relname = c.table_name
LEFT JOIN
pg_catalog.pg_attribute a ON a.attnum > 0
AND a.attrelid = t.oid
AND a.attname = c.column_name
LEFT JOIN
pg_catalog.pg_namespace n ON n.oid = t.relnamespace
LEFT JOIN
pg_catalog.pg_description d ON d.objoid = a.attrelid
AND d.objsubid = a.attnum
WHERE
c.table_name = @tableName
AND c.table_schema = 'public';";
// 执行查询并获取结果
var viewColumns = db.Ado.SqlQuery<dynamic>(query, new { tableName = tableName });
return viewColumns;
}
}
else
{
return null;
}
//}
}
#endregion
}
}

@ -15,6 +15,7 @@ using System.Text;
using System.Threading.Tasks;
using OpenAuth.Auth.Interface;
using static Dm.net.buffer.ByteArrayBuffer;
using NPOI.SS.Formula.Functions;
namespace OpenAuth.App.DbTable
{
@ -36,34 +37,46 @@ namespace OpenAuth.App.DbTable
{
if (dbTableReq.DbColumnInfoList == null || !dbTableReq.DbColumnInfoList.Any())
throw new Exception("请添加数据列");
return null;
//if (dbTableReq.DbColumnInfoList == null || !dbTableReq.DbColumnInfoList.Any())
// throw new Exception("请添加数据列");
//using (var db = this.CodeClient(dbcode, _configuration))
//{
// var typeBuilder = db.DynamicBuilder().CreateClass(dbTableReq.TableName, new SugarTable() { TableName = dbTableReq.TableName, TableDescription = dbTableReq.Description });
// dbTableReq.DbColumnInfoList.ForEach(u =>
// {
// typeBuilder.CreateProperty(u.DbColumnName, typeof(string), new SugarColumn()
// {
// IsPrimaryKey = u.IsPrimarykey == 1,
// IsIdentity = u.IsIdentity == 1,
// ColumnDataType = u.DataType,
// Length = u.Length,
// IsNullable = u.IsNullable == 1,
// DecimalDigits = u.DecimalDigits,
// ColumnDescription = u.ColumnDescription,
// });
// });
// db.CodeFirst.InitTables(typeBuilder.BuilderType());
// return new Response<bool>()
// {
// Code = 200,
// Result = true,
// Message = "创建成功"
// };
//}
var link = UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == dbcode).First();
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection, link.DBType))
{
var typeBuilder = db.DynamicBuilder().CreateClass(dbTableReq.TableName, new SugarTable() { TableName = dbTableReq.TableName, TableDescription = dbTableReq.Description });
dbTableReq.DbColumnInfoList.ForEach(u =>
{
typeBuilder.CreateProperty(u.DbColumnName, typeof(string), new SugarColumn()
{
IsPrimaryKey = u.IsPrimarykey == 1,
IsIdentity = u.IsIdentity == 1,
ColumnDataType = u.DataType,
Length = u.Length,
IsNullable = u.IsNullable == 1,
DecimalDigits = u.DecimalDigits,
ColumnDescription = u.ColumnDescription,
});
});
db.CodeFirst.InitTables(typeBuilder.BuilderType());
return new Response<bool>()
{
Code = 200,
Result = true,
Message = "创建成功"
};
}
}
else
{
return new Response<bool>()
{
Code = 200,
Result = false,
Message = "创建失败"
};
}
}
/// <summary>
/// 创建字段
@ -73,33 +86,46 @@ namespace OpenAuth.App.DbTable
/// <returns></returns>
public Response<bool> AddColumn(string dbcode, DbColumnInput dbColumnInput)
{
return null;
var link = UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == code).First();
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection,link.DBType))
{
var column = new DbColumnInfo
{
ColumnDescription = dbColumnInput.ColumnDescription,
DbColumnName = dbColumnInput.DbColumnName,
IsIdentity = dbColumnInput.IsIdentity == 1,
IsNullable = dbColumnInput.IsNullable == 1,
IsPrimarykey = dbColumnInput.IsPrimarykey == 1,
Length = dbColumnInput.Length,
DecimalDigits = dbColumnInput.DecimalDigits,
DataType = dbColumnInput.DataType
};
db.DbMaintenance.AddColumn(dbColumnInput.TableName, column);
db.DbMaintenance.AddColumnRemark(dbColumnInput.DbColumnName, dbColumnInput.TableName, dbColumnInput.ColumnDescription);
if (column.IsPrimarykey)
db.DbMaintenance.AddPrimaryKey(dbColumnInput.TableName, dbColumnInput.DbColumnName);
return new Response<bool>()
{
Code = 200,
Result = true,
Message = "创建成功"
};
}
}
else
{
return new Response<bool>()
{
Code = 200,
Result = false,
Message = "创建失败"
};
}
//using (var db = this.CodeClient(dbcode, _configuration))
//{
// var column = new DbColumnInfo
// {
// ColumnDescription = dbColumnInput.ColumnDescription,
// DbColumnName = dbColumnInput.DbColumnName,
// IsIdentity = dbColumnInput.IsIdentity == 1,
// IsNullable = dbColumnInput.IsNullable == 1,
// IsPrimarykey = dbColumnInput.IsPrimarykey == 1,
// Length = dbColumnInput.Length,
// DecimalDigits = dbColumnInput.DecimalDigits,
// DataType = dbColumnInput.DataType
// };
// db.DbMaintenance.AddColumn(dbColumnInput.TableName, column);
// db.DbMaintenance.AddColumnRemark(dbColumnInput.DbColumnName, dbColumnInput.TableName, dbColumnInput.ColumnDescription);
// if (column.IsPrimarykey)
// db.DbMaintenance.AddPrimaryKey(dbColumnInput.TableName, dbColumnInput.DbColumnName);
// return new Response<bool>()
// {
// Code = 200,
// Result = true,
// Message = "创建成功"
// };
//}
}
}
}

@ -14,6 +14,7 @@ using System.Text;
using Castle.Core.Internal;
using DocumentFormat.OpenXml.Drawing.Charts;
using OpenAuth.Auth.Interface;
using DocumentFormat.OpenXml.EMMA;
namespace OpenAuth.App.FormModule
{
@ -555,27 +556,37 @@ namespace OpenAuth.App.FormModule
/// <returns></returns>
public Response<List<DbTableInfo>> GetTableList(string code, string key, bool isCache = false)
{
//using (var db = this.CodeClient(code, _configuration))
//{
// var list = db.DbMaintenance.GetTableInfoList(isCache);
// //var list = db.DbMaintenance.GetTableInfoList((dbtype, sql) =>
// //{
// // if (dbtype == SqlSugar.DbType.Kdbndp)
// // {
// // return sql.Replace(@"where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' order by relname", @" INNER JOIN PG_NAMESPACE AS n ON c.relnamespace = n.oid where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' and n.nspname = 'public' order by relname");
// // }
// // return sql;
// //});
// var info = list.FindAll(t =>
// t.DbObjectType == DbObjectType.Table && t.Name.ToLower() != "lr_db_codecolumns" &&
// t.Name.ToLower() != "lr_db_codetable" && t.Name.ToLower() != "lr_db_history")
// .WhereIF(!key.IsNullOrEmpty(), t => t.Name.ToLower().Contains(key.ToLower())).ToList();
// return new Response<List<DbTableInfo>>
// {
// Result = info
// };
//}
return null;
var link = UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == code).First();
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection,link.DBType))
{
var list = db.DbMaintenance.GetTableInfoList(isCache);
//var list = db.DbMaintenance.GetTableInfoList((dbtype, sql) =>
//{
// if (dbtype == SqlSugar.DbType.Kdbndp)
// {
// return sql.Replace(@"where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' order by relname", @" INNER JOIN PG_NAMESPACE AS n ON c.relnamespace = n.oid where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' and n.nspname = 'public' order by relname");
// }
// return sql;
//});
var info = list.FindAll(t =>
t.DbObjectType == DbObjectType.Table && t.Name.ToLower() != "lr_db_codecolumns" &&
t.Name.ToLower() != "lr_db_codetable" && t.Name.ToLower() != "lr_db_history")
.WhereIF(!key.IsNullOrEmpty(), t => t.Name.ToLower().Contains(key.ToLower())).ToList();
return new Response<List<DbTableInfo>>
{
Result = info
};
}
}
else
{
return new Response<List<DbTableInfo>>
{
Result = null
};
}
}
#endregion

@ -23,6 +23,7 @@ using OpenAuth.Auth.Interface;
using System.Diagnostics;
using NPOI.Util;
using Utils.Web.Model;
using NPOI.SS.Formula.Functions;
namespace OpenAuth.App
{
@ -281,7 +282,7 @@ namespace OpenAuth.App
ParentNodeId = parentNodeId,
ParentProcessId = parentProcessId,
ParentTaskId = parentTaskId,
CreateUserId = currentUser?.Id.ToString(),
CreateUserId = currentUser?.Id.ToString(),
CreateUserName = currentUser?.Name,
CreateUserAccount = currentUser?.Account,
UserId = currentUser?.Id.ToString()
@ -451,7 +452,7 @@ namespace OpenAuth.App
var scriptTaskList = myTaskList.FindAll(t => t.Type == 10);
foreach (var item in scriptTaskList)
{
var result = await ExecuteScript(item, "create", processId, "", "",iWFEngine.CreateUser, iWFEngine, null,"");
var result = await ExecuteScript(item, "create", processId, "", "", iWFEngine.CreateUser, iWFEngine, null, "");
scriptResults.Add(result);
}
@ -583,7 +584,7 @@ namespace OpenAuth.App
var scriptTaskList = myTaskList.FindAll(t => t.Type == 10);
foreach (var item in scriptTaskList)
{
var result = await ExecuteScript(item, "create", processId, "", "",iWFEngine.CreateUser, iWFEngine, null, "");
var result = await ExecuteScript(item, "create", processId, "", "", iWFEngine.CreateUser, iWFEngine, null, "");
scriptResults.Add(result);
}
@ -667,7 +668,7 @@ namespace OpenAuth.App
var scriptTaskList = myTaskList.FindAll(t => t.Type == 10);
foreach (var item in scriptTaskList)
{
var result = await ExecuteScript(item, "createAgain", processId, "", "",iWFEngine.CreateUser, iWFEngine, null, "");
var result = await ExecuteScript(item, "createAgain", processId, "", "", iWFEngine.CreateUser, iWFEngine, null, "");
scriptResults.Add(result);
}
@ -746,7 +747,7 @@ namespace OpenAuth.App
foreach (var item in taskList)
{
if (item.Type == 1 || item.Type == 3 || item.Type == 5 || item.Type == 6 || item.Type == 7)
if (item.Type == 1 || item.Type == 3 || item.Type == 5 || item.Type == 6 || item.Type == 7)
{
item.IsUrge = 1;
item.UrgeTime = DateTime.Now;
@ -828,7 +829,7 @@ namespace OpenAuth.App
var iWFEngine = await Bootstraper("", taskEntiy.ProcessId, null, nextUsers);
// 1.判断任务类型 1 普通任务 5 会签任务
if (taskEntiy.Type == 1||taskEntiy.Type==7)
if (taskEntiy.Type == 1 || taskEntiy.Type == 7)
{
await AuditNode(iWFEngine, taskEntiy, code, name, des, stampImg, nextId);
}
@ -1244,7 +1245,7 @@ namespace OpenAuth.App
foreach (var item in taskList)
{
if ((item.Type == 1 || item.Type == 3 || item.Type == 5||item.Type==7) && item.User.IsNew)
if ((item.Type == 1 || item.Type == 3 || item.Type == 5 || item.Type == 7) && item.User.IsNew)
{
if (!res.ContainsKey(item.UnitId))
{
@ -1343,11 +1344,12 @@ namespace OpenAuth.App
response.Result = true;
response.Message = "success";
}
else {
else
{
response.Result = false;
response.Message = "error";
}
return response;
}
@ -1696,6 +1698,8 @@ namespace OpenAuth.App
List<string> userIds = new List<string>();
foreach (var item in auditorList)
{
var link = UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == item.DbCode).First();
switch (item.Type)
{
//岗位
@ -1797,51 +1801,57 @@ namespace OpenAuth.App
break;
//数据库表字段
case "6":
//using (var db = this.CodeClient(item.DbCode, _configuration))
//{
// DataTable dt = await db.Ado.GetDataTableAsync(string.Format("select {0} from {1} where {2} = @processId ", item.AuditorField, item.Table, item.Rfield), new { processId });
// foreach (DataRow row in dt.Rows)
// {
// var userIdString = row[0].ToString();
// if (!string.IsNullOrEmpty(userIdString))
// {
// var userIdList = userIdString.Split(",");
// foreach (var userIdItem in userIdList)
// {
// userIds.Add(userIdItem);
// }
// }
// }
// break;
//}
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection, link.DBType))
{
DataTable dt = await db.Ado.GetDataTableAsync(string.Format("select {0} from {1} where {2} = @processId ", item.AuditorField, item.Table, item.Rfield), new { processId });
foreach (DataRow row in dt.Rows)
{
var userIdString = row[0].ToString();
if (!string.IsNullOrEmpty(userIdString))
{
var userIdList = userIdString.Split(",");
foreach (var userIdItem in userIdList)
{
userIds.Add(userIdItem);
}
}
}
}
}
break;
//数据库表字段
case "7":
//using (var db = this.CodeClient(item.DbCode, _configuration))
//{
// //获取数据id
// var process = await client.Queryable<WFProcess>().FirstAsync(a => a.Id == processId);
// WFInstanceInfo instanceInfo = null;
// if (process != null)
// {
// // instanceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<WFInstanceInfo>(process.InstanceInfo);
// instanceInfo = process.InstanceInfo;
// }
// DataTable dt = await db.Ado.GetDataTableAsync(string.Format(item.Sql), new { pkeyValue = instanceInfo.pkeyValue });
// foreach (DataRow row in dt.Rows)
// {
// var userIdString = row[0].ToString();
// if (!string.IsNullOrEmpty(userIdString))
// {
// var userIdList = userIdString.Split(",");
// foreach (var userIdItem in userIdList)
// {
// userIds.Add(userIdItem);
// }
// }
// }
// break;
//}
if (link != null)
{
using (var db = this.CodeClient(link.DBConnection, link.DBType))
{
//获取数据id
var process = await client.Queryable<WFProcess>().FirstAsync(a => a.Id == processId);
WFInstanceInfo instanceInfo = null;
if (process != null)
{
// instanceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<WFInstanceInfo>(process.InstanceInfo);
instanceInfo = process.InstanceInfo;
}
DataTable dt = await db.Ado.GetDataTableAsync(string.Format(item.Sql), new { pkeyValue = instanceInfo.pkeyValue });
foreach (DataRow row in dt.Rows)
{
var userIdString = row[0].ToString();
if (!string.IsNullOrEmpty(userIdString))
{
var userIdList = userIdString.Split(",");
foreach (var userIdItem in userIdList)
{
userIds.Add(userIdItem);
}
}
}
}
}
break;
}
}
@ -2054,7 +2064,7 @@ namespace OpenAuth.App
ProcessUserName = iWFEngine.CreateUser.Name,
ProcessCode = iWFEngine.Config.Params.SchemeCode,
ProcessTitle = iWFEngine.Config.Params.Title,
IsRetract=0
IsRetract = 0
};
if (users[0].IsOvertimeMessage)
{
@ -2156,7 +2166,7 @@ namespace OpenAuth.App
ProcessUserName = iWFEngine.CreateUser.Name,
ProcessCode = iWFEngine.Config.Params.SchemeCode,
ProcessTitle = iWFEngine.Config.Params.Title,
IsRetract=0
IsRetract = 0
};
if (item.IsOvertimeMessage)
{
@ -2287,7 +2297,7 @@ namespace OpenAuth.App
/// <param name="iWFEngine"></param>
/// <param name="preTask"></param>
/// <returns></returns>
private async Task<bool> ExecuteScript(WFTask task, string code, string processId, string prevTaskId,string nextid, WFUserInfo createUser, IWFEngine iWFEngine, WFTask preTask,string des)
private async Task<bool> ExecuteScript(WFTask task, string code, string processId, string prevTaskId, string nextid, WFUserInfo createUser, IWFEngine iWFEngine, WFTask preTask, string des)
{
SysUser userInfo;
if (preTask == null)
@ -2316,8 +2326,8 @@ namespace OpenAuth.App
WFInstanceInfo instanceInfo = null;
if (process != null)
{
// instanceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<WFInstanceInfo>(process.InstanceInfo);
instanceInfo = process.InstanceInfo;
// instanceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<WFInstanceInfo>(process.InstanceInfo);
instanceInfo = process.InstanceInfo;
}
var param = new
@ -2333,9 +2343,9 @@ namespace OpenAuth.App
//companyId2 = userInfo.F_CompanyId,
//departmentId2 = userInfo.F_DepartmentId,
code,
nodeName=nextnode,
nodeName = nextnode,
pkeyValue = instanceInfo == null ? "" : instanceInfo.pkeyValue,
des=des
des = des
};
try
{
@ -2622,7 +2632,7 @@ namespace OpenAuth.App
var scriptTaskList = myTaskList.FindAll(t => t.Type == 10);
foreach (var item in scriptTaskList)
{
await ExecuteScript(item, code, taskEntity.ProcessId, taskEntity.Id, nextId, iWFEngine.CreateUser, iWFEngine, taskEntity,des);
await ExecuteScript(item, code, taskEntity.ProcessId, taskEntity.Id, nextId, iWFEngine.CreateUser, iWFEngine, taskEntity, des);
}
}
@ -2690,7 +2700,7 @@ namespace OpenAuth.App
var scriptTaskList = myTaskList.FindAll(t => t.Type == 10);
foreach (var item in scriptTaskList)
{
await ExecuteScript(item, code, processId, taskEntity.Id, nextId, iWFEngine.CreateUser, iWFEngine, taskEntity,"");
await ExecuteScript(item, code, processId, taskEntity.Id, nextId, iWFEngine.CreateUser, iWFEngine, taskEntity, "");
}
}
@ -2934,10 +2944,10 @@ namespace OpenAuth.App
#endregion
public async Task<Response<bool>> Supervise(string processId,int supervise = 1)
public async Task<Response<bool>> Supervise(string processId, int supervise = 1)
{
// todo 实现督办
var iWFEngine = await Bootstraper(string.Empty, processId, null, null);
// 获取未完成的任务
var taskList = await GetUnFinishTaskList(processId);
@ -2946,9 +2956,9 @@ namespace OpenAuth.App
foreach (var item in taskList)
{
if (item.Type == 1 || item.Type == 3 || item.Type == 5 || item.Type == 6 || item.Type == 7)
if (item.Type == 1 || item.Type == 3 || item.Type == 5 || item.Type == 6 || item.Type == 7)
{
// 督办时间督办标志
item.IsSupervise = supervise;
item.SuperviseTime = DateTime.Now;
@ -3013,9 +3023,9 @@ namespace OpenAuth.App
{
throw (new Exception("找不到对应流程任务!"));
}
else if (taskEntiy.State != 3&& taskEntiy.State != 4)
else if (taskEntiy.State != 3 && taskEntiy.State != 4)
{
throw (new Exception("该任务未完成!"));
throw (new Exception("该任务未完成!"));
}
//后期改
@ -3064,11 +3074,11 @@ namespace OpenAuth.App
//修改原有任务的IsLast状态
await client.Updateable<WFTask>()
.SetColumns(t => new WFTask() { IsLast = 0 })
.Where(t => t.Id==taskEntity.Id)
.Where(t => t.Id == taskEntity.Id)
.ExecuteCommandAsync();
//删除该节点之后生成的所有任务
var dellist=client.Queryable<WFTask>().Where(r=>r.CreateDate>taskEntity.CreateDate&&r.ProcessId==taskEntity.ProcessId).ToList();
var dellist = client.Queryable<WFTask>().Where(r => r.CreateDate > taskEntity.CreateDate && r.ProcessId == taskEntity.ProcessId).ToList();
await client.Deleteable<WFTask>(dellist).ExecuteCommandAsync();
// 处理任务并更新数据
using (var uwo = UnitWork.CreateContext())
@ -3076,7 +3086,7 @@ namespace OpenAuth.App
var process = await uwo.WFProcess.GetByIdAsync(taskEntity.ProcessId);
await uwo.Db.Updateable<WFProcess>()
.SetColumns(p => new WFProcess { IsStart = 1, IsCancel = 0 })
.SetColumns(p=>p.IsFinished==0)
.SetColumns(p => p.IsFinished == 0)
.SetColumnsIF(taskList.FindIndex(t => t.Type == 100) != -1, p => p.IsFinished == 1)
.SetColumnsIF(taskList.FindIndex(t => t.Type == 4) != -1, p => p.IsAgain == 1)
.Where(p => p.Id == taskEntity.ProcessId)
@ -3122,8 +3132,8 @@ namespace OpenAuth.App
CreateDate = DateTime.Now,
CreateUserId = _auth.GetUserId(),
CreateUserName = _auth.GetUserName(),
IsLast=1,
IsRetract=1
IsLast = 1,
IsRetract = 1
};
await uwo.WFTask.InsertAsync(newTask);

@ -1,10 +1,12 @@
using ce.autofac.extension;
using Infrastructure.Helpers;
using Microsoft.Extensions.Configuration;
using OpenAuth.Auth.Interface;
using SqlSugar;
namespace OpenAuth.BaseApp
{
public abstract class SqlSugarBaseApp<T, TDbContext>:BLL
public abstract class SqlSugarBaseApp<T, TDbContext> : BLL
where T : class, new()
where TDbContext : SugarUnitOfWork, new()
{
@ -28,7 +30,58 @@ namespace OpenAuth.BaseApp
_auth = auth;
}
public SqlSugarClient CodeClient(string dbConnectionString, string dbType = "PostgreSQL")
{
if (string.IsNullOrEmpty(dbConnectionString))
{
dbConnectionString = UnitWork.Db.CurrentConnectionConfig.ConnectionString;
}
return new SqlSugarClient(new ConnectionConfig()
{
DbType = GetDbType(dbType),
ConnectionString = dbConnectionString,
IsAutoCloseConnection = true,
MoreSettings = new SqlSugar.ConnMoreSettings()
{
IsAutoToUpper = false,
DatabaseModel = DbType.PostgreSQL
}
},
db =>
{
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (sql, pars) =>
{
//Console.WriteLine(sql + "\r\n" +
//db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
//Console.WriteLine();
};
});
}
public static DbType GetDbType(string dbtype)
{
switch (dbtype)
{
case "SqlServer":
return DbType.SqlServer;
case "Oracle":
return DbType.Oracle;
case "MySql":
return DbType.MySql;
case "PostgreSQL":
return DbType.PostgreSQL;
case "Dameng":
return DbType.Dm;//达梦
case "Kdbndp":
return DbType.Kdbndp;//人大金仓
case "Sqlite":
return DbType.Sqlite;//Sqlite
default:
return DbType.MySql;
}
}
}
}

@ -1,19 +1,13 @@
using DocumentFormat.OpenXml.Spreadsheet;
using Flurl.Http.Content;
using Infrastructure;
using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NetTaste;
using NPOI.SS.Formula.Functions;
using OpenAuth.App.FormModule;
using OpenAuth.App.FormModule.Request;
using OpenAuth.App.FormScheme;
using OpenAuth.App.FormScheme.Request;
using OpenAuth.App.Request;
using OpenAuth.Repository.Domain;
using Org.BouncyCastle.Asn1.Ocsp;
using SqlSugar;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

Loading…
Cancel
Save