Commit df772f7e by Licx

数据库连接方式修改(提取数据)

parent 33f085c7
......@@ -429,13 +429,9 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
execsql = Regex.Replace(execsql, item.Key, item.Value, RegexOptions.IgnoreCase);
}
IDbConnection connection = null;
using IDbConnection connection = ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword);
try
{
if (!pools.ContainsKey(config.Id))
pools.Add(config.Id, ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword));
connection = pools[config.Id];
if (connection == null) return Enumerable.Empty<T>();
if (connection.State != ConnectionState.Open)
......@@ -444,8 +440,8 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
catch
{
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
throw;
}
try
{
logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment