mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-11-03 00:53:59 +08:00
历史数据库选择为sqlite时查询转换日期错误
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -363,6 +363,7 @@ MigrationBackup/
|
||||
FodyWeavers.xsd
|
||||
|
||||
/src/ThingsGateway.Web.Server/Default.db
|
||||
/src/ThingsGateway.Web.Server/Alarm_history.db
|
||||
/src/PluginPro*/
|
||||
/src/*Pro*
|
||||
/src/TestResults*/
|
||||
|
||||
@@ -5,7 +5,6 @@ using Furion.Logging.Extensions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
@@ -102,8 +101,11 @@ public class AlarmHostService : BackgroundService, ISingleton
|
||||
{
|
||||
SqlServerCodeFirstNvarchar = true,//设置默认nvarchar
|
||||
TableEnumIsString = true,
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return OperResult.CreateSuccessResult(sqlSugarClient);
|
||||
}
|
||||
#region worker服务
|
||||
|
||||
@@ -146,8 +146,8 @@
|
||||
var data = await result.Content.CopyNew().Queryable<AlarmHis>()
|
||||
.WhereIF(!input.DeviceName.IsNullOrEmpty(), a => a.DeviceName.Contains(input.DeviceName))
|
||||
.WhereIF(!input.Name.IsNullOrEmpty(), a => a.Name.Contains(input.Name))
|
||||
.WhereIF(input.StartTime != null, a => a.EventTime >= input.StartTime)
|
||||
.WhereIF(input.EndTime != null, a => a.EventTime <= input.EndTime)
|
||||
.WhereIF(input.StartTime != null, a => a.EventTime >= input.StartTime.Value)
|
||||
.WhereIF(input.EndTime != null, a => a.EventTime <= input.EndTime.Value)
|
||||
.OrderByIF(!string.IsNullOrEmpty(input.SortField), $"{input.SortField} {input.SortOrder}")
|
||||
.OrderBy(u => u.Id)//排序
|
||||
.ToPagedListAsync(input.Current, input.Size);
|
||||
|
||||
Reference in New Issue
Block a user