chore:目录重构

This commit is contained in:
陈淳
2023-04-15 17:35:22 +08:00
parent a612af4f68
commit fb27fb8aa4
238 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Ddd.Dtos.Abstract
{
public interface IEntityDto
{
}
public interface IEntityDto<TKey> : IEntityDto
{
TKey Id { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Ddd.Dtos.Abstract
{
public interface IHasTotalCount
{
long Total { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Ddd.Dtos.Abstract
{
public interface IListResult<T>
{
IReadOnlyList<T> Items { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
namespace Yi.Framework.Infrastructure.Ddd.Dtos.Abstract
{
public interface IPagedAllResultRequestDto : IPageTimeResultRequestDto, IPagedAndSortedResultRequestDto
{
}
}

View File

@@ -0,0 +1,15 @@

using Yi.Framework.Infrastructure.Enums;
namespace Yi.Framework.Infrastructure.Ddd.Dtos.Abstract
{
public interface IPagedAndSortedResultRequestDto
{
int PageNum { get; set; }
int PageSize { get; set; }
string? SortBy { get; set; }
OrderByEnum SortType { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Ddd.Dtos.Abstract
{
public interface IPagedResult<T> : IListResult<T>, IHasTotalCount
{
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Infrastructure.Ddd.Dtos
{
[Serializable]
public abstract class EntityDto<TKey> : EntityDto, IEntityDto<TKey>, IEntityDto
{
//
// 摘要:
// Id of the entity.
public TKey Id { get; set; }
public override string ToString()
{
return $"[DTO: {GetType().Name}] Id = {Id}";
}
}
[Serializable]
public abstract class EntityDto : IEntityDto
{
public override string ToString()
{
return "[DTO: " + GetType().Name + "]";
}
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Infrastructure.Ddd.Dtos
{
[Serializable]
public class ListResultDto<T> : IListResult<T>
{
public IReadOnlyList<T> Items
{
get { return _items ?? (_items = new List<T>()); }
set { _items = value; }
}
private IReadOnlyList<T> _items;
public ListResultDto()
{
}
public ListResultDto(IReadOnlyList<T> items)
{
Items = items;
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
namespace Yi.Framework.Infrastructure.Ddd.Dtos
{
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPagedAllResultRequestDto, IPagedAndSortedResultRequestDto, IPageTimeResultRequestDto
{
/// <summary>
/// 查询开始时间条件
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 查询结束时间条件
/// </summary>
public DateTime? EndTime { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Framework.Infrastructure.Enums;
namespace Yi.Framework.Infrastructure.Ddd.Dtos
{
public class PagedAndSortedResultRequestDto : IPagedAndSortedResultRequestDto
{
/// <summary>
/// 查询当前页条件
/// </summary>
public int PageNum { get; set; } = 1;
/// <summary>
/// 查询分页大小条件
/// </summary>
public int PageSize { get; set; } = int.MaxValue;
/// <summary>
/// 查询排序字段条件
/// </summary>
public string? SortBy { get; set; }
/// <summary>
/// 查询排序类别条件
/// </summary>
public OrderByEnum SortType { get; set; } = OrderByEnum.Desc;
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Ddd.Dtos
{
public class PagedDto<T>
{
public PagedDto(long totalCount, List<T> items)
{
Total = totalCount;
Items = items;
}
public long Total { get; set; }
public List<T> Items { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Infrastructure.Ddd.Dtos
{
public class PagedResultDto<T> : ListResultDto<T>, IPagedResult<T>
{
public long Total { get; set; }
public PagedResultDto()
{
}
public PagedResultDto(long totalCount, IReadOnlyList<T> items)
: base(items)
{
Total = totalCount;
}
}
}