refactor: ai+人工重构优化 framework
This commit is contained in:
@@ -3,8 +3,17 @@ using Volo.Abp.Application.Services;
|
||||
|
||||
namespace Yi.Framework.Ddd.Application.Contracts
|
||||
{
|
||||
public interface IDeletesAppService<in TKey> : IDeleteAppService< TKey> , IApplicationService, IRemoteService
|
||||
/// <summary>
|
||||
/// 批量删除服务接口
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">主键类型</typeparam>
|
||||
public interface IDeletesAppService<in TKey> : IDeleteAppService<TKey>, IApplicationService, IRemoteService
|
||||
{
|
||||
/// <summary>
|
||||
/// 批量删除实体
|
||||
/// </summary>
|
||||
/// <param name="ids">要删除的实体ID集合</param>
|
||||
/// <returns>删除操作的异步任务</returns>
|
||||
Task DeleteAsync(IEnumerable<TKey> ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,19 @@
|
||||
|
||||
namespace Yi.Framework.Ddd.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// 带时间范围的分页查询请求接口
|
||||
/// </summary>
|
||||
public interface IPageTimeResultRequestDto : IPagedAndSortedResultRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询开始时间
|
||||
/// </summary>
|
||||
DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询结束时间
|
||||
/// </summary>
|
||||
DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace Yi.Framework.Ddd.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// 分页查询请求接口,包含时间范围和排序功能
|
||||
/// </summary>
|
||||
public interface IPagedAllResultRequestDto : IPageTimeResultRequestDto, IPagedAndSortedResultRequest
|
||||
{
|
||||
}
|
||||
|
||||
@@ -7,24 +7,47 @@ using Volo.Abp.Application.Services;
|
||||
|
||||
namespace Yi.Framework.Ddd.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Yi框架CRUD服务基础接口
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntityDto">实体DTO类型</typeparam>
|
||||
/// <typeparam name="TKey">主键类型</typeparam>
|
||||
public interface IYiCrudAppService<TEntityDto, in TKey> : ICrudAppService<TEntityDto, TKey>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Yi框架CRUD服务接口(带查询输入)
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntityDto">实体DTO类型</typeparam>
|
||||
/// <typeparam name="TKey">主键类型</typeparam>
|
||||
/// <typeparam name="TGetListInput">查询输入类型</typeparam>
|
||||
public interface IYiCrudAppService<TEntityDto, in TKey, in TGetListInput> : ICrudAppService<TEntityDto, TKey, TGetListInput>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Yi框架CRUD服务接口(带查询输入和创建输入)
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntityDto">实体DTO类型</typeparam>
|
||||
/// <typeparam name="TKey">主键类型</typeparam>
|
||||
/// <typeparam name="TGetListInput">查询输入类型</typeparam>
|
||||
/// <typeparam name="TCreateInput">创建输入类型</typeparam>
|
||||
public interface IYiCrudAppService<TEntityDto, in TKey, in TGetListInput, in TCreateInput> : ICrudAppService<TEntityDto, TKey, TGetListInput, TCreateInput>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Yi框架CRUD服务接口(带查询、创建和更新输入)
|
||||
/// </summary>
|
||||
public interface IYiCrudAppService<TEntityDto, in TKey, in TGetListInput, in TCreateInput, in TUpdateInput> : ICrudAppService<TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Yi框架完整CRUD服务接口(包含所有操作和批量删除功能)
|
||||
/// </summary>
|
||||
public interface IYiCrudAppService<TGetOutputDto, TGetListOutputDto, in TKey, in TGetListInput, in TCreateInput, in TUpdateInput> : ICrudAppService<TGetOutputDto, TGetListOutputDto, TKey, TGetListInput, TCreateInput, TUpdateInput>, IDeletesAppService<TKey>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,48 +2,50 @@
|
||||
|
||||
namespace Yi.Framework.Ddd.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// 分页查询请求DTO,包含时间范围和自定义排序功能
|
||||
/// </summary>
|
||||
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPagedAllResultRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询开始时间条件
|
||||
/// 查询开始时间
|
||||
/// </summary>
|
||||
public DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询结束时间条件
|
||||
/// 查询结束时间
|
||||
/// </summary>
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序列名,字段名对应前端
|
||||
/// 排序列名
|
||||
/// </summary>
|
||||
public string? OrderByColumn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否顺序,字段名对应前端
|
||||
/// 排序方向(ascending/descending)
|
||||
/// </summary>
|
||||
public string? IsAsc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否顺序
|
||||
/// 是否为升序排序
|
||||
/// </summary>
|
||||
public bool CanAsc => IsAsc?.ToLower() == "ascending" ? true : false;
|
||||
public bool IsAscending => string.Equals(IsAsc, "ascending", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private string _sorting;
|
||||
private string? _sorting;
|
||||
|
||||
//排序引用
|
||||
public new string? Sorting
|
||||
/// <summary>
|
||||
/// 排序表达式
|
||||
/// </summary>
|
||||
public override string? Sorting
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!OrderByColumn.IsNullOrWhiteSpace())
|
||||
if (!string.IsNullOrWhiteSpace(OrderByColumn))
|
||||
{
|
||||
return $"{OrderByColumn} {(CanAsc ? "ASC" : "DESC")}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return _sorting;
|
||||
return $"{OrderByColumn} {(IsAscending ? "ASC" : "DESC")}";
|
||||
}
|
||||
return _sorting;
|
||||
}
|
||||
set => _sorting = value;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ using Volo.Abp.Modularity;
|
||||
|
||||
namespace Yi.Framework.Ddd.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Yi框架DDD应用层契约模块
|
||||
/// </summary>
|
||||
[DependsOn(typeof(AbpDddApplicationContractsModule))]
|
||||
public class YiFrameworkDddApplicationContractsModule : AbpModule
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user