diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs index d3a0c94..524ba2c 100644 --- a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs @@ -6,6 +6,7 @@ using System.Linq.Dynamic.Core; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using AutoMapper; using Faster.Zheng.Winin.AppBase.Filters; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -13,7 +14,9 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; +using Volo.Abp.EntityFrameworkCore; using static Microsoft.EntityFrameworkCore.DbLoggerCategory; +using static OpenIddict.Abstractions.OpenIddictConstants; namespace Faster.Zheng.Winin.AppBase; @@ -25,6 +28,8 @@ public class ZbxBase { private readonly IRepository _repository; + private readonly IMapper _mapper; + private Func _mapFunc; public ZbxBase(IRepository repository) : base(repository) { @@ -44,6 +49,8 @@ public class ZbxBase> GetPageListByFilterAsync(SfsRequestInputBase sfsRequestInputBase, bool includeDetails = false, CancellationToken cancellationToken = default) { + //await TestSqlAsync(); + var expression = sfsRequestInputBase.Condition.Filters?.Count > 0 ? sfsRequestInputBase.Condition.Filters.ToLambda() : p => true; @@ -53,8 +60,9 @@ public class ZbxBase, List>(resultEntities); + //获取总数 - var totalCount =await GetCountAsync(expression, cancellationToken); + var totalCount = await GetCountAsync(expression, cancellationToken); return new PagedResultDto(totalCount, resultDtos); } @@ -69,8 +77,8 @@ public class ZbxBase GetCountAsync(Expression> expression, CancellationToken cancellationToken = default) { - var count= await _repository.LongCountAsync(expression, cancellationToken: cancellationToken); - + var count = await _repository.LongCountAsync(expression, cancellationToken: cancellationToken); + return count; } @@ -83,6 +91,20 @@ public class ZbxBase CreateAsync(TCreateInput input) { await CheckCreatePolicyAsync(); + + var mapperConfig = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + var _mapper = mapperConfig.CreateMapper(); + var source = Expression.Parameter(typeof(TCreateInput), "source"); + _mapFunc = Expression.Lambda>( + Expression.Invoke(Expression.Constant(_mapper.Map)), source) + .Compile(); + + + var tt= _mapper.Map(input); + var entity = await MapToEntityAsync(input); //判断id是否是00000-0000 如果是则赋值 @@ -246,5 +268,19 @@ public class ZbxBase TPK.Id, TFK => TFK.MasterId, (TPK, TFK) => new { TPK, TFK }) + // .Where(result => result.TFK.StudentName == "阎致远"); + + // foreach (var result in query) + // { + // Console.WriteLine($"Customer: {result.TFK.StudentName}, Order ID: {result.TPK.SchoolName}"); + // } + //} + #endregion } \ No newline at end of file diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/Faster.Zheng.Winin.Application.csproj b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/Faster.Zheng.Winin.Application.csproj index 30c8616..9fce12f 100644 --- a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/Faster.Zheng.Winin.Application.csproj +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/Faster.Zheng.Winin.Application.csproj @@ -16,8 +16,8 @@ - + diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/Index.cshtml b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/Index.cshtml index 5775492..9f1f33c 100644 --- a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/Index.cshtml +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/Index.cshtml @@ -16,9 +16,9 @@ -

Welcome to the Application

+

Faster.Zheng.Winin

-

@L["LongWelcomeMessage"]

+

郑渤旭-快速开发Demo

@if (!CurrentUser.IsAuthenticated) { @@ -26,162 +26,4 @@ } -
-
-
-
- -
-
-
- THE OFFICIAL GUIDE -

Mastering ABP Framework

-

Written by the creator of the ABP Framework, this book will help you gain a complete understanding of the framework and modern web application development techniques.

- -
-
-
-
-
-
-

Let's improve your application!

-

Here are some links to help you get started:

-
-
-
-
-
-
-
Learn the ABP Framework
-

Explore the compherensive documentation to learn how to build a modern web application.

- See Documents -
-
-
-
-
Samples
-

See the example projects built with the ABP Framework.

- All samples -
-
-
-
-
ABP Community
-

Get involved with a vibrant community and become a contributor.

- Community - Contribute -
-
-
-
-
-
-
ABP Blog
-

Take a look at our recently published articles.

- See Blog -
-
-
-
-
Github
-

Do you love the ABP Framework? Please give a star to support it!

-

- Star - Issue - Fork -

- Request a feature - -
-
-
-
-
Stackoverflow
-

See answers to previously asked questions or ask a new one.

- Questions - Ask a Question -
-
-
-
-
- -
-

Meet the ABP Commercial

-

A Complete Web Application Platform Built on the ABP Framework

-
- -
-
-

- ABP Commercial is a platform based on the open source ABP framework. It provides pre-built application modules, - rapid application development tooling, professional UI themes, premium support and more. -

- -
-
-
-
- Startup Templates - Details -
-
-
-
-
-
- Application Modules - Details -
-
-
-
-
-
- Developer
Tools - Details -
-
-
-
-
-
- UI
Themes - Details -
-
-
-
-
-
- Premium Support - Details -
-
-
-
-
-
- Additional Services - Details -
-
-
-
-
-
-