非常优雅的完成了数据模块
This commit is contained in:
@@ -9,6 +9,11 @@
|
||||
Student输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Application.Contracts.Student.Dtos.StudentGetListOutputDto.IsDeleted">
|
||||
<summary>
|
||||
想看一下结果
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Application.Contracts.Student.IStudentService">
|
||||
<summary>
|
||||
服务抽象
|
||||
|
||||
@@ -12,5 +12,10 @@ namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public long Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 想看一下结果
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@ namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
{
|
||||
public class StudentUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
public long? Number { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Application.Student.StudentService.GetDataFiterTestAsync(Yi.Framework.Application.Contracts.Student.Dtos.StudentGetListInputVo)">
|
||||
<summary>
|
||||
数据过滤测试
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Application.Student.StudentService.GetToken">
|
||||
<summary>
|
||||
测试token
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Application.Contracts.Student;
|
||||
using Yi.Framework.Domain.Student;
|
||||
using Yi.Framework.Domain.Student.IRepository;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -21,6 +20,10 @@ using Yi.Framework.Core.Const;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Auth.JwtBearer.Authorization;
|
||||
using Yi.Framework.Domain.Shared.Student.ConstClasses;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
using Yi.Framework.Data.Filters;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.Application.Student
|
||||
{
|
||||
@@ -37,13 +40,36 @@ namespace Yi.Framework.Application.Student
|
||||
private readonly IUnitOfWorkManager _unitOfWorkManager;
|
||||
private readonly JwtTokenManager _jwtTokenManager;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
public StudentService(IStudentRepository studentRepository, StudentManager studentManager, IUnitOfWorkManager unitOfWorkManager, JwtTokenManager jwtTokenManager, ICurrentUser currentUser)
|
||||
private readonly IDataFilter _dataFilter;
|
||||
public StudentService(IStudentRepository studentRepository, StudentManager studentManager, IUnitOfWorkManager unitOfWorkManager, JwtTokenManager jwtTokenManager, ICurrentUser currentUser, IDataFilter dataFilter)
|
||||
{
|
||||
_studentRepository = studentRepository;
|
||||
_studentManager = studentManager;
|
||||
_unitOfWorkManager = unitOfWorkManager;
|
||||
_jwtTokenManager = jwtTokenManager;
|
||||
_currentUser = currentUser;
|
||||
_dataFilter = dataFilter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据过滤测试
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PagedResultDto<StudentGetListOutputDto>> GetDataFiterTestAsync(StudentGetListInputVo input)
|
||||
{
|
||||
PagedResultDto<StudentGetListOutputDto> res = new();
|
||||
using (_dataFilter.Disable<ISoftDelete>())
|
||||
{
|
||||
|
||||
res = await base.GetListAsync(input);
|
||||
|
||||
|
||||
}
|
||||
|
||||
var p = await base.GetListAsync(input);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,6 +11,8 @@ using Yi.Framework.Application.Contracts.Student;
|
||||
using Yi.Framework.Application.Student;
|
||||
using Yi.Framework.Auth.JwtBearer;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Data;
|
||||
using Yi.Framework.Ddd;
|
||||
using Yi.Framework.Domain;
|
||||
|
||||
namespace Yi.Framework.Application
|
||||
@@ -18,7 +20,7 @@ namespace Yi.Framework.Application
|
||||
[DependsOn(
|
||||
typeof(YiFrameworkApplicationContractsModule),
|
||||
typeof(YiFrameworkDomainModule),
|
||||
typeof(YiFrameworkAuthJwtBearerModule)
|
||||
typeof(YiFrameworkAuthJwtBearerModule)
|
||||
)]
|
||||
public class YiFrameworkApplicationModule : IStartupModule
|
||||
{
|
||||
|
||||
@@ -19,7 +19,12 @@
|
||||
学号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Domain.Student.IRepository.IStudentRepository">
|
||||
<member name="P:Yi.Framework.Domain.Student.Entities.StudentEntity.IsDeleted">
|
||||
<summary>
|
||||
软删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Domain.Student.Repositories.IStudentRepository">
|
||||
<summary>
|
||||
仓储抽象
|
||||
</summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.Framework.Domain.Student.Entities
|
||||
@@ -12,7 +13,7 @@ namespace Yi.Framework.Domain.Student.Entities
|
||||
/// 学生实体
|
||||
/// </summary>
|
||||
[SugarTable("Student")]
|
||||
public class StudentEntity : IEntity<long>
|
||||
public class StudentEntity : IEntity<long>, ISoftDelete
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
@@ -26,5 +27,10 @@ namespace Yi.Framework.Domain.Student.Entities
|
||||
/// 学号
|
||||
/// </summary>
|
||||
public long Number { get;set ; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.Framework.Domain.Student.Entities;
|
||||
|
||||
namespace Yi.Framework.Domain.Student.IRepository
|
||||
namespace Yi.Framework.Domain.Student.Repositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓储抽象
|
||||
/// </summary>
|
||||
public interface IStudentRepository:IRepository<StudentEntity>
|
||||
public interface IStudentRepository : IRepository<StudentEntity>
|
||||
{
|
||||
Task<List<StudentEntity>> GetMyListAsync();
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Domain.Student.IRepository;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
|
||||
namespace Yi.Framework.Domain.Student
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Data;
|
||||
using Yi.Framework.Domain.Shared;
|
||||
using Yi.Framework.Domain.Student;
|
||||
|
||||
namespace Yi.Framework.Domain
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(YiFrameworkDomainSharedModule)
|
||||
typeof(YiFrameworkDomainSharedModule),
|
||||
typeof(YiFrameworkDataModule)
|
||||
)]
|
||||
public class YiFrameworkDomainModule : IStartupModule
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Sqlsugar.Repositories;
|
||||
using Yi.Framework.Domain.Student.Entities;
|
||||
using Yi.Framework.Domain.Student.IRepository;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
|
||||
namespace Yi.Framework.Sqlsugar.Student
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Sqlsugar;
|
||||
using Yi.Framework.Domain;
|
||||
using Yi.Framework.Domain.Student.IRepository;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
using Yi.Framework.Sqlsugar.Student;
|
||||
|
||||
namespace Yi.Framework.Sqlsugar
|
||||
|
||||
@@ -65,3 +65,12 @@
|
||||
2023:01:19-17:52:49本次运行启动时间为:1940毫秒
|
||||
2023:01:19-17:54:41本次运行启动时间为:1861毫秒
|
||||
2023:01:19-17:57:37本次运行启动时间为:1945毫秒
|
||||
2023:01:20-18:25:59本次运行启动时间为:43382毫秒
|
||||
2023:01:20-18:29:09本次运行启动时间为:2173毫秒
|
||||
2023:01:20-18:32:14本次运行启动时间为:2397毫秒
|
||||
2023:01:20-18:34:14本次运行启动时间为:2126毫秒
|
||||
2023:01:20-18:38:36本次运行启动时间为:2152毫秒
|
||||
2023:01:20-18:45:15本次运行启动时间为:7203毫秒
|
||||
2023:01:20-18:50:46本次运行启动时间为:6513毫秒
|
||||
2023:01:20-18:53:16本次运行启动时间为:5186毫秒
|
||||
2023:01:20-19:01:36本次运行启动时间为:5194毫秒
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user