添加excel模块
This commit is contained in:
@@ -9,39 +9,41 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{32A813F5-1
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "framework", "framework", "{5F2B846D-96CE-400A-878E-220498F4EE31}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "framework", "framework", "{5F2B846D-96CE-400A-878E-220498F4EE31}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core", "Yi.Framework.Core\Yi.Framework.Core.csproj", "{83B2D7AD-ED8E-4392-B0AE-4227498CD75F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core", "src\framework\Yi.Framework.Core\Yi.Framework.Core.csproj", "{83B2D7AD-ED8E-4392-B0AE-4227498CD75F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Application", "Yi.Framework.Application\Yi.Framework.Application.csproj", "{456835D1-4968-4195-9993-B2A580E85056}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Application", "test\Yi.Framework.Application\Yi.Framework.Application.csproj", "{456835D1-4968-4195-9993-B2A580E85056}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Application.Contracts", "Yi.Framework.Application.Contracts\Yi.Framework.Application.Contracts.csproj", "{D2378C23-2CFE-468A-924A-B8C9D4A3A8ED}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Application.Contracts", "test\Yi.Framework.Application.Contracts\Yi.Framework.Application.Contracts.csproj", "{D2378C23-2CFE-468A-924A-B8C9D4A3A8ED}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Domain", "Yi.Framework.Domain\Yi.Framework.Domain.csproj", "{C02A954D-CCCB-41BD-ADAD-9D7ECBF1A828}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Domain", "test\Yi.Framework.Domain\Yi.Framework.Domain.csproj", "{C02A954D-CCCB-41BD-ADAD-9D7ECBF1A828}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Domain.Shared", "Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj", "{26171153-1784-455B-9582-0558AEEC03CF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Domain.Shared", "test\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj", "{26171153-1784-455B-9582-0558AEEC03CF}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Sqlsugar", "Yi.Framework.Sqlsugar\Yi.Framework.Sqlsugar.csproj", "{3C3A7BAC-F27F-433E-BF91-289FA42E4995}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Sqlsugar", "test\Yi.Framework.Sqlsugar\Yi.Framework.Sqlsugar.csproj", "{3C3A7BAC-F27F-433E-BF91-289FA42E4995}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Web", "Yi.Framework.Web\Yi.Framework.Web.csproj", "{01CC7B62-F42C-45CE-BACA-F450593A1AF2}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Web", "test\Yi.Framework.Web\Yi.Framework.Web.csproj", "{01CC7B62-F42C-45CE-BACA-F450593A1AF2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.BackgroundJobs.Quartz", "Yi.Framework.BackgroundJobs.Quartz\Yi.Framework.BackgroundJobs.Quartz.csproj", "{1879A863-9864-4E16-8492-504055807684}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.BackgroundJobs.Quartz", "src\module\Yi.Framework.BackgroundJobs.Quartz\Yi.Framework.BackgroundJobs.Quartz.csproj", "{1879A863-9864-4E16-8492-504055807684}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Ddd", "Yi.Framework.Ddd.Application\Yi.Framework.Ddd.csproj", "{949F35A7-36E4-4080-9940-24BE52532078}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Ddd", "src\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj", "{949F35A7-36E4-4080-9940-24BE52532078}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core.Autofac", "Yi.Framework.Core.Autofac\Yi.Framework.Core.Autofac.csproj", "{63BA134E-9D23-4EB8-87E4-B45B33D954F5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core.Autofac", "src\framework\Yi.Framework.Core.Autofac\Yi.Framework.Core.Autofac.csproj", "{63BA134E-9D23-4EB8-87E4-B45B33D954F5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AspNetCore", "Yi.Framework.AspNetCore\Yi.Framework.AspNetCore.csproj", "{2F5E5843-14FB-48F1-AEB0-B9FFE103B972}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AspNetCore", "src\framework\Yi.Framework.AspNetCore\Yi.Framework.AspNetCore.csproj", "{2F5E5843-14FB-48F1-AEB0-B9FFE103B972}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching", "Yi.Framework.Caching\Yi.Framework.Caching.csproj", "{8767C5B7-3A17-4729-BCAA-B391B6A215AA}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching", "src\module\Yi.Framework.Caching\Yi.Framework.Caching.csproj", "{8767C5B7-3A17-4729-BCAA-B391B6A215AA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching.Redis", "Yi.Framework.Caching.Redis\Yi.Framework.Caching.Redis.csproj", "{F13D4F03-3FA0-43E9-BBAA-F618E1A3CF41}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching.Redis", "src\module\Yi.Framework.Caching.Redis\Yi.Framework.Caching.Redis.csproj", "{F13D4F03-3FA0-43E9-BBAA-F618E1A3CF41}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching.MemoryCache", "Yi.Framework.Caching.MemoryCache\Yi.Framework.Caching.MemoryCache.csproj", "{67CF07AB-2A72-4B36-A3A5-4CEB82B7C43C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching.MemoryCache", "src\module\Yi.Framework.Caching.MemoryCache\Yi.Framework.Caching.MemoryCache.csproj", "{67CF07AB-2A72-4B36-A3A5-4CEB82B7C43C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Uow", "Yi.Framework.Uow\Yi.Framework.Uow.csproj", "{3D83BE69-71BB-43BE-B3F1-A532215561CD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Uow", "src\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj", "{3D83BE69-71BB-43BE-B3F1-A532215561CD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core.Sqlsugar", "Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj", "{58F4071D-66B7-4839-A247-79AF0E4E1C8E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core.Sqlsugar", "src\framework\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj", "{58F4071D-66B7-4839-A247-79AF0E4E1C8E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core.AutoMapper", "Yi.Framework.Core.AutoMapper\Yi.Framework.Core.AutoMapper.csproj", "{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core.AutoMapper", "src\framework\Yi.Framework.Core.AutoMapper\Yi.Framework.Core.AutoMapper.csproj", "{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Office.Excel", "src\module\Yi.Framework.Office.Excel\Yi.Framework.Office.Excel.csproj", "{4EEC6607-F0D8-4277-9463-104DA7E184B6}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -117,6 +119,10 @@ Global
|
|||||||
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4EEC6607-F0D8-4277-9463-104DA7E184B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4EEC6607-F0D8-4277-9463-104DA7E184B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4EEC6607-F0D8-4277-9463-104DA7E184B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4EEC6607-F0D8-4277-9463-104DA7E184B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -139,6 +145,7 @@ Global
|
|||||||
{3D83BE69-71BB-43BE-B3F1-A532215561CD} = {5F2B846D-96CE-400A-878E-220498F4EE31}
|
{3D83BE69-71BB-43BE-B3F1-A532215561CD} = {5F2B846D-96CE-400A-878E-220498F4EE31}
|
||||||
{58F4071D-66B7-4839-A247-79AF0E4E1C8E} = {5F2B846D-96CE-400A-878E-220498F4EE31}
|
{58F4071D-66B7-4839-A247-79AF0E4E1C8E} = {5F2B846D-96CE-400A-878E-220498F4EE31}
|
||||||
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26} = {5F2B846D-96CE-400A-878E-220498F4EE31}
|
{DFD34702-2EF6-4ECC-AE6E-9A1A3885BD26} = {5F2B846D-96CE-400A-878E-220498F4EE31}
|
||||||
|
{4EEC6607-F0D8-4277-9463-104DA7E184B6} = {EEF5F221-0E32-4A3D-B647-B4B5E7305806}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {6C1A3808-0F4F-43FB-A9FE-5F27A3BB2ECF}
|
SolutionGuid = {6C1A3808-0F4F-43FB-A9FE-5F27A3BB2ECF}
|
||||||
@@ -32,5 +32,11 @@ namespace Yi.Framework.Core.Sqlsugar.Repositories
|
|||||||
{
|
{
|
||||||
return await base.GetPageListAsync(whereExpression, new PageModel { PageIndex = page.PageIndex, PageSize = page.PageSize }, orderByExpression, orderByType.EnumToEnum<OrderByType>());
|
return await base.GetPageListAsync(whereExpression, new PageModel { PageIndex = page.PageIndex, PageSize = page.PageSize }, orderByExpression, orderByType.EnumToEnum<OrderByType>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc)
|
||||||
|
{
|
||||||
|
return await _DbQueryable.Where(whereExpression).OrderByIF(orderBy is not null, orderBy + " "+orderByType.ToString().ToLower()).ToPageListAsync(page.PageIndex, page.PageSize);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
||||||
<ProjectReference Include="..\Yi.Framework.Ddd.Application\Yi.Framework.Ddd.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -20,7 +20,7 @@ namespace Yi.Framework.Core.Extensions
|
|||||||
this._next = next;
|
this._next = next;
|
||||||
this._logger = loggerFactory.CreateLogger<ErrorHandMiddleware>();
|
this._logger = loggerFactory.CreateLogger<ErrorHandMiddleware>();
|
||||||
}
|
}
|
||||||
public async Task Invoke(HttpContext context)
|
public async Task InvokeAsync(HttpContext context)
|
||||||
{
|
{
|
||||||
bool isNext = true;
|
bool isNext = true;
|
||||||
try
|
try
|
||||||
@@ -16,5 +16,10 @@ namespace Yi.Framework.Core.Helper
|
|||||||
}
|
}
|
||||||
return (New)Enum.ToObject(typeof(New), oldEnum.GetHashCode());
|
return (New)Enum.ToObject(typeof(New), oldEnum.GetHashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TEnum StringToEnum<TEnum>(this string str)
|
||||||
|
{
|
||||||
|
return (TEnum)Enum.Parse(typeof(TEnum), str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Core.Helper
|
||||||
|
{
|
||||||
|
public static class ExpressionHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Expression表达式树lambda参数拼接组合
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="first"></param>
|
||||||
|
/// <param name="second"></param>
|
||||||
|
/// <param name="merge"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Expression<T> Compose<T>(this Expression<T> first, Expression<T> second, Func<Expression, Expression, Expression> merge)
|
||||||
|
{
|
||||||
|
var parameterMap = first.Parameters.Select((f, i) => new { f, s = second.Parameters[i] }).ToDictionary(p => p.s, p => p.f);
|
||||||
|
var secondBody = LambdaParameteRebinder.ReplaceParameter(parameterMap, second.Body);
|
||||||
|
return Expression.Lambda<T>(merge(first.Body, secondBody), first.Parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Expression表达式树lambda参数拼接--false
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Expression<Func<T, bool>> False<T>() => f => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Expression表达式树lambda参数拼接-true
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Expression<Func<T, bool>> True<T>() => f => true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Expression表达式树lambda参数拼接--and
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="first"></param>
|
||||||
|
/// <param name="second"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second) => first.Compose(second, Expression.And);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Expression表达式树lambda参数拼接--or
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="first"></param>
|
||||||
|
/// <param name="second"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second) => first.Compose(second, Expression.Or);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LambdaParameteRebinder : ExpressionVisitor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 存放表达式树的参数的字典
|
||||||
|
/// </summary>
|
||||||
|
private readonly Dictionary<ParameterExpression, ParameterExpression> map;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map"></param>
|
||||||
|
public LambdaParameteRebinder(Dictionary<ParameterExpression, ParameterExpression> map)
|
||||||
|
{
|
||||||
|
this.map = map ?? new Dictionary<ParameterExpression, ParameterExpression>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重载参数访问的方法,访问表达式树参数,如果字典中包含,则取出
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">表达式树参数</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Expression VisitParameter(ParameterExpression node)
|
||||||
|
{
|
||||||
|
if (map.TryGetValue(node, out ParameterExpression expression))
|
||||||
|
{
|
||||||
|
node = expression;
|
||||||
|
}
|
||||||
|
return base.VisitParameter(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Expression ReplaceParameter(Dictionary<ParameterExpression, ParameterExpression> map, Expression exp)
|
||||||
|
{
|
||||||
|
return new LambdaParameteRebinder(map).Visit(exp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Core.Enums;
|
||||||
|
|
||||||
namespace Yi.Framework.Ddd.Dtos
|
namespace Yi.Framework.Ddd.Dtos
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,8 @@ namespace Yi.Framework.Ddd.Dtos
|
|||||||
{
|
{
|
||||||
int PageIndex { get; set; }
|
int PageIndex { get; set; }
|
||||||
int PageSize { get; set; }
|
int PageSize { get; set; }
|
||||||
string? PageSort { get; set; }
|
string? SortBy { get; set; }
|
||||||
|
|
||||||
|
OrderByEnum SortType { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Ddd.Dtos.Abstract;
|
||||||
|
using Yi.Framework.Ddd.Services.Abstract;
|
||||||
|
|
||||||
namespace Yi.Framework.Ddd.Dtos
|
namespace Yi.Framework.Ddd.Dtos
|
||||||
{
|
{
|
||||||
public class PagedAllResultRequestDto: PagedAndSortedResultRequestDto
|
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPageTimeResultRequestDto, IPagedAndSortedResultRequestDto
|
||||||
{
|
{
|
||||||
public DateTime? StartTime { get; set; }
|
public DateTime? StartTime { get; set; }
|
||||||
public DateTime? EndTime { get; set; }
|
public DateTime? EndTime { get; set; }
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Core.Enums;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Ddd.Dtos
|
||||||
|
{
|
||||||
|
public class PagedAndSortedResultRequestDto : IPagedAndSortedResultRequestDto
|
||||||
|
{
|
||||||
|
public int PageIndex { get; set; } = 1;
|
||||||
|
public int PageSize { get; set; } = int.MaxValue;
|
||||||
|
public string? SortBy { get; set; }
|
||||||
|
public OrderByEnum SortType { get; set; } = OrderByEnum.Desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,8 @@ namespace Yi.Framework.Ddd.Repositories
|
|||||||
//分页查
|
//分页查
|
||||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page);
|
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page);
|
||||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc);
|
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc);
|
||||||
|
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc);
|
||||||
|
|
||||||
|
|
||||||
//插入
|
//插入
|
||||||
Task<bool> InsertAsync(T insertObj);
|
Task<bool> InsertAsync(T insertObj);
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Ddd.Dtos;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Ddd.Services.Abstract
|
||||||
|
{
|
||||||
|
public interface IPageTimeResultRequestDto: IPagedAndSortedResultRequestDto
|
||||||
|
{
|
||||||
|
DateTime? StartTime { get; set; }
|
||||||
|
DateTime? EndTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Core.Helper;
|
||||||
using Yi.Framework.Core.Model;
|
using Yi.Framework.Core.Model;
|
||||||
using Yi.Framework.Ddd.Dtos;
|
using Yi.Framework.Ddd.Dtos;
|
||||||
using Yi.Framework.Ddd.Entities;
|
using Yi.Framework.Ddd.Entities;
|
||||||
@@ -87,11 +89,23 @@ where TEntityDto : IEntityDto<TKey>
|
|||||||
|
|
||||||
if (totalCount > 0)
|
if (totalCount > 0)
|
||||||
{
|
{
|
||||||
if (input is IPagedAndSortedResultRequestDto sortInput)
|
|
||||||
{
|
|
||||||
entities = await _repository.GetPageListAsync(_ => true, sortInput);
|
|
||||||
}
|
|
||||||
//这里还可以追加如果是审计日志,继续拼接条件即可
|
//这里还可以追加如果是审计日志,继续拼接条件即可
|
||||||
|
if (input is IPageTimeResultRequestDto timeInput)
|
||||||
|
{
|
||||||
|
if (timeInput.StartTime is not null)
|
||||||
|
{
|
||||||
|
timeInput.EndTime = timeInput.EndTime ?? DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (input is IPagedAndSortedResultRequestDto sortInput)
|
||||||
|
{
|
||||||
|
entities = await _repository.GetPageListAsync(_ => true, sortInput,sortInput.SortBy, sortInput.SortType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entities = await _repository.GetListAsync();
|
entities = await _repository.GetListAsync();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user