DDD 应用层完善

This commit is contained in:
橙子
2023-01-15 14:32:43 +08:00
parent 3bce7de015
commit f1e314fa13
60 changed files with 915 additions and 83 deletions

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.Ddd.Dtos
{
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.Ddd.Dtos
{
public interface IListResult<T>
{
IReadOnlyList<T> Items { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Ddd.Dtos.Abstract
{
public interface IPagedAllResultRequestDto
{
DateTime? StartTime { get; set; }
DateTime? EndTime { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Ddd.Dtos
{
public interface IPagedAndSortedResultRequestDto
{
int PageIndex { get; set; }
int PageSize { get; set; }
string? PageSort { 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.Ddd.Dtos
{
public interface IPagedResult<T> : IListResult<T>, IHasTotalCount
{
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.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,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Ddd.Dtos
{
public class PagedAllResultRequestDto: PagedAndSortedResultRequestDto
{
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Ddd.Dtos
{
public class PagedAndSortedResultRequestDto : IPagedAndSortedResultRequestDto
{
public int PageIndex { get; set; }
public int PageSize { get; set; }
public string? PageSort { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.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;
}
}
}