mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-20 16:36:37 +08:00
DDD 应用层完善
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user