diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.EN.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.EN.md new file mode 100644 index 000000000..b221cb6d1 --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.EN.md @@ -0,0 +1,52 @@ +# LINGYUN.Abp.Dynamic.Queryable.Application.Contracts + +Dynamic query application service contract module, defining interfaces and DTOs related to dynamic querying. + +## Features + +* Defines dynamic query application service interface `IDynamicQueryableAppService` +* Provides DTO definitions for dynamic querying +* Supports parameter options and comparison operator definitions + +## Configuration and Usage + +1. Install the `LINGYUN.Abp.Dynamic.Queryable.Application.Contracts` NuGet package + +2. Add `[DependsOn(typeof(AbpDynamicQueryableApplicationContractsModule))]` to your module class + +### Interface Description + +```csharp +public interface IDynamicQueryableAppService +{ + // Get available fields list + Task> GetAvailableFieldsAsync(); + + // Query data based on dynamic conditions + Task> SearchAsync(GetListByDynamicQueryableInput dynamicInput); +} +``` + +### DTO Description + +* `DynamicParamterDto` - Dynamic parameter DTO + * `Name` - Field name + * `Type` - Field type + * `Description` - Field description + * `JavaScriptType` - JavaScript type + * `AvailableComparator` - Available comparison operators + * `Options` - Parameter options (for enum types) + +* `ParamterOptionDto` - Parameter option DTO + * `Key` - Option key + * `Value` - Option value + +* `GetListByDynamicQueryableInput` - Dynamic query input DTO + * `SkipCount` - Number of records to skip + * `MaxResultCount` - Maximum number of records to return + * `Queryable` - Query conditions + +## Related Links + +* [LINGYUN.Linq.Dynamic.Queryable](../LINGYUN.Linq.Dynamic.Queryable/README.EN.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application](../LINGYUN.Abp.Dynamic.Queryable.Application/README.EN.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.md new file mode 100644 index 000000000..294f7b216 --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.md @@ -0,0 +1,52 @@ +# LINGYUN.Abp.Dynamic.Queryable.Application.Contracts + +动态查询应用服务契约模块,定义了动态查询相关的接口和DTO。 + +## 功能特性 + +* 定义动态查询应用服务接口 `IDynamicQueryableAppService` +* 提供动态查询相关的DTO定义 +* 支持参数选项和比较运算符的定义 + +## 配置使用 + +1. 安装 `LINGYUN.Abp.Dynamic.Queryable.Application.Contracts` NuGet包 + +2. 添加 `[DependsOn(typeof(AbpDynamicQueryableApplicationContractsModule))]` 到你的模块类 + +### 接口说明 + +```csharp +public interface IDynamicQueryableAppService +{ + // 获取可用字段列表 + Task> GetAvailableFieldsAsync(); + + // 根据动态条件查询数据 + Task> SearchAsync(GetListByDynamicQueryableInput dynamicInput); +} +``` + +### DTO说明 + +* `DynamicParamterDto` - 动态参数DTO + * `Name` - 字段名称 + * `Type` - 字段类型 + * `Description` - 字段描述 + * `JavaScriptType` - JavaScript类型 + * `AvailableComparator` - 可用的比较运算符 + * `Options` - 参数选项(用于枚举类型) + +* `ParamterOptionDto` - 参数选项DTO + * `Key` - 选项键 + * `Value` - 选项值 + +* `GetListByDynamicQueryableInput` - 动态查询输入DTO + * `SkipCount` - 跳过记录数 + * `MaxResultCount` - 最大返回记录数 + * `Queryable` - 查询条件 + +## 相关链接 + +* [LINGYUN.Linq.Dynamic.Queryable](../LINGYUN.Linq.Dynamic.Queryable/README.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application](../LINGYUN.Abp.Dynamic.Queryable.Application/README.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/README.EN.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/README.EN.md new file mode 100644 index 000000000..fb5f14cc8 --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/README.EN.md @@ -0,0 +1,76 @@ +# LINGYUN.Abp.Dynamic.Queryable.Application + +Dynamic query application service module, providing dynamic query functionality implementation based on the ABP framework. + +## Features + +* Provides dynamic query application service base class `DynamicQueryableAppService` +* Automatically generates available field list with localization support +* Supports field filtering and ignoring +* Supports enum type option list generation + +## Configuration and Usage + +1. Install the `LINGYUN.Abp.Dynamic.Queryable.Application` NuGet package + +2. Add `[DependsOn(typeof(AbpDynamicQueryableApplicationModule))]` to your module class + +3. Configure options (optional) + +```csharp +Configure(options => +{ + // Add fields to ignore + options.IgnoreFields.Add("FieldName"); +}); +``` + +### Implementing Dynamic Query Service + +```csharp +public class MyEntityAppService : DynamicQueryableAppService +{ + private readonly IRepository _repository; + + public MyEntityAppService(IRepository repository) + { + _repository = repository; + } + + protected override async Task GetCountAsync(Expression> condition) + { + return await _repository.CountAsync(condition); + } + + protected override async Task> GetListAsync( + Expression> condition, + GetListByDynamicQueryableInput dynamicInput) + { + return await _repository + .Where(condition) + .PageBy(dynamicInput.SkipCount, dynamicInput.MaxResultCount) + .ToListAsync(); + } + + protected override List MapToEntitiesDto(List entities) + { + return ObjectMapper.Map, List>(entities); + } + + // Custom fields to ignore (optional) + protected override IEnumerable GetUserDefineIgnoreFields() + { + return new[] { "CustomField" }; + } +} +``` + +### Configuration Options + +* `IgnoreFields` - List of fields to ignore in queries + * Defaults include: Id, TenantId, IsDeleted, DeleterId, DeletionTime and other audit fields + +## Related Links + +* [LINGYUN.Linq.Dynamic.Queryable](../LINGYUN.Linq.Dynamic.Queryable/README.EN.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application.Contracts](../LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.EN.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/README.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/README.md new file mode 100644 index 000000000..679c0d3b3 --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application/README.md @@ -0,0 +1,76 @@ +# LINGYUN.Abp.Dynamic.Queryable.Application + +动态查询应用服务模块,提供基于ABP框架的动态查询功能实现。 + +## 功能特性 + +* 提供动态查询应用服务基类 `DynamicQueryableAppService` +* 自动生成可用字段列表,支持字段本地化 +* 支持字段过滤和忽略 +* 支持枚举类型的选项列表生成 + +## 配置使用 + +1. 安装 `LINGYUN.Abp.Dynamic.Queryable.Application` NuGet包 + +2. 添加 `[DependsOn(typeof(AbpDynamicQueryableApplicationModule))]` 到你的模块类 + +3. 配置选项(可选) + +```csharp +Configure(options => +{ + // 添加需要忽略的字段 + options.IgnoreFields.Add("FieldName"); +}); +``` + +### 实现动态查询服务 + +```csharp +public class MyEntityAppService : DynamicQueryableAppService +{ + private readonly IRepository _repository; + + public MyEntityAppService(IRepository repository) + { + _repository = repository; + } + + protected override async Task GetCountAsync(Expression> condition) + { + return await _repository.CountAsync(condition); + } + + protected override async Task> GetListAsync( + Expression> condition, + GetListByDynamicQueryableInput dynamicInput) + { + return await _repository + .Where(condition) + .PageBy(dynamicInput.SkipCount, dynamicInput.MaxResultCount) + .ToListAsync(); + } + + protected override List MapToEntitiesDto(List entities) + { + return ObjectMapper.Map, List>(entities); + } + + // 自定义需要忽略的字段(可选) + protected override IEnumerable GetUserDefineIgnoreFields() + { + return new[] { "CustomField" }; + } +} +``` + +### 配置项说明 + +* `IgnoreFields` - 需要在查询中忽略的字段列表 + * 默认包含:Id、TenantId、IsDeleted、DeleterId、DeletionTime等审计字段 + +## 相关链接 + +* [LINGYUN.Linq.Dynamic.Queryable](../LINGYUN.Linq.Dynamic.Queryable/README.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application.Contracts](../LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/README.EN.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/README.EN.md new file mode 100644 index 000000000..605de7d61 --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/README.EN.md @@ -0,0 +1,58 @@ +# LINGYUN.Abp.Dynamic.Queryable.HttpApi + +Dynamic query HTTP API module, providing HTTP API implementation for dynamic querying based on the ABP framework. + +## Features + +* Provides dynamic query controller base class `DynamicQueryableControllerBase` +* Automatically generates REST API endpoints +* Supports HTTP transport of dynamic query parameters + +## Configuration and Usage + +1. Install the `LINGYUN.Abp.Dynamic.Queryable.HttpApi` NuGet package + +2. Add `[DependsOn(typeof(AbpDynamicQueryableHttpApiModule))]` to your module class + +### Implementing Dynamic Query Controller + +```csharp +[Route("api/my-entity")] +public class MyEntityController : DynamicQueryableControllerBase +{ + public MyEntityController(IDynamicQueryableAppService dynamicQueryableAppService) + : base(dynamicQueryableAppService) + { + } +} +``` + +### API Endpoints + +* GET `/api/my-entity/available-fields` - Get available fields list +* POST `/api/my-entity/search` - Query data based on dynamic conditions + +### Query Example + +```json +POST /api/my-entity/search +{ + "maxResultCount": 10, + "skipCount": 0, + "queryable": { + "paramters": [ + { + "field": "Name", + "comparison": "Equal", + "value": "test" + } + ] + } +} +``` + +## Related Links + +* [LINGYUN.Linq.Dynamic.Queryable](../LINGYUN.Linq.Dynamic.Queryable/README.EN.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application](../LINGYUN.Abp.Dynamic.Queryable.Application/README.EN.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application.Contracts](../LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.EN.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/README.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/README.md new file mode 100644 index 000000000..031934aab --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.HttpApi/README.md @@ -0,0 +1,58 @@ +# LINGYUN.Abp.Dynamic.Queryable.HttpApi + +动态查询HTTP API模块,提供基于ABP框架的动态查询HTTP API实现。 + +## 功能特性 + +* 提供动态查询控制器基类 `DynamicQueryableControllerBase` +* 自动生成REST API端点 +* 支持动态查询参数的HTTP传输 + +## 配置使用 + +1. 安装 `LINGYUN.Abp.Dynamic.Queryable.HttpApi` NuGet包 + +2. 添加 `[DependsOn(typeof(AbpDynamicQueryableHttpApiModule))]` 到你的模块类 + +### 实现动态查询控制器 + +```csharp +[Route("api/my-entity")] +public class MyEntityController : DynamicQueryableControllerBase +{ + public MyEntityController(IDynamicQueryableAppService dynamicQueryableAppService) + : base(dynamicQueryableAppService) + { + } +} +``` + +### API端点 + +* GET `/api/my-entity/available-fields` - 获取可用字段列表 +* POST `/api/my-entity/search` - 根据动态条件查询数据 + +### 查询示例 + +```json +POST /api/my-entity/search +{ + "maxResultCount": 10, + "skipCount": 0, + "queryable": { + "paramters": [ + { + "field": "Name", + "comparison": "Equal", + "value": "test" + } + ] + } +} +``` + +## 相关链接 + +* [LINGYUN.Linq.Dynamic.Queryable](../LINGYUN.Linq.Dynamic.Queryable/README.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application](../LINGYUN.Abp.Dynamic.Queryable.Application/README.md) +* [LINGYUN.Abp.Dynamic.Queryable.Application.Contracts](../LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/README.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.EN.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.EN.md new file mode 100644 index 000000000..d6099ee18 --- /dev/null +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.EN.md @@ -0,0 +1,58 @@ +# LINGYUN.Linq.Dynamic.Queryable + +A basic library for dynamic querying, extending Linq to dynamically build expression trees. + +## Features + +* Support for dynamic query condition building +* Support for various comparison operators: equal, not equal, greater than, less than, greater than or equal, less than or equal, contains, not contains, starts with, not starts with, ends with, not ends with, etc. +* Support for dynamic type conversion and null value handling +* Support for dynamic querying of enum types + +## Configuration and Usage + +The module can be referenced as needed, providing extensions only for Linq. + +### Basic Usage + +```csharp +// Create dynamic query parameter +var parameter = new DynamicParamter +{ + Field = "Name", + Comparison = DynamicComparison.Equal, + Value = "test" +}; + +// Create query condition +var queryable = new DynamicQueryable +{ + Paramters = new List { parameter } +}; + +// Apply to Expression +Expression> condition = e => true; +condition = condition.DynamicQuery(queryable); + +// Query using the condition +var result = await repository.Where(condition).ToListAsync(); +``` + +### Supported Comparison Operators + +* `Equal` - Equals +* `NotEqual` - Not equals +* `LessThan` - Less than +* `LessThanOrEqual` - Less than or equal to +* `GreaterThan` - Greater than +* `GreaterThanOrEqual` - Greater than or equal to +* `Contains` - Contains +* `NotContains` - Does not contain +* `StartsWith` - Starts with +* `NotStartsWith` - Does not start with +* `EndsWith` - Ends with +* `NotEndsWith` - Does not end with + +## Related Links + +* [LINGYUN.Abp.Dynamic.Queryable.Application](../LINGYUN.Abp.Dynamic.Queryable.Application/README.EN.md) diff --git a/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.md b/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.md index 5ef0300a2..0d277f230 100644 --- a/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.md +++ b/aspnet-core/framework/dynamic-queryable/LINGYUN.Linq.Dynamic.Queryable/README.md @@ -2,11 +2,57 @@ 动态查询基本库, 扩展Linq, 动态构建表达式树 +## 功能特性 + +* 支持动态构建查询条件 +* 支持多种比较运算符:等于、不等于、大于、小于、大于等于、小于等于、包含、不包含、开始于、不开始于、结束于、不结束于等 +* 支持动态类型转换和空值处理 +* 支持枚举类型的动态查询 + ## 配置使用 -模块按需引用, 只提供针对Linq的扩展 +模块按需引用, 只提供针对Linq的扩展。 + +### 基本用法 ```csharp +// 创建动态查询参数 +var parameter = new DynamicParamter +{ + Field = "Name", + Comparison = DynamicComparison.Equal, + Value = "test" +}; + +// 创建查询条件 +var queryable = new DynamicQueryable +{ + Paramters = new List { parameter } +}; +// 应用到Expression +Expression> condition = e => true; +condition = condition.DynamicQuery(queryable); + +// 使用条件进行查询 +var result = await repository.Where(condition).ToListAsync(); ``` +### 支持的比较运算符 + +* `Equal` - 等于 +* `NotEqual` - 不等于 +* `LessThan` - 小于 +* `LessThanOrEqual` - 小于等于 +* `GreaterThan` - 大于 +* `GreaterThanOrEqual` - 大于等于 +* `Contains` - 包含 +* `NotContains` - 不包含 +* `StartsWith` - 开始于 +* `NotStartsWith` - 不开始于 +* `EndsWith` - 结束于 +* `NotEndsWith` - 不结束于 + +## 相关链接 + +* [LINGYUN.Abp.Dynamic.Queryable.Application](../LINGYUN.Abp.Dynamic.Queryable.Application/README.md)