Browse Source

add support dynamic query interface

pull/714/head
cKey 3 years ago
parent
commit
8876940466
  1. 41
      aspnet-core/LINGYUN.MicroService.Common.sln
  2. 30
      aspnet-core/LINGYUN.MicroService.TaskManagement.sln
  3. 3
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/FodyWeavers.xml
  4. 30
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/FodyWeavers.xsd
  5. 19
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj
  6. 10
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableApplicationContractsModule.cs
  7. 8
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/Dto/DynamicParamterDto.cs
  8. 11
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/Dto/GetListByDynamicQueryableInput.cs
  9. 19
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/IDynamicQueryableAppService.cs
  10. 3
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/FodyWeavers.xml
  11. 30
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/FodyWeavers.xsd
  12. 19
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN.Abp.Dynamic.Queryable.Application.csproj
  13. 11
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableApplicationModule.cs
  14. 21
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableOptions.cs
  15. 74
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN/Abp/Dynamic/Queryable/DynamicQueryableAppService.cs
  16. 3
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/FodyWeavers.xml
  17. 30
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/FodyWeavers.xsd
  18. 19
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/LINGYUN.Abp.Dynamic.Queryable.HttpApi.csproj
  19. 18
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableHttpApiModule.cs
  20. 31
      aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/LINGYUN/Abp/Dynamic/Queryable/DynamicQueryableControllerBase.cs
  21. 3
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/FodyWeavers.xml
  22. 30
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/FodyWeavers.xsd
  23. 11
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN.Linq.Dynamic.Queryable.csproj
  24. 53
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicComparison.cs
  25. 13
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicLogic.cs
  26. 13
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicParamter.cs
  27. 8
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicQueryable.cs
  28. 12
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.md
  29. 119
      aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/System/Linq/Expressions/ObjectQueryableExtensions.cs
  30. 20
      aspnet-core/modules/dynamic-queryable/README.md
  31. 1
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN.Abp.TaskManagement.Application.Contracts.csproj
  32. 6
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/IBackgroundJobInfoAppService.cs
  33. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/TaskManagementApplicationContractsModule.cs
  34. 1
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN.Abp.TaskManagement.Application.csproj
  35. 30
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs
  36. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationModule.cs
  37. 1
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN.Abp.TaskManagement.HttpApi.csproj
  38. 9
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs
  39. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/TaskManagementHttpApiModule.cs
  40. 4
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/LY.MicroService.TaskManagement.HttpApi.Host.csproj

41
aspnet-core/LINGYUN.MicroService.Common.sln

@ -274,15 +274,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Http.Client.Wra
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tui-juhe", "tui-juhe", "{A1C75C3E-67D1-4BCE-89BF-44A735909BD5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TuiJuhe", "modules\tui-juhe\LINGYUN.Abp.TuiJuhe\LINGYUN.Abp.TuiJuhe.csproj", "{60143C9C-E539-498A-9DBE-B95E6A8301A5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TuiJuhe", "modules\tui-juhe\LINGYUN.Abp.TuiJuhe\LINGYUN.Abp.TuiJuhe.csproj", "{60143C9C-E539-498A-9DBE-B95E6A8301A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.TuiJuhe", "modules\tui-juhe\LINGYUN.Abp.Notifications.TuiJuhe\LINGYUN.Abp.Notifications.TuiJuhe.csproj", "{C55D9BA0-4AFD-4D18-958B-B53FD3F2FF4F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Notifications.TuiJuhe", "modules\tui-juhe\LINGYUN.Abp.Notifications.TuiJuhe\LINGYUN.Abp.Notifications.TuiJuhe.csproj", "{C55D9BA0-4AFD-4D18-958B-B53FD3F2FF4F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.TuiJuhe.Tests", "tests\LINGYUN.Abp.Notifications.TuiJuhe.Tests\LINGYUN.Abp.Notifications.TuiJuhe.Tests.csproj", "{641DF0BA-0E79-441D-B328-FDA288A35CDE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Notifications.TuiJuhe.Tests", "tests\LINGYUN.Abp.Notifications.TuiJuhe.Tests\LINGYUN.Abp.Notifications.TuiJuhe.Tests.csproj", "{641DF0BA-0E79-441D-B328-FDA288A35CDE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TuiJuhe.Tests", "tests\LINGYUN.Abp.TuiJuhe.Tests\LINGYUN.Abp.TuiJuhe.Tests.csproj", "{2020EA8D-F276-498D-92D1-94D1E25F8E1A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TuiJuhe.Tests", "tests\LINGYUN.Abp.TuiJuhe.Tests\LINGYUN.Abp.TuiJuhe.Tests.csproj", "{2020EA8D-F276-498D-92D1-94D1E25F8E1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TuiJuhe.SettingManagement", "modules\tui-juhe\LINGYUN.Abp.TuiJuhe.SettingManagement\LINGYUN.Abp.TuiJuhe.SettingManagement.csproj", "{2A3DF8B2-4760-41C4-9337-44FEE29B17CD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TuiJuhe.SettingManagement", "modules\tui-juhe\LINGYUN.Abp.TuiJuhe.SettingManagement\LINGYUN.Abp.TuiJuhe.SettingManagement.csproj", "{2A3DF8B2-4760-41C4-9337-44FEE29B17CD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dynamic-queryable", "dynamic-queryable", "{3975D028-3672-4D23-BF77-B7F4A445D44E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Linq.Dynamic.Queryable", "modules\dynamic-queryable\LINGYUN.Linq.Dynamic.Queryable\LINGYUN.Linq.Dynamic.Queryable.csproj", "{5512A359-80E8-440C-B652-7C96F614DD9E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Dynamic.Queryable.Application.Contracts", "modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj", "{6A23EE81-0CA7-4CA7-859D-6ADB669DF0E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Dynamic.Queryable.Application", "modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application\LINGYUN.Abp.Dynamic.Queryable.Application.csproj", "{EC7970DC-A656-46A7-9873-A730FE72B213}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Dynamic.Queryable.HttpApi", "modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.HttpApi\LINGYUN.Abp.Dynamic.Queryable.HttpApi.csproj", "{F515E8FA-449F-4D54-98A7-0F7DF1AA3C94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -734,6 +744,22 @@ Global
{2A3DF8B2-4760-41C4-9337-44FEE29B17CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A3DF8B2-4760-41C4-9337-44FEE29B17CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A3DF8B2-4760-41C4-9337-44FEE29B17CD}.Release|Any CPU.Build.0 = Release|Any CPU
{5512A359-80E8-440C-B652-7C96F614DD9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5512A359-80E8-440C-B652-7C96F614DD9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5512A359-80E8-440C-B652-7C96F614DD9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5512A359-80E8-440C-B652-7C96F614DD9E}.Release|Any CPU.Build.0 = Release|Any CPU
{6A23EE81-0CA7-4CA7-859D-6ADB669DF0E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A23EE81-0CA7-4CA7-859D-6ADB669DF0E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A23EE81-0CA7-4CA7-859D-6ADB669DF0E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A23EE81-0CA7-4CA7-859D-6ADB669DF0E1}.Release|Any CPU.Build.0 = Release|Any CPU
{EC7970DC-A656-46A7-9873-A730FE72B213}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC7970DC-A656-46A7-9873-A730FE72B213}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC7970DC-A656-46A7-9873-A730FE72B213}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC7970DC-A656-46A7-9873-A730FE72B213}.Release|Any CPU.Build.0 = Release|Any CPU
{F515E8FA-449F-4D54-98A7-0F7DF1AA3C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F515E8FA-449F-4D54-98A7-0F7DF1AA3C94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F515E8FA-449F-4D54-98A7-0F7DF1AA3C94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F515E8FA-449F-4D54-98A7-0F7DF1AA3C94}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -875,6 +901,11 @@ Global
{641DF0BA-0E79-441D-B328-FDA288A35CDE} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{2020EA8D-F276-498D-92D1-94D1E25F8E1A} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{2A3DF8B2-4760-41C4-9337-44FEE29B17CD} = {A1C75C3E-67D1-4BCE-89BF-44A735909BD5}
{3975D028-3672-4D23-BF77-B7F4A445D44E} = {02EA4E78-5891-43BC-944F-3E52FEE032E4}
{5512A359-80E8-440C-B652-7C96F614DD9E} = {3975D028-3672-4D23-BF77-B7F4A445D44E}
{6A23EE81-0CA7-4CA7-859D-6ADB669DF0E1} = {3975D028-3672-4D23-BF77-B7F4A445D44E}
{EC7970DC-A656-46A7-9873-A730FE72B213} = {3975D028-3672-4D23-BF77-B7F4A445D44E}
{F515E8FA-449F-4D54-98A7-0F7DF1AA3C94} = {3975D028-3672-4D23-BF77-B7F4A445D44E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06C707C6-02C0-411A-AD3B-2D0E13787CB8}

30
aspnet-core/LINGYUN.MicroService.TaskManagement.sln

@ -70,6 +70,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dapr.Client", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Notifications.Core", "modules\common\LINGYUN.Abp.Notifications.Core\LINGYUN.Abp.Notifications.Core.csproj", "{DD51A1AE-830F-4909-A729-7EBC398B17AD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "exten-plugin", "exten-plugin", "{B38D2141-AC0F-4F4A-9315-4292E3856C15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Linq.Dynamic.Queryable", "modules\dynamic-queryable\LINGYUN.Linq.Dynamic.Queryable\LINGYUN.Linq.Dynamic.Queryable.csproj", "{3EE8383C-6F25-4BCD-8852-B23D1C864324}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dynamic.Queryable.Application.Contracts", "modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj", "{B54F200C-D648-477B-BE39-B40A1D956F13}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dynamic.Queryable.Application", "modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application\LINGYUN.Abp.Dynamic.Queryable.Application.csproj", "{FEC5FD25-9B26-4245-88D8-7621B26C7C3A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dynamic.Queryable.HttpApi", "modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.HttpApi\LINGYUN.Abp.Dynamic.Queryable.HttpApi.csproj", "{DF963ABB-E713-49E9-A03C-DEB431E369DF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -172,6 +182,22 @@ Global
{DD51A1AE-830F-4909-A729-7EBC398B17AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD51A1AE-830F-4909-A729-7EBC398B17AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD51A1AE-830F-4909-A729-7EBC398B17AD}.Release|Any CPU.Build.0 = Release|Any CPU
{3EE8383C-6F25-4BCD-8852-B23D1C864324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EE8383C-6F25-4BCD-8852-B23D1C864324}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EE8383C-6F25-4BCD-8852-B23D1C864324}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EE8383C-6F25-4BCD-8852-B23D1C864324}.Release|Any CPU.Build.0 = Release|Any CPU
{B54F200C-D648-477B-BE39-B40A1D956F13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B54F200C-D648-477B-BE39-B40A1D956F13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B54F200C-D648-477B-BE39-B40A1D956F13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B54F200C-D648-477B-BE39-B40A1D956F13}.Release|Any CPU.Build.0 = Release|Any CPU
{FEC5FD25-9B26-4245-88D8-7621B26C7C3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEC5FD25-9B26-4245-88D8-7621B26C7C3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEC5FD25-9B26-4245-88D8-7621B26C7C3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEC5FD25-9B26-4245-88D8-7621B26C7C3A}.Release|Any CPU.Build.0 = Release|Any CPU
{DF963ABB-E713-49E9-A03C-DEB431E369DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF963ABB-E713-49E9-A03C-DEB431E369DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF963ABB-E713-49E9-A03C-DEB431E369DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF963ABB-E713-49E9-A03C-DEB431E369DF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -201,6 +227,10 @@ Global
{2FA23894-E598-4896-A336-3E7C682699D9} = {FA5E30C9-05E3-4E35-AEDD-7DC5534E3A01}
{194DAB61-BC3C-4003-BFF0-C87763E7B8B0} = {FA5E30C9-05E3-4E35-AEDD-7DC5534E3A01}
{DD51A1AE-830F-4909-A729-7EBC398B17AD} = {18918B94-BB48-48F3-874D-B91B0252440A}
{3EE8383C-6F25-4BCD-8852-B23D1C864324} = {B38D2141-AC0F-4F4A-9315-4292E3856C15}
{B54F200C-D648-477B-BE39-B40A1D956F13} = {B38D2141-AC0F-4F4A-9315-4292E3856C15}
{FEC5FD25-9B26-4245-88D8-7621B26C7C3A} = {B38D2141-AC0F-4F4A-9315-4292E3856C15}
{DF963ABB-E713-49E9-A03C-DEB431E369DF} = {B38D2141-AC0F-4F4A-9315-4292E3856C15}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E1FD1F4C-D344-408B-97CF-B6F1F6D7D293}

3
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Linq.Dynamic.Queryable\LINGYUN.Linq.Dynamic.Queryable.csproj" />
</ItemGroup>
</Project>

10
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableApplicationContractsModule.cs

@ -0,0 +1,10 @@
using Volo.Abp.Application;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Dynamic.Queryable;
[DependsOn(typeof(AbpDddApplicationContractsModule))]
public class AbpDynamicQueryableApplicationContractsModule : AbpModule
{
}

8
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/Dto/DynamicParamterDto.cs

@ -0,0 +1,8 @@
namespace LINGYUN.Abp.Dynamic.Queryable;
public class DynamicParamterDto
{
public string Name { get; set; }
public string Description { get; set; }
public string Type { get; set; }
}

11
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/Dto/GetListByDynamicQueryableInput.cs

@ -0,0 +1,11 @@
using LINGYUN.Linq.Dynamic.Queryable;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.Dynamic.Queryable;
public class GetListByDynamicQueryableInput : PagedAndSortedResultRequestDto
{
[Required]
public DynamicQueryable Queryable { get; set; }
}

19
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN/Abp/Dynamic/Queryable/IDynamicQueryableAppService.cs

@ -0,0 +1,19 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.Dynamic.Queryable;
public interface IDynamicQueryableAppService<TEntityDto>
{
/// <summary>
/// 获取可用字段列表
/// </summary>
/// <returns></returns>
Task<ListResultDto<DynamicParamterDto>> GetAvailableFieldsAsync();
/// <summary>
/// 根据动态条件查询数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<PagedResultDto<TEntityDto>> GetListAsync(GetListByDynamicQueryableInput input);
}

3
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN.Abp.Dynamic.Queryable.Application.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableApplicationModule.cs

@ -0,0 +1,11 @@
using Volo.Abp.Application;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Dynamic.Queryable;
[DependsOn(
typeof(AbpDynamicQueryableApplicationContractsModule),
typeof(AbpDddApplicationModule))]
public class AbpDynamicQueryableApplicationModule : AbpModule
{
}

21
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableOptions.cs

@ -0,0 +1,21 @@
using System.Collections.Generic;
using Volo.Abp.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.Dynamic.Queryable;
public class AbpDynamicQueryableOptions
{
public List<string> IgnoreFields { get; }
public AbpDynamicQueryableOptions()
{
IgnoreFields = new List<string>
{
nameof(IMultiTenant.TenantId),
nameof(IDeletionAuditedObject.IsDeleted),
nameof(IDeletionAuditedObject.DeleterId),
nameof(IDeletionAuditedObject.DeletionTime),
};
}
}

74
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/LINGYUN/Abp/Dynamic/Queryable/DynamicQueryableAppService.cs

@ -0,0 +1,74 @@
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.Dynamic.Queryable;
public abstract class DynamicQueryableAppService<TEntity, TEntityDto> : ApplicationService, IDynamicQueryableAppService<TEntityDto>
{
/// <summary>
/// 获取可用字段列表
/// </summary>
/// <returns></returns>
public virtual Task<ListResultDto<DynamicParamterDto>> GetAvailableFieldsAsync()
{
var options = LazyServiceProvider.LazyGetRequiredService<IOptions<AbpDynamicQueryableOptions>>().Value;
var entityType = typeof(TEntity);
var dynamicParamters = new List<DynamicParamterDto>();
var propertyInfos = entityType
.GetProperties()
.Where(p => !options.IgnoreFields.Contains(p.Name));
foreach (var propertyInfo in propertyInfos)
{
// 字段本地化描述规则
// 在本地化文件中定义 DisplayName:PropertyName
var localizedProp = L[$"DisplayName:{propertyInfo.Name}"];
dynamicParamters.Add(
new DynamicParamterDto
{
Name = propertyInfo.Name,
Type = propertyInfo.PropertyType.FullName,
Description = localizedProp.Value ?? propertyInfo.Name
});
}
return Task.FromResult(new ListResultDto<DynamicParamterDto>(dynamicParamters));
}
/// <summary>
/// 根据动态条件查询数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async virtual Task<PagedResultDto<TEntityDto>> GetListAsync(GetListByDynamicQueryableInput input)
{
Expression<Func<TEntity, bool>> condition = (e) => true;
condition = condition.DynamicQuery(input.Queryable);
var totalCount = await GetCountAsync(condition);
var entities = await GetListAsync(condition, input);
return new PagedResultDto<TEntityDto>(totalCount,
MapToEntitiesDto(entities));
}
protected abstract Task<int> GetCountAsync(Expression<Func<TEntity, bool>> condition);
protected abstract Task<List<TEntity>> GetListAsync(
Expression<Func<TEntity, bool>> condition,
PagedAndSortedResultRequestDto pageRequest);
protected virtual List<TEntityDto> MapToEntitiesDto(List<TEntity> entities)
{
return ObjectMapper.Map<List<TEntity>, List<TEntityDto>>(entities);
}
}

3
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/LINGYUN.Abp.Dynamic.Queryable.HttpApi.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj" />
</ItemGroup>
</Project>

18
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/LINGYUN/Abp/Dynamic/Queryable/AbpDynamicQueryableHttpApiModule.cs

@ -0,0 +1,18 @@
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Dynamic.Queryable;
[DependsOn(
typeof(AbpDynamicQueryableApplicationContractsModule),
typeof(AbpAspNetCoreMvcModule))]
public class AbpDynamicQueryableHttpApiModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
//PreConfigure<IMvcBuilder>(mvcBuilder =>
//{
// mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpDynamicQueryableHttpApiModule).Assembly);
//});
}
}

31
aspnet-core/modules/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/LINGYUN/Abp/Dynamic/Queryable/DynamicQueryableControllerBase.cs

@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.Dynamic.Queryable;
public abstract class DynamicQueryableControllerBase<TEntityDto> : AbpControllerBase, IDynamicQueryableAppService<TEntityDto>
{
protected IDynamicQueryableAppService<TEntityDto> DynamicQueryableAppService { get; }
protected DynamicQueryableControllerBase(
IDynamicQueryableAppService<TEntityDto> dynamicQueryableAppService)
{
DynamicQueryableAppService = dynamicQueryableAppService;
}
[HttpGet]
[Route("available-fields")]
public Task<ListResultDto<DynamicParamterDto>> GetAvailableFieldsAsync()
{
return DynamicQueryableAppService.GetAvailableFieldsAsync();
}
[HttpPost]
[Route("search")]
public Task<PagedResultDto<TEntityDto>> GetListAsync(GetListByDynamicQueryableInput input)
{
return DynamicQueryableAppService.GetListAsync(input);
}
}

3
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

11
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN.Linq.Dynamic.Queryable.csproj

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
</Project>

53
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicComparison.cs

@ -0,0 +1,53 @@
namespace LINGYUN.Linq.Dynamic.Queryable;
public enum DynamicComparison
{
/// <summary>
/// 等于
/// </summary>
Equal = 0,
/// <summary>
/// 不等于
/// </summary>
NotEqual = 1,
/// <summary>
/// 小于
/// </summary>
LessThan = 2,
/// <summary>
/// 小于等于
/// </summary>
LessThanOrEqual = 3,
/// <summary>
/// 大于
/// </summary>
GreaterThan = 4,
/// <summary>
/// 大于等于
/// </summary>
GreaterThanOrEqual = 5,
/// <summary>
/// 左包含
/// </summary>
StartsWith = 6,
/// <summary>
/// 左不包含
/// </summary>
NotStartsWith = 7,
/// <summary>
/// 右包含
/// </summary>
EndsWith = 8,
/// <summary>
/// 右不包含
/// </summary>
NotEndsWith = 9,
/// <summary>
/// 包含
/// </summary>
Contains = 10,
/// <summary>
/// 不包含
/// </summary>
NotContains = 11
}

13
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicLogic.cs

@ -0,0 +1,13 @@
namespace LINGYUN.Linq.Dynamic.Queryable;
public enum DynamicLogic
{
/// <summary>
/// 且
/// </summary>
And = 0,
/// <summary>
/// 或
/// </summary>
Or = 1
}

13
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicParamter.cs

@ -0,0 +1,13 @@
namespace LINGYUN.Linq.Dynamic.Queryable;
public class DynamicParamter
{
public string Filed { get; set; }
public DynamicLogic Logic { get; set; } = DynamicLogic.And;
public DynamicComparison Comparison { get; set; } = DynamicComparison.Equal;
public object Value { get; set; }
public string Type { get; set; }
}

8
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/LINGYUN/Linq/Dynamic/Queryable/DynamicQueryable.cs

@ -0,0 +1,8 @@
using System.Collections.Generic;
namespace LINGYUN.Linq.Dynamic.Queryable;
public class DynamicQueryable
{
public List<DynamicParamter> Paramters { get; set; } = new List<DynamicParamter>();
}

12
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.md

@ -0,0 +1,12 @@
# LINGYUN.Linq.Dynamic.Queryable
动态查询基本库, 扩展Linq, 动态构建表达式树
## 配置使用
模块按需引用, 只提供针对Linq的扩展
```csharp
```

119
aspnet-core/modules/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/System/Linq/Expressions/ObjectQueryableExtensions.cs

@ -0,0 +1,119 @@
using LINGYUN.Linq.Dynamic.Queryable;
using System.Collections.Generic;
using System.Reflection;
namespace System.Linq.Expressions;
public static class ObjectQueryableExtensions
{
public static Expression<T> DynamicQuery<T>(
this Expression<T> condition,
DynamicQueryable queryable)
{
var typeExpression = condition.Parameters.FirstOrDefault();
return BuildExpressions(condition, typeExpression, queryable.Paramters);
}
private static Expression<T> BuildExpressions<T>(
Expression<T> condition,
Expression typeExpression,
List<DynamicParamter> paramters)
{
var expressions = new Stack<Expression>();
foreach (var paramter in paramters)
{
Expression exp = null;
Type propertyType = null;
var leftParamter = Expression.PropertyOrField(typeExpression, paramter.Filed);
if (!string.IsNullOrWhiteSpace(paramter.Type))
{
propertyType = Type.GetType(paramter.Type, true);
}
else
{
propertyType = (leftParamter.Member as PropertyInfo)?.PropertyType ?? paramter.Value.GetType();
}
var rightParamter = Expression.Convert(Expression.Constant(paramter.Value), propertyType);
switch (paramter.Comparison)
{
case DynamicComparison.Equal:
exp = Expression.Equal(leftParamter, rightParamter);
break;
case DynamicComparison.NotEqual:
exp = Expression.NotEqual(leftParamter, rightParamter);
break;
case DynamicComparison.LessThan:
exp = Expression.LessThan(leftParamter, rightParamter);
break;
case DynamicComparison.LessThanOrEqual:
exp = Expression.LessThanOrEqual(leftParamter, rightParamter);
break;
case DynamicComparison.GreaterThan:
exp = Expression.GreaterThan(leftParamter, rightParamter);
break;
case DynamicComparison.GreaterThanOrEqual:
exp = Expression.GreaterThanOrEqual(leftParamter, rightParamter);
break;
case DynamicComparison.StartsWith:
exp = Expression.Call(
leftParamter,
typeof(string).GetMethod(nameof(String.StartsWith), new[] { typeof(string) }),
rightParamter);
break;
case DynamicComparison.NotStartsWith:
exp = Expression.Not(
Expression.Call(
leftParamter,
typeof(string).GetMethod(nameof(String.StartsWith), new[] { typeof(string) }),
rightParamter));
break;
case DynamicComparison.EndsWith:
exp = Expression.Call(
leftParamter,
typeof(string).GetMethod(nameof(String.EndsWith), new[] { typeof(string) }),
rightParamter);
break;
case DynamicComparison.NotEndsWith:
exp = Expression.Not(
Expression.Call(
leftParamter,
typeof(string).GetMethod(nameof(String.EndsWith), new[] { typeof(string) }),
rightParamter));
break;
case DynamicComparison.Contains:
exp = Expression.Call(
leftParamter,
typeof(string).GetMethod(nameof(String.Contains), new[] { typeof(string) }),
rightParamter);
break;
case DynamicComparison.NotContains:
exp = Expression.Not(
Expression.Call(
leftParamter,
typeof(string).GetMethod(nameof(String.Contains), new[] { typeof(string) }),
rightParamter));
break;
}
expressions.Push(exp);
while (expressions.Count > 1)
{
var exp1 = expressions.Pop();
var exp2 = expressions.Pop();
switch (paramter.Logic)
{
case DynamicLogic.And:
expressions.Push(Expression.AndAlso(exp1, exp2));
break;
case DynamicLogic.Or:
expressions.Push(Expression.Or(exp1, exp2));
break;
}
}
}
return Expression.Lambda<T>(expressions.Pop(), condition.Parameters.ToArray());
}
}

20
aspnet-core/modules/dynamic-queryable/README.md

@ -0,0 +1,20 @@
# Dynamic.Queryable
动态查询支持库, 为以后台服务提供动态查询支持
* 应用程序接口定义层引用**LINGYUN.Abp.Dynamic.Queryable.Application.Contracts**模块, 实现**IDynamicQueryableAppService**接口可对外提供动态查询支持
* 应用程序接口实现层引用**LINGYUN.Abp.Dynamic.Queryable.Application**模块,继承自**DynamicQueryableAppService**接口,实现**GetCountAsync**与**GetListAsync**方法即可(为仓储层接口提供传递的**Expression<Func<TEntity, bool>>**结构)
* 控制器层引用**LINGYUN.Abp.Dynamic.Queryable.HttpApi**模块,继承**DynamicQueryableControllerBase**接口,自动公开动态查询接口。
## 接口说明
* **GetAvailableFieldsAsync**(<font color="green">[GET]</font> <font color="blue">/{controller}/available-fields</font>): 对外提供可选的属性明细, 默认返回所有字段(不包含已定义的排除字段).
* **GetListAsync**(<font color="orange">[POST]</font> <font color="blue">/{controller}/search</font>): 根据用户传递的动态条件返回查询结果列表.
## 配置使用
* AbpDynamicQueryableOptions.IgnoreFields: 定义不对用户公开的字段列表,默认排除租户标识、软删除过滤器接口字段.

1
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN.Abp.TaskManagement.Application.Contracts.csproj

@ -14,6 +14,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TaskManagement.Domain.Shared\LINGYUN.Abp.TaskManagement.Domain.Shared.csproj" />
</ItemGroup>

6
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/IBackgroundJobInfoAppService.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using LINGYUN.Abp.Dynamic.Queryable;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
@ -10,7 +11,8 @@ public interface IBackgroundJobInfoAppService :
string,
BackgroundJobInfoGetListInput,
BackgroundJobInfoCreateDto,
BackgroundJobInfoUpdateDto>
BackgroundJobInfoUpdateDto>,
IDynamicQueryableAppService<BackgroundJobInfoDto>
{
Task TriggerAsync(string id);

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/TaskManagementApplicationContractsModule.cs

@ -1,9 +1,11 @@
using Volo.Abp.Application;
using LINGYUN.Abp.Dynamic.Queryable;
using Volo.Abp.Application;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TaskManagement;
[DependsOn(typeof(TaskManagementDomainSharedModule))]
[DependsOn(typeof(AbpDynamicQueryableApplicationContractsModule))]
[DependsOn(typeof(AbpDddApplicationContractsModule))]
public class TaskManagementApplicationContractsModule : AbpModule
{

1
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN.Abp.TaskManagement.Application.csproj

@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application\LINGYUN.Abp.Dynamic.Queryable.Application.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TaskManagement.Domain\LINGYUN.Abp.TaskManagement.Domain.csproj" />
</ItemGroup>

30
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs

@ -1,9 +1,14 @@
using LINGYUN.Abp.BackgroundTasks;
using LINGYUN.Abp.Dynamic.Queryable;
using LINGYUN.Abp.TaskManagement.Localization;
using LINGYUN.Abp.TaskManagement.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -12,7 +17,7 @@ using Volo.Abp.Data;
namespace LINGYUN.Abp.TaskManagement;
[Authorize(TaskManagementPermissions.BackgroundJobs.Default)]
public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBackgroundJobInfoAppService
public class BackgroundJobInfoAppService : DynamicQueryableAppService<BackgroundJobInfo, BackgroundJobInfoDto>, IBackgroundJobInfoAppService
{
protected AbpBackgroundTasksOptions Options { get; }
protected BackgroundJobManager BackgroundJobManager { get; }
@ -29,6 +34,9 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
JobDefinitionManager = jobDefinitionManager;
BackgroundJobInfoRepository = backgroundJobInfoRepository;
Options = options.Value;
LocalizationResource = typeof(TaskManagementResource);
ObjectMapperContext = typeof(TaskManagementApplicationModule);
}
public virtual Task<ListResultDto<BackgroundJobDefinitionDto>> GetDefinitionsAsync()
@ -351,4 +359,24 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
await AuthorizationService.CheckAsync(TaskManagementPermissions.BackgroundJobs.ManageSystemJobs);
}
}
protected async override Task<int> GetCountAsync(
Expression<Func<BackgroundJobInfo, bool>> condition)
{
var queryable = await BackgroundJobInfoRepository.GetQueryableAsync();
return await AsyncExecuter.CountAsync(queryable.Where(condition));
}
protected async override Task<List<BackgroundJobInfo>> GetListAsync(
Expression<Func<BackgroundJobInfo, bool>> condition,
PagedAndSortedResultRequestDto pageRequest)
{
var queryable = await BackgroundJobInfoRepository.GetQueryableAsync();
return await AsyncExecuter.ToListAsync(
queryable.Where(condition)
.PageBy(pageRequest.SkipCount, pageRequest.MaxResultCount)
.OrderBy(pageRequest.Sorting ?? $"{nameof(BackgroundJobInfo.CreationTime)} DESC"));
}
}

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationModule.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using LINGYUN.Abp.Dynamic.Queryable;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Application;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
@ -6,6 +7,7 @@ using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TaskManagement;
[DependsOn(typeof(TaskManagementApplicationContractsModule))]
[DependsOn(typeof(AbpDynamicQueryableApplicationModule))]
[DependsOn(typeof(TaskManagementDomainModule))]
[DependsOn(typeof(AbpDddApplicationModule))]
public class TaskManagementApplicationModule : AbpModule

1
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN.Abp.TaskManagement.HttpApi.csproj

@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.HttpApi\LINGYUN.Abp.Dynamic.Queryable.HttpApi.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj" />
</ItemGroup>

9
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs

@ -1,4 +1,6 @@
using LINGYUN.Abp.TaskManagement.Permissions;
using LINGYUN.Abp.Dynamic.Queryable;
using LINGYUN.Abp.TaskManagement.Localization;
using LINGYUN.Abp.TaskManagement.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
@ -11,14 +13,17 @@ namespace LINGYUN.Abp.TaskManagement;
[Area(TaskManagementRemoteServiceConsts.ModuleName)]
[Authorize(TaskManagementPermissions.BackgroundJobs.Default)]
[Route($"api/{TaskManagementRemoteServiceConsts.ModuleName}/background-jobs")]
public class BackgroundJobInfoController : TaskManagementController, IBackgroundJobInfoAppService
public class BackgroundJobInfoController : DynamicQueryableControllerBase<BackgroundJobInfoDto>, IBackgroundJobInfoAppService
{
protected IBackgroundJobInfoAppService BackgroundJobInfoAppService { get; }
public BackgroundJobInfoController(
IBackgroundJobInfoAppService backgroundJobInfoAppService)
: base(backgroundJobInfoAppService)
{
BackgroundJobInfoAppService = backgroundJobInfoAppService;
LocalizationResource = typeof(TaskManagementResource);
}
[HttpPost]

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/TaskManagementHttpApiModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.BackgroundTasks.Localization;
using LINGYUN.Abp.Dynamic.Queryable;
using LINGYUN.Abp.TaskManagement.Localization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
@ -10,6 +11,7 @@ using Volo.Abp.Validation.Localization;
namespace LINGYUN.Abp.TaskManagement;
[DependsOn(typeof(TaskManagementApplicationContractsModule))]
[DependsOn(typeof(AbpDynamicQueryableHttpApiModule))]
[DependsOn(typeof(AbpAspNetCoreMvcModule))]
public class TaskManagementHttpApiModule : AbpModule
{

4
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/LY.MicroService.TaskManagement.HttpApi.Host.csproj

@ -77,4 +77,8 @@
<ProjectReference Include="..\..\modules\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Modules\" />
</ItemGroup>
</Project>

Loading…
Cancel
Save