mirror of
				https://github.com/nsnail/NetAdmin.git
				synced 2025-11-01 03:35:28 +08:00 
			
		
		
		
	refactor: ♻️ 框架代码同步
This commit is contained in:
		| @@ -52,7 +52,9 @@ public abstract class RepositoryService<TEntity, TPrimary, TLogger>(BasicReposit | ||||
|     { | ||||
|         var select = selector(query).WithNoLockNoWait().Take(Numbers.MAX_LIMIT_EXPORT); | ||||
|  | ||||
|         object list = listExp == null ? await select.ToListAsync().ConfigureAwait(false) : await select.ToListAsync(listExp).ConfigureAwait(false); | ||||
|         object list = listExp == null | ||||
|             ? await select.ToListAsync(a => a).ConfigureAwait(false) | ||||
|             : await select.ToListAsync(listExp).ConfigureAwait(false); | ||||
|  | ||||
|         return await GetExportFileStreamAsync<TExport>(fileName, list).ConfigureAwait(false); | ||||
|     } | ||||
|   | ||||
| @@ -91,7 +91,12 @@ public sealed class ExampleService(BasicRepository<Tpl_Example, long> rpo) // | ||||
|     public async Task<PagedQueryRsp<QueryExampleRsp>> PagedQueryAsync(PagedQueryReq<QueryExampleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Tpl_Example>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryExampleRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryExampleRsp>>()); | ||||
|     } | ||||
| @@ -100,7 +105,11 @@ public sealed class ExampleService(BasicRepository<Tpl_Example, long> rpo) // | ||||
|     public async Task<IEnumerable<QueryExampleRsp>> QueryAsync(QueryReq<QueryExampleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Tpl_Example>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryExampleRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -40,7 +40,7 @@ public record QueryReq<T> : DataAbstraction | ||||
|     /// <summary> | ||||
|     ///     所需字段 | ||||
|     /// </summary> | ||||
|     public string[] RequiredFields { get; set; } | ||||
|     public string[] RequiredFields { get; init; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     列表表达式 | ||||
|   | ||||
| @@ -25,8 +25,9 @@ public abstract class ApiResultHandler<T> | ||||
|     { | ||||
|         var naException = context.Exception switch { | ||||
|                               NetAdminException ex => ex | ||||
|                             , _ => context.Exception.Message.Contains(Chars.FLG_DB_EXCEPTION_PRIMARY_KEY_CONFLICT) || | ||||
|                                    context.Exception.Message.Contains(Chars.FLG_DB_EXCEPTION_UNIQUE_CONSTRAINT_CONFLICT) | ||||
|                             , _ => context.Exception.Message.Contains(Chars.FLG_DB_EXCEPTION_PRIMARY_KEY_CONFLICT)       || | ||||
|                                    context.Exception.Message.Contains(Chars.FLG_DB_EXCEPTION_UNIQUE_CONSTRAINT_CONFLICT) || | ||||
|                                    context.Exception.Message.Contains(Chars.FLG_DB_EXCEPTION_IDX) | ||||
|                                   ? new NetAdminInvalidOperationException(Ln.记录已存在) | ||||
|                                   : null | ||||
|                           }; | ||||
|   | ||||
| @@ -17,6 +17,7 @@ public static class Chars | ||||
|     public const string FLG_CRON_PER_SECS                              = "* * * * * *"; | ||||
|     public const string FLG_DB_EXCEPTION_PRIMARY_KEY_CONFLICT          = "PRIMARY KEY"; | ||||
|     public const string FLG_DB_EXCEPTION_UNIQUE_CONSTRAINT_CONFLICT    = "UNIQUE constraint"; | ||||
|     public const string FLG_DB_EXCEPTION_IDX                           = "idx_"; | ||||
|     public const string FLG_DB_FIELD_TYPE_NVARCHAR                     = "nvarchar"; | ||||
|     public const string FLG_DB_FIELD_TYPE_NVARCHAR_1022                = "nvarchar(1022)"; | ||||
|     public const string FLG_DB_FIELD_TYPE_NVARCHAR_127                 = "nvarchar(127)"; | ||||
|   | ||||
| @@ -3,8 +3,8 @@ | ||||
|     <Import Project="$(SolutionDir)/build/copy.pkg.xml.comment.files.targets"/> | ||||
|     <Import Project="$(SolutionDir)/build/prebuild.targets"/> | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="NetAdmin.FreeSql.DbContext" Version="1.0.2" Label="refs"/> | ||||
|         <PackageReference Include="NetAdmin.FreeSql.Provider.Sqlite" Version="1.0.2" Label="refs"/> | ||||
|         <PackageReference Include="NetAdmin.FreeSql.DbContext" Version="1.0.3" Label="refs"/> | ||||
|         <PackageReference Include="NetAdmin.FreeSql.Provider.Sqlite" Version="1.0.3" Label="refs"/> | ||||
|         <PackageReference Include="Gurion" Version="1.2.5" Label="refs"/> | ||||
|         <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0"/> | ||||
|         <PackageReference Include="Minio" Version="6.0.3"/> | ||||
|   | ||||
| @@ -92,7 +92,10 @@ public sealed class ApiService( | ||||
|     public async Task<IEnumerable<QueryApiRsp>> PlainQueryAsync(QueryReq<QueryApiReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await Rpo.Select.WhereDynamicFilter(req.DynamicFilter) | ||||
|                            .WhereDynamic(req.Filter) | ||||
|                            .ToListAsync(req.GetToListExp<Sys_Api>() ?? (a => a)) | ||||
|                            .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryApiRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -95,7 +95,12 @@ public sealed class ConfigService(BasicRepository<Sys_Config, long> rpo) // | ||||
|     public async Task<PagedQueryRsp<QueryConfigRsp>> PagedQueryAsync(PagedQueryReq<QueryConfigReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_Config>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryConfigRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryConfigRsp>>()); | ||||
|     } | ||||
| @@ -104,7 +109,11 @@ public sealed class ConfigService(BasicRepository<Sys_Config, long> rpo) // | ||||
|     public async Task<IEnumerable<QueryConfigRsp>> QueryAsync(QueryReq<QueryConfigReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_Config>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryConfigRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -100,7 +100,12 @@ public sealed class DicCatalogService(BasicRepository<Sys_DicCatalog, long> rpo) | ||||
|     public async Task<PagedQueryRsp<QueryDicCatalogRsp>> PagedQueryAsync(PagedQueryReq<QueryDicCatalogReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_DicCatalog>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryDicCatalogRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryDicCatalogRsp>>()); | ||||
|     } | ||||
|   | ||||
| @@ -98,7 +98,12 @@ public sealed class DicContentService(BasicRepository<Sys_DicContent, long> rpo) | ||||
|     public async Task<PagedQueryRsp<QueryDicContentRsp>> PagedQueryAsync(PagedQueryReq<QueryDicContentReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_DicContent>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryDicContentRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryDicContentRsp>>()); | ||||
|     } | ||||
| @@ -107,7 +112,11 @@ public sealed class DicContentService(BasicRepository<Sys_DicContent, long> rpo) | ||||
|     public async Task<IEnumerable<QueryDicContentRsp>> QueryAsync(QueryReq<QueryDicContentReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_DicContent>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryDicContentRsp>>(); | ||||
|     } | ||||
|  | ||||
| @@ -119,7 +128,7 @@ public sealed class DicContentService(BasicRepository<Sys_DicContent, long> rpo) | ||||
|                            .Include(a => a.Catalog) | ||||
|                            .Where(a => a.Catalog.Code == catalogCode) | ||||
|                            .Where(a => a.Enabled) | ||||
|                            .ToListAsync() | ||||
|                            .ToListAsync(a => a) | ||||
|                            .ConfigureAwait(false); | ||||
|         return ret.Adapt<List<QueryDicContentRsp>>(); | ||||
|     } | ||||
|   | ||||
| @@ -101,7 +101,12 @@ public sealed class DocCatalogService(BasicRepository<Sys_DocCatalog, long> rpo) | ||||
|     public async Task<PagedQueryRsp<QueryDocCatalogRsp>> PagedQueryAsync(PagedQueryReq<QueryDocCatalogReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_DocCatalog>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryDocCatalogRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryDocCatalogRsp>>()); | ||||
|     } | ||||
|   | ||||
| @@ -104,7 +104,12 @@ public sealed class DocContentService(BasicRepository<Sys_DocContent, long> rpo) | ||||
|     public async Task<PagedQueryRsp<QueryDocContentRsp>> PagedQueryAsync(PagedQueryReq<QueryDocContentReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_DocContent>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryDocContentRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryDocContentRsp>>()); | ||||
|     } | ||||
| @@ -113,7 +118,11 @@ public sealed class DocContentService(BasicRepository<Sys_DocContent, long> rpo) | ||||
|     public async Task<IEnumerable<QueryDocContentRsp>> QueryAsync(QueryReq<QueryDocContentReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_DocContent>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryDocContentRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -130,7 +130,12 @@ public sealed class JobRecordService(BasicRepository<Sys_JobRecord, long> rpo) / | ||||
|     public async Task<PagedQueryRsp<QueryJobRecordRsp>> PagedQueryAsync(PagedQueryReq<QueryJobRecordReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_JobRecord>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryJobRecordRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryJobRecordRsp>>()); | ||||
|     } | ||||
| @@ -139,7 +144,11 @@ public sealed class JobRecordService(BasicRepository<Sys_JobRecord, long> rpo) / | ||||
|     public async Task<IEnumerable<QueryJobRecordRsp>> QueryAsync(QueryReq<QueryJobRecordReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_JobRecord>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryJobRecordRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -260,7 +260,12 @@ public sealed class JobService(BasicRepository<Sys_Job, long> rpo, IJobRecordSer | ||||
|     public async Task<PagedQueryRsp<QueryJobRsp>> PagedQueryAsync(PagedQueryReq<QueryJobReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_Job>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryJobRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryJobRsp>>()); | ||||
|     } | ||||
| @@ -276,7 +281,11 @@ public sealed class JobService(BasicRepository<Sys_Job, long> rpo, IJobRecordSer | ||||
|     public async Task<IEnumerable<QueryJobRsp>> QueryAsync(QueryReq<QueryJobReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_Job>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryJobRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -111,7 +111,11 @@ public sealed class LoginLogService(BasicRepository<Sys_LoginLog, long> rpo) // | ||||
|     public async Task<IEnumerable<QueryLoginLogRsp>> QueryAsync(QueryReq<QueryLoginLogReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_LoginLog>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryLoginLogRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -87,7 +87,12 @@ public sealed class RequestLogDetailService(BasicRepository<Sys_RequestLogDetail | ||||
|     public async Task<PagedQueryRsp<QueryRequestLogDetailRsp>> PagedQueryAsync(PagedQueryReq<QueryRequestLogDetailReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_RequestLogDetail>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryRequestLogDetailRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryRequestLogDetailRsp>>()); | ||||
|     } | ||||
| @@ -96,7 +101,11 @@ public sealed class RequestLogDetailService(BasicRepository<Sys_RequestLogDetail | ||||
|     public async Task<IEnumerable<QueryRequestLogDetailRsp>> QueryAsync(QueryReq<QueryRequestLogDetailReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_RequestLogDetail>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryRequestLogDetailRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -184,7 +184,11 @@ public sealed class RequestLogService(BasicRepository<Sys_RequestLog, long> rpo, | ||||
|     public async Task<IEnumerable<QueryRequestLogRsp>> QueryAsync(QueryReq<QueryRequestLogReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_RequestLog>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryRequestLogRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -101,7 +101,12 @@ public sealed class RoleService(BasicRepository<Sys_Role, long> rpo, IUserRoleSe | ||||
|     public async Task<PagedQueryRsp<QueryRoleRsp>> PagedQueryAsync(PagedQueryReq<QueryRoleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_Role>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryRoleRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryRoleRsp>>()); | ||||
|     } | ||||
| @@ -110,7 +115,7 @@ public sealed class RoleService(BasicRepository<Sys_Role, long> rpo, IUserRoleSe | ||||
|     public async Task<IEnumerable<QueryRoleRsp>> QueryAsync(QueryReq<QueryRoleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().ToListAsync(req.GetToListExp<Sys_Role>() ?? (a => a)).ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryRoleRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -84,7 +84,12 @@ public sealed class SiteMsgDeptService(BasicRepository<Sys_SiteMsgDept, long> rp | ||||
|     public async Task<PagedQueryRsp<QuerySiteMsgDeptRsp>> PagedQueryAsync(PagedQueryReq<QuerySiteMsgDeptReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_SiteMsgDept>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QuerySiteMsgDeptRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QuerySiteMsgDeptRsp>>()); | ||||
|     } | ||||
| @@ -93,7 +98,11 @@ public sealed class SiteMsgDeptService(BasicRepository<Sys_SiteMsgDept, long> rp | ||||
|     public async Task<IEnumerable<QuerySiteMsgDeptRsp>> QueryAsync(QueryReq<QuerySiteMsgDeptReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_SiteMsgDept>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QuerySiteMsgDeptRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -84,7 +84,12 @@ public sealed class SiteMsgFlagService(BasicRepository<Sys_SiteMsgFlag, long> rp | ||||
|     public async Task<PagedQueryRsp<QuerySiteMsgFlagRsp>> PagedQueryAsync(PagedQueryReq<QuerySiteMsgFlagReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_SiteMsgFlag>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QuerySiteMsgFlagRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QuerySiteMsgFlagRsp>>()); | ||||
|     } | ||||
| @@ -93,7 +98,11 @@ public sealed class SiteMsgFlagService(BasicRepository<Sys_SiteMsgFlag, long> rp | ||||
|     public async Task<IEnumerable<QuerySiteMsgFlagRsp>> QueryAsync(QueryReq<QuerySiteMsgFlagReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_SiteMsgFlag>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QuerySiteMsgFlagRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -84,7 +84,12 @@ public sealed class SiteMsgRoleService(BasicRepository<Sys_SiteMsgRole, long> rp | ||||
|     public async Task<PagedQueryRsp<QuerySiteMsgRoleRsp>> PagedQueryAsync(PagedQueryReq<QuerySiteMsgRoleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_SiteMsgRole>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QuerySiteMsgRoleRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QuerySiteMsgRoleRsp>>()); | ||||
|     } | ||||
| @@ -93,7 +98,11 @@ public sealed class SiteMsgRoleService(BasicRepository<Sys_SiteMsgRole, long> rp | ||||
|     public async Task<IEnumerable<QuerySiteMsgRoleRsp>> QueryAsync(QueryReq<QuerySiteMsgRoleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_SiteMsgRole>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QuerySiteMsgRoleRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -170,7 +170,11 @@ public sealed class SiteMsgService(BasicRepository<Sys_SiteMsg, long> rpo, Conte | ||||
|     public async Task<IEnumerable<QuerySiteMsgRsp>> QueryAsync(QueryReq<QuerySiteMsgReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_SiteMsg>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QuerySiteMsgRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -84,7 +84,12 @@ public sealed class SiteMsgUserService(BasicRepository<Sys_SiteMsgUser, long> rp | ||||
|     public async Task<PagedQueryRsp<QuerySiteMsgUserRsp>> PagedQueryAsync(PagedQueryReq<QuerySiteMsgUserReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_SiteMsgUser>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QuerySiteMsgUserRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QuerySiteMsgUserRsp>>()); | ||||
|     } | ||||
| @@ -93,7 +98,11 @@ public sealed class SiteMsgUserService(BasicRepository<Sys_SiteMsgUser, long> rp | ||||
|     public async Task<IEnumerable<QuerySiteMsgUserRsp>> QueryAsync(QueryReq<QuerySiteMsgUserReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_SiteMsgUser>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QuerySiteMsgUserRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -84,7 +84,12 @@ public sealed class UserRoleService(BasicRepository<Sys_UserRole, long> rpo) // | ||||
|     public async Task<PagedQueryRsp<QueryUserRoleRsp>> PagedQueryAsync(PagedQueryReq<QueryUserRoleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_UserRole>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryUserRoleRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryUserRoleRsp>>()); | ||||
|     } | ||||
| @@ -93,7 +98,11 @@ public sealed class UserRoleService(BasicRepository<Sys_UserRole, long> rpo) // | ||||
|     public async Task<IEnumerable<QueryUserRoleRsp>> QueryAsync(QueryReq<QueryUserRoleReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_UserRole>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryUserRoleRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -94,7 +94,12 @@ public sealed class VerifyCodeService(BasicRepository<Sys_VerifyCode, long> rpo, | ||||
|     public async Task<PagedQueryRsp<QueryVerifyCodeRsp>> PagedQueryAsync(PagedQueryReq<QueryVerifyCodeReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var list = await QueryInternal(req).Page(req.Page, req.PageSize).WithNoLockNoWait().Count(out var total).ToListAsync().ConfigureAwait(false); | ||||
|         var list = await QueryInternal(req) | ||||
|                          .Page(req.Page, req.PageSize) | ||||
|                          .WithNoLockNoWait() | ||||
|                          .Count(out var total) | ||||
|                          .ToListAsync(req.GetToListExp<Sys_VerifyCode>() ?? (a => a)) | ||||
|                          .ConfigureAwait(false); | ||||
|  | ||||
|         return new PagedQueryRsp<QueryVerifyCodeRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryVerifyCodeRsp>>()); | ||||
|     } | ||||
| @@ -103,7 +108,11 @@ public sealed class VerifyCodeService(BasicRepository<Sys_VerifyCode, long> rpo, | ||||
|     public async Task<IEnumerable<QueryVerifyCodeRsp>> QueryAsync(QueryReq<QueryVerifyCodeReq> req) | ||||
|     { | ||||
|         req.ThrowIfInvalid(); | ||||
|         var ret = await QueryInternal(req).WithNoLockNoWait().Take(req.Count).ToListAsync().ConfigureAwait(false); | ||||
|         var ret = await QueryInternal(req) | ||||
|                         .WithNoLockNoWait() | ||||
|                         .Take(req.Count) | ||||
|                         .ToListAsync(req.GetToListExp<Sys_VerifyCode>() ?? (a => a)) | ||||
|                         .ConfigureAwait(false); | ||||
|         return ret.Adapt<IEnumerable<QueryVerifyCodeRsp>>(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -90,6 +90,36 @@ export default { | ||||
|  | ||||
|         // 设置语言 | ||||
|         this.$i18n.locale = this.$TOOL.data.get('APP_SET_LANG') || this.$CONFIG.APP_SET_LANG | ||||
|  | ||||
|         //ctrl + enter 触发主按钮点击事件 | ||||
|         document.onkeydown = (e) => { | ||||
|             if (e.ctrlKey && e.keyCode === 13) { | ||||
|                 document | ||||
|                     .getElementsByClassName('el-dialog__footer')[0] | ||||
|                     ?.getElementsByClassName('el-button--primary')[0] | ||||
|                     ?.dispatchEvent( | ||||
|                         new MouseEvent('click', { | ||||
|                             view: window, | ||||
|                             bubbles: true, | ||||
|                             cancelable: false, | ||||
|                         }), | ||||
|                     ) | ||||
|             } | ||||
|             if (!e.altKey && !e.ctrlKey && !e.shiftKey) { | ||||
|                 for (const el of document.getElementsByClassName('sc-contextmenu__menu')[0]?.getElementsByTagName('li') ?? []) { | ||||
|                     if (el.getElementsByClassName('sc-contextmenu__suffix')[0]?.innerText === String.fromCharCode(e.keyCode)) { | ||||
|                         el.dispatchEvent( | ||||
|                             new MouseEvent('click', { | ||||
|                                 view: window, | ||||
|                                 bubbles: true, | ||||
|                                 cancelable: false, | ||||
|                             }), | ||||
|                         ) | ||||
|                         break | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     }, | ||||
| } | ||||
| </script> | ||||
|   | ||||
| @@ -174,10 +174,32 @@ | ||||
|                 :command="`${menu}^|^NotAny^|^${tool.getNestedProperty(current.row, menu) ?? ''}`" | ||||
|                 :title="$t('非其一')"></sc-contextmenu-item> | ||||
|         </sc-contextmenu-item> | ||||
|         <sc-contextmenu-item :title="$t('复制')" command="copy" divided icon="el-icon-copy-document"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item v-if="contextOpers.includes('view')" :title="$t('查看')" command="view" icon="el-icon-view"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item v-if="contextOpers.includes('edit')" :title="$t('编辑')" command="edit" icon="el-icon-edit"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item v-if="contextOpers.includes('del')" :title="$t('删除')" command="del" icon="el-icon-delete"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item :title="$t('复制')" command="copy" divided icon="el-icon-copy-document" suffix="C"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item | ||||
|             v-if="contextOpers.includes('add')" | ||||
|             :title="$t('新增')" | ||||
|             command="add" | ||||
|             divided | ||||
|             icon="el-icon-plus" | ||||
|             suffix="A"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item | ||||
|             v-if="contextOpers.includes('view')" | ||||
|             :title="$t('查看')" | ||||
|             command="view" | ||||
|             icon="el-icon-view" | ||||
|             suffix="V"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item | ||||
|             v-if="contextOpers.includes('edit')" | ||||
|             :title="$t('编辑')" | ||||
|             command="edit" | ||||
|             icon="el-icon-edit" | ||||
|             suffix="E"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item | ||||
|             v-if="contextOpers.includes('del')" | ||||
|             :title="$t('删除')" | ||||
|             command="del" | ||||
|             icon="el-icon-delete" | ||||
|             suffix="D"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item | ||||
|             v-for="(adv, index) in contextAdvs" | ||||
|             :command="adv" | ||||
| @@ -187,7 +209,7 @@ | ||||
|             :title="adv.label"> | ||||
|         </sc-contextmenu-item> | ||||
|         <sc-contextmenu-item v-if="exportApi" :title="$t('导出文件')" command="export" divided icon="el-icon-download"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item :title="$t('重新加载')" command="refresh" icon="el-icon-refresh" suffix="Ctrl+R"></sc-contextmenu-item> | ||||
|         <sc-contextmenu-item :title="$t('重新加载')" command="refresh" divided icon="el-icon-refresh" suffix="R"></sc-contextmenu-item> | ||||
|     </sc-contextmenu> | ||||
|     <field-filter ref="fieldFilterDialog"></field-filter> | ||||
| </template> | ||||
| @@ -211,7 +233,7 @@ export default { | ||||
|     props: { | ||||
|         vue: { type: Object }, | ||||
|         contextMenus: { type: Array }, | ||||
|         contextOpers: { type: Array, default: ['copy', 'view', 'edit', 'del'] }, | ||||
|         contextOpers: { type: Array, default: ['copy', 'add', 'view', 'edit', 'del'] }, | ||||
|         contextAdvs: { type: Array, default: [] }, | ||||
|         tableName: { type: String, default: '' }, | ||||
|         beforePost: { | ||||
| @@ -373,6 +395,10 @@ export default { | ||||
|                 await this.exportData() | ||||
|                 return | ||||
|             } | ||||
|             if (command === 'add') { | ||||
|                 this.vue.dialog.save = { mode: 'add' } | ||||
|                 return | ||||
|             } | ||||
|             if (command === 'edit') { | ||||
|                 this.vue.dialog.save = { mode: 'edit', row: { id: this.current.row.id } } | ||||
|                 return | ||||
|   | ||||
| @@ -22,7 +22,7 @@ | ||||
|                         ], | ||||
|                     }, | ||||
|                 ]" | ||||
|                 :label-width="6" | ||||
|                 :label-width="8" | ||||
|                 @on-change="filterChange" | ||||
|                 ref="selectFilter"></sc-select-filter> | ||||
|         </el-header> | ||||
|   | ||||
| @@ -36,7 +36,7 @@ | ||||
|                         ], | ||||
|                     }, | ||||
|                 ]" | ||||
|                 :label-width="6" | ||||
|                 :label-width="8" | ||||
|                 @on-change="filterChange" | ||||
|                 ref="selectFilter"></sc-select-filter> | ||||
|         </el-header> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user