mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
fix: orm批量插入
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.7" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="9.11.0" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="9.11.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -8,6 +8,8 @@
|
||||
// QQ群:605534569
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using ThingsGateway.NewLife;
|
||||
|
||||
namespace ThingsGateway;
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -38,10 +40,8 @@ public static class PathExtensions
|
||||
path = Path.Combine(path, text);
|
||||
}
|
||||
}
|
||||
// 处理路径分隔符,兼容Windows和Linux
|
||||
var sep = Path.DirectorySeparatorChar;
|
||||
var sep2 = sep == '/' ? '\\' : '/';
|
||||
path = path.Replace(sep2, sep);
|
||||
|
||||
path = path.Replace('\\', '/');
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ namespace ThingsGateway.SqlSugar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 逐行读取,包含空行
|
||||
/// 逐行读取
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <returns></returns>
|
||||
@@ -35,7 +35,8 @@ namespace ThingsGateway.SqlSugar
|
||||
string line = sr.ReadLine();
|
||||
while (line != null)
|
||||
{
|
||||
yield return sr.ReadLine();
|
||||
yield return line;
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -263,7 +263,7 @@ namespace ThingsGateway.SqlSugar
|
||||
IFastBuilder buider = GetBuider();
|
||||
buider.Context = context;
|
||||
int result = 0;
|
||||
if (buider?.DbFastestProperties?.IsDataTable == true)
|
||||
if (buider?.DbFastestProperties?.IsDataTable != false)
|
||||
{
|
||||
var dt = ToDdateTable(datas);
|
||||
if (buider?.DbFastestProperties?.IsMerge == true)
|
||||
@@ -400,7 +400,7 @@ namespace ThingsGateway.SqlSugar
|
||||
int result = 0;
|
||||
IFastBuilder buider = GetBuider();
|
||||
buider.Context = context;
|
||||
if (buider?.DbFastestProperties?.IsDataTable == true)
|
||||
if (buider?.DbFastestProperties?.IsDataTable != false)
|
||||
{
|
||||
DataTable dt = ToDdateTable(datas);
|
||||
|
||||
@@ -578,7 +578,7 @@ namespace ThingsGateway.SqlSugar
|
||||
IFastBuilder buider = GetBuider();
|
||||
buider.Context = context;
|
||||
int result = 0;
|
||||
if (buider?.DbFastestProperties?.IsDataTable == true)
|
||||
if (buider?.DbFastestProperties?.IsDataTable != false)
|
||||
{
|
||||
DataTable dt = ToDdateTable(datas);
|
||||
result = await buider.ExecuteBulkCopyAsync(dt).ConfigureAwait(false);
|
||||
|
@@ -1,17 +1,17 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.11.87</PluginVersion>
|
||||
<ProPluginVersion>10.11.87</ProPluginVersion>
|
||||
<DefaultVersion>10.11.87</DefaultVersion>
|
||||
<PluginVersion>10.11.90</PluginVersion>
|
||||
<ProPluginVersion>10.11.90</ProPluginVersion>
|
||||
<DefaultVersion>10.11.90</DefaultVersion>
|
||||
<AuthenticationVersion>10.11.6</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.11.6</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.20</NET8Version>
|
||||
<NET10Version>10.0.0-rc.1.25451.107</NET10Version>
|
||||
<SatelliteResourceLanguages>zh-Hans;en-US</SatelliteResourceLanguages>
|
||||
<IsTrimmable>false</IsTrimmable>
|
||||
<ManagementProPluginVersion>10.11.70</ManagementProPluginVersion>
|
||||
<ManagementPluginVersion>10.11.70</ManagementPluginVersion>
|
||||
<ManagementProPluginVersion>10.11.87</ManagementProPluginVersion>
|
||||
<ManagementPluginVersion>10.11.87</ManagementPluginVersion>
|
||||
<TSVersion>4.0.0-beta.96</TSVersion>
|
||||
|
||||
|
||||
|
@@ -45,7 +45,7 @@ public static class LoggerExtensions
|
||||
/// </summary>
|
||||
public static string GetDebugLogBasePath()
|
||||
{
|
||||
return "Logs/DebugLog";
|
||||
return PathExtensions.CombinePathWithOs("Logs", "DebugLog");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,7 +55,7 @@ public static class LoggerExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetDebugLogPath(this long channelId)
|
||||
{
|
||||
return GetDebugLogBasePath().CombinePath(channelId.ToString());
|
||||
return GetDebugLogBasePath().CombinePathWithOs(channelId.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -65,7 +65,7 @@ public static class LoggerExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetDebugLogPath(this string channelId)
|
||||
{
|
||||
return GetDebugLogBasePath().CombinePath(channelId.SanitizeFileName());
|
||||
return GetDebugLogBasePath().CombinePathWithOs(channelId.SanitizeFileName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,7 +73,7 @@ public static class LoggerExtensions
|
||||
/// </summary>
|
||||
public static string GetChannelLogBasePath()
|
||||
{
|
||||
return "Logs/ChannelLog";
|
||||
return PathExtensions.CombinePathWithOs("Logs", "ChannelLog");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -83,7 +83,7 @@ public static class LoggerExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetChannelLogPath(this long channelId)
|
||||
{
|
||||
return GetChannelLogBasePath().CombinePath(channelId.ToString());
|
||||
return GetChannelLogBasePath().CombinePathWithOs(channelId.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取日志路径
|
||||
@@ -92,7 +92,7 @@ public static class LoggerExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetChannelLogPath(this string channelId)
|
||||
{
|
||||
return GetChannelLogBasePath().CombinePath(channelId.SanitizeFileName());
|
||||
return GetChannelLogBasePath().CombinePathWithOs(channelId.SanitizeFileName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,7 +100,7 @@ public static class LoggerExtensions
|
||||
/// </summary>
|
||||
public static string GetDeviceLogBasePath()
|
||||
{
|
||||
return "Logs/DeviceLog";
|
||||
return PathExtensions.CombinePathWithOs("Logs","DeviceLog");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -110,7 +110,7 @@ public static class LoggerExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetDeviceLogPath(this long DeviceId)
|
||||
{
|
||||
return GetDeviceLogBasePath().CombinePath(DeviceId.ToString());
|
||||
return GetDeviceLogBasePath().CombinePathWithOs(DeviceId.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取日志路径
|
||||
@@ -119,7 +119,7 @@ public static class LoggerExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetDeviceLogPath(this string DeviceId)
|
||||
{
|
||||
return GetDeviceLogBasePath().CombinePath(DeviceId.SanitizeFileName());
|
||||
return GetDeviceLogBasePath().CombinePathWithOs(DeviceId.SanitizeFileName());
|
||||
}
|
||||
|
||||
#region 日志
|
||||
|
@@ -63,11 +63,12 @@ public static class TextFileReader
|
||||
public static OperResult<List<string>> GetLogFiles(string directoryPath)
|
||||
{
|
||||
OperResult<List<string>> result = new(); // 初始化结果对象
|
||||
directoryPath = AppContext.BaseDirectory.CombinePath(directoryPath);
|
||||
// 检查目录是否存在
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
result.OperCode = 999;
|
||||
result.ErrorMessage = "Directory not exists";
|
||||
result.ErrorMessage = $"Directory {directoryPath} not exists";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -29,11 +29,17 @@ public sealed class ReusableCancellationTokenSource : IDisposable
|
||||
|
||||
private void OnTimeout(object? state)
|
||||
{
|
||||
TimeoutStatus = true;
|
||||
try
|
||||
{
|
||||
TimeoutStatus = true;
|
||||
|
||||
if (_cts?.IsCancellationRequested == false)
|
||||
_cts?.Cancel();
|
||||
if (_cts?.IsCancellationRequested == false)
|
||||
_cts?.Cancel();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private readonly LinkedCancellationTokenSourceCache _linkedCtsCache = new();
|
||||
|
@@ -1423,7 +1423,6 @@ EventCallback.Factory.Create<MouseEventArgs>(this, async e =>
|
||||
{
|
||||
await ChannelDeviceChanged.Invoke(Value);
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj">
|
||||
</ProjectReference>
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.11.1" GeneratePathProperty="true">
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.12.0" GeneratePathProperty="true">
|
||||
<PrivateAssets>contentFiles;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
Reference in New Issue
Block a user