From 10a1205cf7d165e670768919f73b0da4efa23302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Fri, 16 Feb 2024 16:57:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E5=AD=97=E5=9E=8B=E4=B8=BB=E9=94=AE?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=BB=E9=94=AE=E9=99=8D=E5=BA=8F?= =?UTF-8?q?=EF=BC=8C=E8=B5=8B=E5=80=BC=E7=BB=99OrderBy=E3=80=82=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E7=94=A8=E6=88=B7=E4=BB=A3=E7=A0=81=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8E=92=E5=BA=8F=E6=97=B6=E8=B5=8B=E5=80=BC=E7=BB=99?= =?UTF-8?q?Sort=EF=BC=8C=E4=BC=9A=E8=87=AA=E5=8A=A8=E6=B8=85=E7=A9=BAOrder?= =?UTF-8?q?By=E3=80=82=E6=8E=A8=E8=8D=90=E7=94=A8=E6=88=B7=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8E=92=E5=BA=8F=E8=B5=8B=E5=80=BC=E7=BB=99?= =?UTF-8?q?OrderBy=EF=BC=8C=E5=AE=83=E6=9C=89=E6=9B=B4=E9=AB=98=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CubeSSO/CubeSSO.csproj | 2 +- NewLife.Cube/Common/ReadOnlyEntityController.cs | 7 ++++--- NewLife.Cube/Extensions/Pager.cs | 2 +- NewLife.Cube/NewLife.Cube.csproj | 4 ++-- NewLife.CubeNC/Common/ReadOnlyEntityController.cs | 7 ++++--- NewLife.CubeNC/NewLife.CubeNC.csproj | 4 ++-- NewLife.CubeNC/Services/JobService.cs | 2 +- Test/Test.csproj | 2 +- XUnitTest/XUnitTest.csproj | 4 ++-- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CubeSSO/CubeSSO.csproj b/CubeSSO/CubeSSO.csproj index bbdb8482..c46e3fbb 100644 --- a/CubeSSO/CubeSSO.csproj +++ b/CubeSSO/CubeSSO.csproj @@ -23,7 +23,7 @@ - + diff --git a/NewLife.Cube/Common/ReadOnlyEntityController.cs b/NewLife.Cube/Common/ReadOnlyEntityController.cs index 2de0ceb2..14b1a3f0 100644 --- a/NewLife.Cube/Common/ReadOnlyEntityController.cs +++ b/NewLife.Cube/Common/ReadOnlyEntityController.cs @@ -151,13 +151,14 @@ protected virtual IEnumerable SearchData(Pager p) } // 数字型主键,默认降序 - if (p.Sort.IsNullOrEmpty()) + if (p.Sort.IsNullOrEmpty() && p.OrderBy.IsNullOrEmpty()) { var uk = Factory.Unique; if (uk != null && uk.Type.IsInt()) { - p.Sort = uk.Name; - p.Desc = true; + p.OrderBy = uk.Desc(); + //p.Sort = uk.Name; + //p.Desc = true; } } diff --git a/NewLife.Cube/Extensions/Pager.cs b/NewLife.Cube/Extensions/Pager.cs index 3a781141..3a5fe43a 100644 --- a/NewLife.Cube/Extensions/Pager.cs +++ b/NewLife.Cube/Extensions/Pager.cs @@ -110,7 +110,7 @@ public Pager(IDictionary parameters) if (parameters.TryGetValue(nameof(Desc), out str)) Desc = str.ToBoolean(); if (parameters.TryGetValue(nameof(StartRow), out str)) StartRow = str.ToLong(); if (parameters.TryGetValue(nameof(Sort), out str)) Sort = str; - if (parameters.TryGetValue(nameof(OrderBy), out str)) OrderBy = str; + //if (parameters.TryGetValue(nameof(OrderBy), out str)) OrderBy = str; Params = parameters; } diff --git a/NewLife.Cube/NewLife.Cube.csproj b/NewLife.Cube/NewLife.Cube.csproj index a33109f2..5b3aac09 100644 --- a/NewLife.Cube/NewLife.Cube.csproj +++ b/NewLife.Cube/NewLife.Cube.csproj @@ -90,11 +90,11 @@ - + - + diff --git a/NewLife.CubeNC/Common/ReadOnlyEntityController.cs b/NewLife.CubeNC/Common/ReadOnlyEntityController.cs index b779099e..b6e142de 100644 --- a/NewLife.CubeNC/Common/ReadOnlyEntityController.cs +++ b/NewLife.CubeNC/Common/ReadOnlyEntityController.cs @@ -165,13 +165,14 @@ protected virtual IEnumerable SearchData(Pager p) } // 数字型主键,默认降序 - if (p.Sort.IsNullOrEmpty()) + if (p.Sort.IsNullOrEmpty() && p.OrderBy.IsNullOrEmpty()) { var uk = Factory.Unique; if (uk != null && uk.Type.IsInt()) { - p.Sort = uk.Name; - p.Desc = true; + p.OrderBy = uk.Desc(); + //p.Sort = uk.Name; + //p.Desc = true; } } diff --git a/NewLife.CubeNC/NewLife.CubeNC.csproj b/NewLife.CubeNC/NewLife.CubeNC.csproj index 55f1217f..5ef498da 100644 --- a/NewLife.CubeNC/NewLife.CubeNC.csproj +++ b/NewLife.CubeNC/NewLife.CubeNC.csproj @@ -50,10 +50,10 @@ - + - + diff --git a/NewLife.CubeNC/Services/JobService.cs b/NewLife.CubeNC/Services/JobService.cs index 44d6f1c8..2ca72cdd 100644 --- a/NewLife.CubeNC/Services/JobService.cs +++ b/NewLife.CubeNC/Services/JobService.cs @@ -40,7 +40,7 @@ public JobService(IServiceProvider serviceProvider, ITracer tracer) /// public Task StartAsync(CancellationToken cancellationToken) { - _timer = new TimerX(DoJob, null, 1_000, 600_000); + _timer = new TimerX(DoJob, null, 1_000, 600_000) { Async = true }; return Task.CompletedTask; } diff --git a/Test/Test.csproj b/Test/Test.csproj index fffb74ab..9cf64108 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -17,6 +17,6 @@ - + \ No newline at end of file diff --git a/XUnitTest/XUnitTest.csproj b/XUnitTest/XUnitTest.csproj index 2c0e59f1..85b4c58f 100644 --- a/XUnitTest/XUnitTest.csproj +++ b/XUnitTest/XUnitTest.csproj @@ -8,8 +8,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all