简化对象映射Mapper,简化自定义仓储
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class DeptProfile: Profile
|
||||
{
|
||||
public DeptProfile()
|
||||
{
|
||||
CreateMap<DeptGetListInputVo, DeptEntity>();
|
||||
CreateMap<DeptCreateInputVo, DeptEntity>();
|
||||
CreateMap<DeptUpdateInputVo, DeptEntity>();
|
||||
CreateMap<DeptEntity, DeptGetListOutputDto>();
|
||||
CreateMap<DeptEntity, DeptGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class MenuProfile: Profile
|
||||
{
|
||||
public MenuProfile()
|
||||
{
|
||||
CreateMap<MenuGetListInputVo, MenuEntity>();
|
||||
CreateMap<MenuCreateInputVo, MenuEntity>();
|
||||
CreateMap<MenuUpdateInputVo, MenuEntity>();
|
||||
CreateMap<MenuEntity, MenuGetListOutputDto>();
|
||||
CreateMap<MenuEntity, MenuGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class PostProfile: Profile
|
||||
{
|
||||
public PostProfile()
|
||||
{
|
||||
CreateMap<PostGetListInputVo, PostEntity>();
|
||||
CreateMap<PostCreateInputVo, PostEntity>();
|
||||
CreateMap<PostUpdateInputVo, PostEntity>();
|
||||
CreateMap<PostEntity, PostGetListOutputDto>();
|
||||
CreateMap<PostEntity, PostGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class RoleProfile: Profile
|
||||
{
|
||||
public RoleProfile()
|
||||
{
|
||||
CreateMap<RoleGetListInputVo, RoleEntity>();
|
||||
CreateMap<RoleCreateInputVo, RoleEntity>();
|
||||
CreateMap<RoleUpdateInputVo, RoleEntity>();
|
||||
CreateMap<RoleEntity, RoleGetListOutputDto>();
|
||||
CreateMap<RoleEntity, RoleGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity.MapperConfig
|
||||
{
|
||||
public class UserProfile: Profile
|
||||
{
|
||||
public UserProfile()
|
||||
{
|
||||
CreateMap<UserGetListInputVo, UserEntity>();
|
||||
CreateMap<UserCreateInputVo, UserEntity>();
|
||||
CreateMap<UserUpdateInputVo, UserEntity>();
|
||||
CreateMap<UserEntity, UserGetListOutputDto>();
|
||||
CreateMap<UserEntity, UserGetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,17 @@ namespace Yi.RBAC.Application.Identity
|
||||
public override async Task<PagedResultDto<UserGetListOutputDto>> GetListAsync(UserGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
var entities = await _userRepository.SelctGetListAsync(entity, input);
|
||||
|
||||
int total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.UserName), x => x.UserName.Contains(input.UserName!)).
|
||||
WhereIF(input.Phone is not null, x => x.Phone.ToString()!.Contains(input.Phone.ToString()!)).
|
||||
WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name!.Contains(input.Name!)).
|
||||
WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime).ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
|
||||
var result = new PagedResultDto<UserGetListOutputDto>();
|
||||
result.Items = await MapToGetListOutputDtosAsync(entities);
|
||||
result.Total = await _repository.CountAsync(_ => true);
|
||||
result.Total = total;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user