From a3f172c9bbb252df37aa3dcfca6eaa8839123d5f Mon Sep 17 00:00:00 2001 From: lxw Date: Wed, 5 Jun 2024 20:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80Page=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E5=92=8C=E5=87=BA=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Base/SqlSugarPagedList.cs | 157 ------ Entity/Dto/Req/BasePageReq.cs | 34 -- Entity/Dto/Req/ConfigReq.cs | 4 +- Entity/Dto/Req/EquipInfoReq.cs | 4 +- Entity/Entity.csproj | 6 + .../net6.0/HybirdFrameworkCore.deps.json | 482 ------------------ .../HybirdFrameworkCore.GlobalUsings.g.cs | 8 - Repository/RepositoryExtension.cs | 75 +-- Service/Station/EquipInfoService.cs | 12 +- Service/System/SysConfigService.cs | 13 +- .../Station/EquipInfoController.cs | 2 +- .../Controllers/System/SysConfigController.cs | 3 +- WebStarter/bin/Debug/net6.0/log4net.config | 171 ++++++- 13 files changed, 230 insertions(+), 741 deletions(-) delete mode 100644 Entity/Base/SqlSugarPagedList.cs delete mode 100644 Entity/Dto/Req/BasePageReq.cs delete mode 100644 HybirdFrameworkCore/bin/Debug/net6.0/HybirdFrameworkCore.deps.json delete mode 100644 HybirdFrameworkCore/obj/Debug/net6.0/HybirdFrameworkCore.GlobalUsings.g.cs diff --git a/Entity/Base/SqlSugarPagedList.cs b/Entity/Base/SqlSugarPagedList.cs deleted file mode 100644 index 89fa8ba..0000000 --- a/Entity/Base/SqlSugarPagedList.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System.Linq.Expressions; -using SqlSugar; - -namespace Entity.Base -{ - /// - /// 分页泛型集合 - /// - /// - public class SqlSugarPagedList - { - /// - /// 页码 - /// - public int Page { get; set; } - - /// - /// 页容量 - /// - public int PageSize { get; set; } - - /// - /// 总条数 - /// - public int Total { get; set; } - - /// - /// 总页数 - /// - public int TotalPages { get; set; } - - /// - /// 当前页集合 - /// - public IEnumerable Items { get; set; } - - /// - /// 是否有上一页 - /// - public bool HasPrevPage { get; set; } - - /// - /// 是否有下一页 - /// - public bool HasNextPage { get; set; } - } - - /// - /// 分页拓展类 - /// - public static class SqlSugarPagedExtensions - { - /// - /// 分页拓展 - /// - /// 对象 - /// 当前页码,从1开始 - /// 页码容量 - /// 查询结果 Select 表达式 - /// - public static SqlSugarPagedList ToPagedList(this ISugarQueryable query, - int pageIndex, int pageSize, - Expression> expression) - { - var total = 0; - var items = query.ToPageList(pageIndex, pageSize, ref total, expression); - return CreateSqlSugarPagedList(items, total, pageIndex, pageSize); - } - - /// - /// 分页拓展 - /// - /// 对象 - /// 当前页码,从1开始 - /// 页码容量 - /// - public static SqlSugarPagedList ToPagedList(this ISugarQueryable query, - int pageIndex, int pageSize) - { - var total = 0; - var items = query.ToPageList(pageIndex, pageSize, ref total); - return CreateSqlSugarPagedList(items, total, pageIndex, pageSize); - } - - /// - /// 分页拓展 - /// - /// 对象 - /// 当前页码,从1开始 - /// 页码容量 - /// 查询结果 Select 表达式 - /// - public static async Task> ToPagedListAsync( - this ISugarQueryable query, int pageIndex, int pageSize, - Expression> expression) - { - RefAsync total = 0; - var items = await query.ToPageListAsync(pageIndex, pageSize, total, expression); - return CreateSqlSugarPagedList(items, total, pageIndex, pageSize); - } - - /// - /// 分页拓展 - /// - /// 对象 - /// 当前页码,从1开始 - /// 页码容量 - /// - public static async Task> ToPagedListAsync( - this ISugarQueryable query, int pageIndex, int pageSize) - { - RefAsync total = 0; - var items = await query.ToPageListAsync(pageIndex, pageSize, total); - return CreateSqlSugarPagedList(items, total, pageIndex, pageSize); - } - - /// - /// 分页拓展 - /// - /// 集合对象 - /// 当前页码,从1开始 - /// 页码容量 - /// - public static SqlSugarPagedList ToPagedList(this IEnumerable list, int pageIndex, - int pageSize) - { - var total = list.Count(); - var items = list.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); - return CreateSqlSugarPagedList(items, total, pageIndex, pageSize); - } - - /// - /// 创建 对象 - /// - /// - /// 分页内容的对象集合 - /// 总条数 - /// 当前页码,从1开始 - /// 页码容量 - /// - public static SqlSugarPagedList CreateSqlSugarPagedList(IEnumerable items, int total, - int pageIndex, int pageSize) - { - var totalPages = pageSize > 0 ? (int)Math.Ceiling(total / (double)pageSize) : 0; - return new SqlSugarPagedList - { - Page = pageIndex, - PageSize = pageSize, - Items = items, - Total = total, - TotalPages = totalPages, - HasNextPage = pageIndex < totalPages, - HasPrevPage = pageIndex - 1 > 0 - }; - } - } -} \ No newline at end of file diff --git a/Entity/Dto/Req/BasePageReq.cs b/Entity/Dto/Req/BasePageReq.cs deleted file mode 100644 index 49a46e8..0000000 --- a/Entity/Dto/Req/BasePageReq.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace Entity.Dto.Req -{ - /// - /// 全局分页查询输入参数 - /// - public class BasePageReq - { - /// - /// 当前页码 - /// - public virtual int Page { get; set; } = 1; - - /// - /// 页码容量 - /// - //[Range(0, 100, ErrorMessage = "页码容量超过最大限制")] - public virtual int PageSize { get; set; } = 20; - - /// - /// 排序字段 - /// - public virtual string Field { get; set; } = ""; - - /// - /// 排序方向 - /// - public virtual string OrderDirection { get; set; } = "Desc"; - - /// - /// 降序排序 - /// - public virtual string DescStr { get; set; } = "descending"; - } -} diff --git a/Entity/Dto/Req/ConfigReq.cs b/Entity/Dto/Req/ConfigReq.cs index d870864..bdf33e4 100644 --- a/Entity/Dto/Req/ConfigReq.cs +++ b/Entity/Dto/Req/ConfigReq.cs @@ -1,12 +1,12 @@ using Entity.DbModel.System; - +using HybirdFrameworkCore.Entity; namespace Entity.Dto.Req { public class ConfigReq : BaseIdReq { } - public class PageConfigReq : BasePageReq + public class PageConfigReq : QueryPageModel { /// /// 名称 diff --git a/Entity/Dto/Req/EquipInfoReq.cs b/Entity/Dto/Req/EquipInfoReq.cs index cf10789..177529a 100644 --- a/Entity/Dto/Req/EquipInfoReq.cs +++ b/Entity/Dto/Req/EquipInfoReq.cs @@ -1,12 +1,12 @@ using Entity.DbModel.Station; - +using HybirdFrameworkCore.Entity; namespace Entity.Dto.Req; public class EquipInfoReq : BaseIdReq { } -public class PageEquipInfoReq : BasePageReq +public class PageEquipInfoReq : QueryPageModel { /// /// 名称 diff --git a/Entity/Entity.csproj b/Entity/Entity.csproj index 5d0e97f..81e88f7 100644 --- a/Entity/Entity.csproj +++ b/Entity/Entity.csproj @@ -25,4 +25,10 @@ + + + ..\Common\lib\HybirdFrameworkCore.dll + + + diff --git a/HybirdFrameworkCore/bin/Debug/net6.0/HybirdFrameworkCore.deps.json b/HybirdFrameworkCore/bin/Debug/net6.0/HybirdFrameworkCore.deps.json deleted file mode 100644 index 7a1223c..0000000 --- a/HybirdFrameworkCore/bin/Debug/net6.0/HybirdFrameworkCore.deps.json +++ /dev/null @@ -1,482 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v6.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v6.0": { - "HybirdFrameworkCore/1.0.0": { - "dependencies": { - "AutoMapper": "12.0.1", - "Autofac": "7.0.1", - "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", - "Microsoft.Extensions.Configuration.Json": "7.0.0", - "Newtonsoft.Json": "13.0.3", - "StackExchange.Redis": "2.7.33", - "log4net": "2.0.15" - }, - "runtime": { - "HybirdFrameworkCore.dll": {} - } - }, - "Autofac/7.0.1": { - "dependencies": { - "System.Diagnostics.DiagnosticSource": "4.7.1" - }, - "runtime": { - "lib/net6.0/Autofac.dll": { - "assemblyVersion": "7.0.1.0", - "fileVersion": "7.0.1.0" - } - } - }, - "AutoMapper/12.0.1": { - "dependencies": { - "Microsoft.CSharp": "4.7.0" - }, - "runtime": { - "lib/netstandard2.1/AutoMapper.dll": { - "assemblyVersion": "12.0.0.0", - "fileVersion": "12.0.1.0" - } - } - }, - "log4net/2.0.15": { - "dependencies": { - "System.Configuration.ConfigurationManager": "4.5.0" - }, - "runtime": { - "lib/netstandard2.0/log4net.dll": { - "assemblyVersion": "2.0.15.0", - "fileVersion": "2.0.15.0" - } - } - }, - "Microsoft.CSharp/4.7.0": {}, - "Microsoft.Extensions.Configuration/7.0.0": { - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", - "Microsoft.Extensions.Primitives": "7.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.Configuration.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.Configuration.Abstractions/7.0.0": { - "dependencies": { - "Microsoft.Extensions.Primitives": "7.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.Configuration.Abstractions.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.Configuration.FileExtensions/7.0.0": { - "dependencies": { - "Microsoft.Extensions.Configuration": "7.0.0", - "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", - "Microsoft.Extensions.FileProviders.Abstractions": "7.0.0", - "Microsoft.Extensions.FileProviders.Physical": "7.0.0", - "Microsoft.Extensions.Primitives": "7.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.Configuration.FileExtensions.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.Configuration.Json/7.0.0": { - "dependencies": { - "Microsoft.Extensions.Configuration": "7.0.0", - "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", - "Microsoft.Extensions.Configuration.FileExtensions": "7.0.0", - "Microsoft.Extensions.FileProviders.Abstractions": "7.0.0", - "System.Text.Json": "7.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.Configuration.Json.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.FileProviders.Abstractions/7.0.0": { - "dependencies": { - "Microsoft.Extensions.Primitives": "7.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.FileProviders.Abstractions.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.FileProviders.Physical/7.0.0": { - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "7.0.0", - "Microsoft.Extensions.FileSystemGlobbing": "7.0.0", - "Microsoft.Extensions.Primitives": "7.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.FileProviders.Physical.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.FileSystemGlobbing/7.0.0": { - "runtime": { - "lib/net6.0/Microsoft.Extensions.FileSystemGlobbing.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.Extensions.Logging.Abstractions/6.0.0": { - "runtime": { - "lib/net6.0/Microsoft.Extensions.Logging.Abstractions.dll": { - "assemblyVersion": "6.0.0.0", - "fileVersion": "6.0.21.52210" - } - } - }, - "Microsoft.Extensions.Primitives/7.0.0": { - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - }, - "runtime": { - "lib/net6.0/Microsoft.Extensions.Primitives.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "Microsoft.NETCore.Platforms/2.0.0": {}, - "Newtonsoft.Json/13.0.3": { - "runtime": { - "lib/net6.0/Newtonsoft.Json.dll": { - "assemblyVersion": "13.0.0.0", - "fileVersion": "13.0.3.27908" - } - } - }, - "Pipelines.Sockets.Unofficial/2.2.8": { - "dependencies": { - "System.IO.Pipelines": "5.0.1" - }, - "runtime": { - "lib/net5.0/Pipelines.Sockets.Unofficial.dll": { - "assemblyVersion": "1.0.0.0", - "fileVersion": "2.2.8.1080" - } - } - }, - "StackExchange.Redis/2.7.33": { - "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Pipelines.Sockets.Unofficial": "2.2.8" - }, - "runtime": { - "lib/net6.0/StackExchange.Redis.dll": { - "assemblyVersion": "2.0.0.0", - "fileVersion": "2.7.33.41805" - } - } - }, - "System.Configuration.ConfigurationManager/4.5.0": { - "dependencies": { - "System.Security.Cryptography.ProtectedData": "4.5.0", - "System.Security.Permissions": "4.5.0" - }, - "runtime": { - "lib/netstandard2.0/System.Configuration.ConfigurationManager.dll": { - "assemblyVersion": "4.0.1.0", - "fileVersion": "4.6.26515.6" - } - } - }, - "System.Diagnostics.DiagnosticSource/4.7.1": {}, - "System.IO.Pipelines/5.0.1": { - "runtime": { - "lib/netcoreapp3.0/System.IO.Pipelines.dll": { - "assemblyVersion": "5.0.0.1", - "fileVersion": "5.0.120.57516" - } - } - }, - "System.Runtime.CompilerServices.Unsafe/6.0.0": {}, - "System.Security.AccessControl/4.5.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.0.0", - "System.Security.Principal.Windows": "4.5.0" - } - }, - "System.Security.Cryptography.ProtectedData/4.5.0": { - "runtime": { - "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { - "assemblyVersion": "4.0.3.0", - "fileVersion": "4.6.26515.6" - } - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { - "rid": "win", - "assetType": "runtime", - "assemblyVersion": "4.0.3.0", - "fileVersion": "4.6.26515.6" - } - } - }, - "System.Security.Permissions/4.5.0": { - "dependencies": { - "System.Security.AccessControl": "4.5.0" - }, - "runtime": { - "lib/netstandard2.0/System.Security.Permissions.dll": { - "assemblyVersion": "4.0.1.0", - "fileVersion": "4.6.26515.6" - } - } - }, - "System.Security.Principal.Windows/4.5.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.0.0" - } - }, - "System.Text.Encodings.Web/7.0.0": { - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - }, - "runtime": { - "lib/net6.0/System.Text.Encodings.Web.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - }, - "runtimeTargets": { - "runtimes/browser/lib/net6.0/System.Text.Encodings.Web.dll": { - "rid": "browser", - "assetType": "runtime", - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "System.Text.Json/7.0.0": { - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "7.0.0" - }, - "runtime": { - "lib/net6.0/System.Text.Json.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - } - } - }, - "libraries": { - "HybirdFrameworkCore/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Autofac/7.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-J9Iz0Q+YU3uf82i8Lee0NpQOlRYfwHxwVV26jdG3zH3LFE5Y9Rx97Mju7Nswwzh/C7kVJALkTL860Y7e+mcLaw==", - "path": "autofac/7.0.1", - "hashPath": "autofac.7.0.1.nupkg.sha512" - }, - "AutoMapper/12.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-hvV62vl6Hp/WfQ24yzo3Co9+OPl8wH8hApwVtgWpiAynVJkUcs7xvehnSftawL8Pe8FrPffBRM3hwzLQqWDNjA==", - "path": "automapper/12.0.1", - "hashPath": "automapper.12.0.1.nupkg.sha512" - }, - "log4net/2.0.15": { - "type": "package", - "serviceable": true, - "sha512": "sha512-GahnO9ZgFka+xYcFwAfIFjW+k86P2nxFoaEpH6t3v4hiGj7tv2ksVZphxCVIHmJxoySS0HeU3dgCW+bSCcfD0A==", - "path": "log4net/2.0.15", - "hashPath": "log4net.2.0.15.nupkg.sha512" - }, - "Microsoft.CSharp/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", - "path": "microsoft.csharp/4.7.0", - "hashPath": "microsoft.csharp.4.7.0.nupkg.sha512" - }, - "Microsoft.Extensions.Configuration/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-tldQUBWt/xeH2K7/hMPPo5g8zuLc3Ro9I5d4o/XrxvxOCA2EZBtW7bCHHTc49fcBtvB8tLAb/Qsmfrq+2SJ4vA==", - "path": "microsoft.extensions.configuration/7.0.0", - "hashPath": "microsoft.extensions.configuration.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.Configuration.Abstractions/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-f34u2eaqIjNO9YLHBz8rozVZ+TcFiFs0F3r7nUJd7FRkVSxk8u4OpoK226mi49MwexHOR2ibP9MFvRUaLilcQQ==", - "path": "microsoft.extensions.configuration.abstractions/7.0.0", - "hashPath": "microsoft.extensions.configuration.abstractions.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.Configuration.FileExtensions/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-xk2lRJ1RDuqe57BmgvRPyCt6zyePKUmvT6iuXqiHR+/OIIgWVR8Ff5k2p6DwmqY8a17hx/OnrekEhziEIeQP6Q==", - "path": "microsoft.extensions.configuration.fileextensions/7.0.0", - "hashPath": "microsoft.extensions.configuration.fileextensions.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.Configuration.Json/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-LDNYe3uw76W35Jci+be4LDf2lkQZe0A7EEYQVChFbc509CpZ4Iupod8li4PUXPBhEUOFI/rlQNf5xkzJRQGvtA==", - "path": "microsoft.extensions.configuration.json/7.0.0", - "hashPath": "microsoft.extensions.configuration.json.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.FileProviders.Abstractions/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-NyawiW9ZT/liQb34k9YqBSNPLuuPkrjMgQZ24Y/xXX1RoiBkLUdPMaQTmxhZ5TYu8ZKZ9qayzil75JX95vGQUg==", - "path": "microsoft.extensions.fileproviders.abstractions/7.0.0", - "hashPath": "microsoft.extensions.fileproviders.abstractions.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.FileProviders.Physical/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-K8D2MTR+EtzkbZ8z80LrG7Ur64R7ZZdRLt1J5cgpc/pUWl0C6IkAUapPuK28oionHueCPELUqq0oYEvZfalNdg==", - "path": "microsoft.extensions.fileproviders.physical/7.0.0", - "hashPath": "microsoft.extensions.fileproviders.physical.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.FileSystemGlobbing/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-2jONjKHiF+E92ynz2ZFcr9OvxIw+rTGMPEH+UZGeHTEComVav93jQUWGkso8yWwVBcEJGcNcZAaqY01FFJcj7w==", - "path": "microsoft.extensions.filesystemglobbing/7.0.0", - "hashPath": "microsoft.extensions.filesystemglobbing.7.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.Logging.Abstractions/6.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==", - "path": "microsoft.extensions.logging.abstractions/6.0.0", - "hashPath": "microsoft.extensions.logging.abstractions.6.0.0.nupkg.sha512" - }, - "Microsoft.Extensions.Primitives/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==", - "path": "microsoft.extensions.primitives/7.0.0", - "hashPath": "microsoft.extensions.primitives.7.0.0.nupkg.sha512" - }, - "Microsoft.NETCore.Platforms/2.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-VdLJOCXhZaEMY7Hm2GKiULmn7IEPFE4XC5LPSfBVCUIA8YLZVh846gtfBJalsPQF2PlzdD7ecX7DZEulJ402ZQ==", - "path": "microsoft.netcore.platforms/2.0.0", - "hashPath": "microsoft.netcore.platforms.2.0.0.nupkg.sha512" - }, - "Newtonsoft.Json/13.0.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", - "path": "newtonsoft.json/13.0.3", - "hashPath": "newtonsoft.json.13.0.3.nupkg.sha512" - }, - "Pipelines.Sockets.Unofficial/2.2.8": { - "type": "package", - "serviceable": true, - "sha512": "sha512-zG2FApP5zxSx6OcdJQLbZDk2AVlN2BNQD6MorwIfV6gVj0RRxWPEp2LXAxqDGZqeNV1Zp0BNPcNaey/GXmTdvQ==", - "path": "pipelines.sockets.unofficial/2.2.8", - "hashPath": "pipelines.sockets.unofficial.2.2.8.nupkg.sha512" - }, - "StackExchange.Redis/2.7.33": { - "type": "package", - "serviceable": true, - "sha512": "sha512-2kCX5fvhEE824a4Ab5Imyi8DRuGuTxyklXV01kegkRpsWJcPmO6+GAQ+HegKxvXAxlXZ8yaRspvWJ8t3mMClfQ==", - "path": "stackexchange.redis/2.7.33", - "hashPath": "stackexchange.redis.2.7.33.nupkg.sha512" - }, - "System.Configuration.ConfigurationManager/4.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-UIFvaFfuKhLr9u5tWMxmVoDPkFeD+Qv8gUuap4aZgVGYSYMdERck4OhLN/2gulAc0nYTEigWXSJNNWshrmxnng==", - "path": "system.configuration.configurationmanager/4.5.0", - "hashPath": "system.configuration.configurationmanager.4.5.0.nupkg.sha512" - }, - "System.Diagnostics.DiagnosticSource/4.7.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw==", - "path": "system.diagnostics.diagnosticsource/4.7.1", - "hashPath": "system.diagnostics.diagnosticsource.4.7.1.nupkg.sha512" - }, - "System.IO.Pipelines/5.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-qEePWsaq9LoEEIqhbGe6D5J8c9IqQOUuTzzV6wn1POlfdLkJliZY3OlB0j0f17uMWlqZYjH7txj+2YbyrIA8Yg==", - "path": "system.io.pipelines/5.0.1", - "hashPath": "system.io.pipelines.5.0.1.nupkg.sha512" - }, - "System.Runtime.CompilerServices.Unsafe/6.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", - "path": "system.runtime.compilerservices.unsafe/6.0.0", - "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" - }, - "System.Security.AccessControl/4.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==", - "path": "system.security.accesscontrol/4.5.0", - "hashPath": "system.security.accesscontrol.4.5.0.nupkg.sha512" - }, - "System.Security.Cryptography.ProtectedData/4.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==", - "path": "system.security.cryptography.protecteddata/4.5.0", - "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512" - }, - "System.Security.Permissions/4.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-9gdyuARhUR7H+p5CjyUB/zPk7/Xut3wUSP8NJQB6iZr8L3XUXTMdoLeVAg9N4rqF8oIpE7MpdqHdDHQ7XgJe0g==", - "path": "system.security.permissions/4.5.0", - "hashPath": "system.security.permissions.4.5.0.nupkg.sha512" - }, - "System.Security.Principal.Windows/4.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-U77HfRXlZlOeIXd//Yoj6Jnk8AXlbeisf1oq1os+hxOGVnuG+lGSfGqTwTZBoORFF6j/0q7HXIl8cqwQ9aUGqQ==", - "path": "system.security.principal.windows/4.5.0", - "hashPath": "system.security.principal.windows.4.5.0.nupkg.sha512" - }, - "System.Text.Encodings.Web/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", - "path": "system.text.encodings.web/7.0.0", - "hashPath": "system.text.encodings.web.7.0.0.nupkg.sha512" - }, - "System.Text.Json/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-DaGSsVqKsn/ia6RG8frjwmJonfos0srquhw09TlT8KRw5I43E+4gs+/bZj4K0vShJ5H9imCuXupb4RmS+dBy3w==", - "path": "system.text.json/7.0.0", - "hashPath": "system.text.json.7.0.0.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/HybirdFrameworkCore/obj/Debug/net6.0/HybirdFrameworkCore.GlobalUsings.g.cs b/HybirdFrameworkCore/obj/Debug/net6.0/HybirdFrameworkCore.GlobalUsings.g.cs deleted file mode 100644 index 8578f3d..0000000 --- a/HybirdFrameworkCore/obj/Debug/net6.0/HybirdFrameworkCore.GlobalUsings.g.cs +++ /dev/null @@ -1,8 +0,0 @@ -// -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/Repository/RepositoryExtension.cs b/Repository/RepositoryExtension.cs index 2f50d84..a907df3 100644 --- a/Repository/RepositoryExtension.cs +++ b/Repository/RepositoryExtension.cs @@ -1,9 +1,7 @@ using System.Reflection; using Common.Const; using Entity.Base; -using Entity.Dto.Req; -using Mapster; -using MapsterMapper; +using HybirdFrameworkCore.Entity; using SqlSugar; namespace Repository @@ -33,8 +31,9 @@ namespace Repository { return db.Updateable(entity).AS().ReSetValue(x => { x.IsDelete = true; }) .IgnoreColumns(ignoreAllNullColumns: true) - .EnableDiffLogEvent() // 记录差异日志 - .UpdateColumns(x => new { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId + .EnableDiffLogEvent() // 记录差异日志 + .UpdateColumns(x => new + { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId .ExecuteCommand(); } @@ -61,8 +60,9 @@ namespace Repository { return db.Updateable(entity).AS().ReSetValue(x => { x.IsDelete = true; }) .IgnoreColumns(ignoreAllNullColumns: true) - .EnableDiffLogEvent() // 记录差异日志 - .UpdateColumns(x => new { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId + .EnableDiffLogEvent() // 记录差异日志 + .UpdateColumns(x => new + { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId .ExecuteCommand(); } @@ -73,7 +73,8 @@ namespace Repository /// /// /// - public static Task FakeDeleteAsync(this ISugarRepository repository, T entity) where T : EntityBase, new() + public static Task FakeDeleteAsync(this ISugarRepository repository, T entity) + where T : EntityBase, new() { return repository.Context.FakeDeleteAsync(entity); } @@ -89,8 +90,9 @@ namespace Repository { return db.Updateable(entity).AS().ReSetValue(x => { x.IsDelete = true; }) .IgnoreColumns(ignoreAllNullColumns: true) - .EnableDiffLogEvent() // 记录差异日志 - .UpdateColumns(x => new { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId + .EnableDiffLogEvent() // 记录差异日志 + .UpdateColumns(x => new + { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId .ExecuteCommandAsync(); } @@ -101,7 +103,8 @@ namespace Repository /// /// /// - public static Task FakeDeleteAsync(this ISugarRepository repository, List entity) where T : EntityBase, new() + public static Task FakeDeleteAsync(this ISugarRepository repository, List entity) + where T : EntityBase, new() { return repository.Context.FakeDeleteAsync(entity); } @@ -117,8 +120,9 @@ namespace Repository { return db.Updateable(entity).AS().ReSetValue(x => { x.IsDelete = true; }) .IgnoreColumns(ignoreAllNullColumns: true) - .EnableDiffLogEvent() // 记录差异日志 - .UpdateColumns(x => new { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId + .EnableDiffLogEvent() // 记录差异日志 + .UpdateColumns(x => new + { x.IsDelete, x.UpdateTime, x.UpdateUserId }) // 允许更新的字段-AOP拦截自动设置UpdateTime、UpdateUserId .ExecuteCommandAsync(); } @@ -131,23 +135,14 @@ namespace Repository /// 默认排序字段 /// 是否降序 /// - public static ISugarQueryable OrderBuilder(this ISugarQueryable queryable, BasePageReq pageInput, string prefix = "", string defaultSortField = "Id", bool descSort = true) + public static ISugarQueryable OrderBuilder(this ISugarQueryable queryable, QueryPageModel pageInput, + string prefix = "", string defaultSortField = "Id", bool descSort = true) { // 约定默认每张表都有Id排序 - var orderStr = string.IsNullOrWhiteSpace(defaultSortField) ? "" : $"{prefix}{defaultSortField}" + (descSort ? " Desc" : " Asc"); - - TypeAdapterConfig typeAdapterConfig = new(); - typeAdapterConfig.ForType().IgnoreNullValues(true); - Mapper mapper = new(typeAdapterConfig); // 务必将mapper设为单实例 - var nowPagerInput = mapper.Map(pageInput); - // 排序是否可用-排序字段和排序顺序都为非空才启用排序 - if (!string.IsNullOrEmpty(nowPagerInput.Field) && !string.IsNullOrEmpty(nowPagerInput.OrderDirection)) - { - var col = queryable.Context.EntityMaintenance.GetEntityInfo().Columns.FirstOrDefault(u => u.PropertyName.Equals(nowPagerInput.Field, StringComparison.CurrentCultureIgnoreCase)); - orderStr = col != null - ? $"{prefix}{col.DbColumnName} {(nowPagerInput.OrderDirection == nowPagerInput.DescStr ? "Desc" : "Asc")}" - : $"{prefix}{nowPagerInput.Field} {(nowPagerInput.OrderDirection == nowPagerInput.DescStr ? "Desc" : "Asc")}"; - } + var orderStr = string.IsNullOrWhiteSpace(defaultSortField) + ? "" + : $"{prefix}{defaultSortField}" + (descSort ? " Desc" : " Asc"); + return queryable.OrderByIF(!string.IsNullOrWhiteSpace(orderStr), orderStr); } @@ -159,7 +154,8 @@ namespace Repository /// /// /// - public static int UpdateWithDiffLog(this ISugarRepository repository, T entity, bool ignoreAllNullColumns = true) where T : EntityBase, new() + public static int UpdateWithDiffLog(this ISugarRepository repository, T entity, + bool ignoreAllNullColumns = true) where T : EntityBase, new() { return repository.Context.UpdateWithDiffLog(entity, ignoreAllNullColumns); } @@ -172,7 +168,8 @@ namespace Repository /// /// /// - public static int UpdateWithDiffLog(this ISqlSugarClient db, T entity, bool ignoreAllNullColumns = true) where T : EntityBase, new() + public static int UpdateWithDiffLog(this ISqlSugarClient db, T entity, bool ignoreAllNullColumns = true) + where T : EntityBase, new() { return db.Updateable(entity).AS() .IgnoreColumns(ignoreAllNullColumns: ignoreAllNullColumns) @@ -188,7 +185,8 @@ namespace Repository /// /// /// - public static Task UpdateWithDiffLogAsync(this ISugarRepository repository, T entity, bool ignoreAllNullColumns = true) where T : EntityBase, new() + public static Task UpdateWithDiffLogAsync(this ISugarRepository repository, T entity, + bool ignoreAllNullColumns = true) where T : EntityBase, new() { return repository.Context.UpdateWithDiffLogAsync(entity, ignoreAllNullColumns); } @@ -201,7 +199,8 @@ namespace Repository /// /// /// - public static Task UpdateWithDiffLogAsync(this ISqlSugarClient db, T entity, bool ignoreAllNullColumns = true) where T : EntityBase, new() + public static Task UpdateWithDiffLogAsync(this ISqlSugarClient db, T entity, + bool ignoreAllNullColumns = true) where T : EntityBase, new() { return db.Updateable(entity) .IgnoreColumns(ignoreAllNullColumns: ignoreAllNullColumns) @@ -240,7 +239,8 @@ namespace Repository /// /// /// - public static Task InsertWithDiffLogAsync(this ISugarRepository repository, T entity) where T : EntityBase, new() + public static Task InsertWithDiffLogAsync(this ISugarRepository repository, T entity) + where T : EntityBase, new() { return repository.Context.InsertWithDiffLogAsync(entity); } @@ -379,7 +379,8 @@ namespace Repository /// /// /// - public static List WhereIF(this T thisValue, bool isWhere, Func whereExpression) where T : class, new() + public static List WhereIF(this T thisValue, bool isWhere, Func whereExpression) + where T : class, new() { return new List() { thisValue }; } @@ -391,7 +392,8 @@ namespace Repository /// /// /// - public static IUpdateable OnlyUpdateColumn(this IUpdateable updateable) where T : EntityBase, new() where R : class, new() + public static IUpdateable OnlyUpdateColumn(this IUpdateable updateable) + where T : EntityBase, new() where R : class, new() { if (updateable.UpdateBuilder.UpdateColumns == null) updateable.UpdateBuilder.UpdateColumns = new List(); @@ -402,7 +404,8 @@ namespace Repository if (typeof(T).GetProperty(info.Name) != null) updateable.UpdateBuilder.UpdateColumns.Add(info.Name); } + return updateable; } } -} +} \ No newline at end of file diff --git a/Service/Station/EquipInfoService.cs b/Service/Station/EquipInfoService.cs index 402cbce..1feab43 100644 --- a/Service/Station/EquipInfoService.cs +++ b/Service/Station/EquipInfoService.cs @@ -25,15 +25,21 @@ public class EquipInfoService : BaseServices /// /// 查询参数 /// 分页列表 - public async Task> Page(PageEquipInfoReq input) + public async Task> Page(PageEquipInfoReq input) { RefAsync total = 0; var items = await _equipInfoRepository.EquipInfoQueryPageAsync( !string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name), !string.IsNullOrEmpty(input.Code), u => u.Code.Contains(input.Code), input.Status != null, (u => input.Status != null && u.Status.Equals(input.Status.Value)), - input.Page, input.PageSize, total, input); - return SqlSugarPagedExtensions.CreateSqlSugarPagedList(items, total, input.Page, input.PageSize); + input.PageNum, input.PageSize, total, input); + return new PageResult() + { + PageNum = input.PageNum, + PageSize = input.PageSize, + ToTal = total, + Rows = items, + }; } /// diff --git a/Service/System/SysConfigService.cs b/Service/System/SysConfigService.cs index 5a35674..14ba067 100644 --- a/Service/System/SysConfigService.cs +++ b/Service/System/SysConfigService.cs @@ -9,6 +9,7 @@ using Entity.DbModel.System; using Entity.Dto.Req; using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.Autofac.Attribute; +using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.Redis; using Mapster; using Microsoft.AspNetCore.Http; @@ -38,15 +39,21 @@ namespace Service.System /// /// /// - public async Task> Page(PageConfigReq input) + public async Task> Page(PageConfigReq input) { RefAsync total = 0; var items = await _sysConfigRep.SysConfigQueryPageAsync( !string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name), !string.IsNullOrEmpty(input.Code), u => u.Code.Contains(input.Code), !string.IsNullOrEmpty(input.GroupCode), u => u.GroupCode.Equals(input.GroupCode), - input.Page, input.PageSize, total, input); - return SqlSugarPagedExtensions.CreateSqlSugarPagedList(items, total, input.Page, input.PageSize); + input.PageNum, input.PageSize, total, input); + return new PageResult() + { + PageNum = input.PageNum, + PageSize = input.PageSize, + ToTal = total, + Rows = items, + }; } /// diff --git a/WebStarter/Controllers/Station/EquipInfoController.cs b/WebStarter/Controllers/Station/EquipInfoController.cs index 3af0516..5776b8f 100644 --- a/WebStarter/Controllers/Station/EquipInfoController.cs +++ b/WebStarter/Controllers/Station/EquipInfoController.cs @@ -27,7 +27,7 @@ public class EquipInfoController /// 充电模式分页列表 [HttpPost] [Route("/api/equipInfo/page")] - public async Task> Page(PageEquipInfoReq input) + public async Task> Page(PageEquipInfoReq input) { return await _equipInfoService.Page(input); } diff --git a/WebStarter/Controllers/System/SysConfigController.cs b/WebStarter/Controllers/System/SysConfigController.cs index 81d9432..4151ebc 100644 --- a/WebStarter/Controllers/System/SysConfigController.cs +++ b/WebStarter/Controllers/System/SysConfigController.cs @@ -2,6 +2,7 @@ using Entity.Base; using Entity.DbModel.System; using Entity.Dto.Req; +using HybirdFrameworkCore.Entity; using Microsoft.AspNetCore.Mvc; using Service.System; @@ -19,7 +20,7 @@ namespace WebStarter.Controllers.System [HttpPost] [Route("/api/sysConfig/page")] - public async Task> Page(PageConfigReq input) + public async Task> Page(PageConfigReq input) { return await _sysConfigService.Page(input); } diff --git a/WebStarter/bin/Debug/net6.0/log4net.config b/WebStarter/bin/Debug/net6.0/log4net.config index c533256..ce9dad4 100644 --- a/WebStarter/bin/Debug/net6.0/log4net.config +++ b/WebStarter/bin/Debug/net6.0/log4net.config @@ -1,32 +1,179 @@  + - + - - + + - + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - \ No newline at end of file +