完善更新功能
This commit is contained in:
@@ -3,10 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.Framework.Ddd.Dtos.Abstract
|
||||
{
|
||||
public interface IPagedAllResultRequestDto
|
||||
public interface IPagedAllResultRequestDto: IPageTimeResultRequestDto, IPagedAndSortedResultRequestDto
|
||||
{
|
||||
DateTime? StartTime { get; set; }
|
||||
DateTime? EndTime { get; set; }
|
||||
|
||||
@@ -8,7 +8,7 @@ using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.Framework.Ddd.Dtos
|
||||
{
|
||||
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPageTimeResultRequestDto, IPagedAndSortedResultRequestDto
|
||||
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPagedAllResultRequestDto, IPagedAndSortedResultRequestDto, IPageTimeResultRequestDto
|
||||
{
|
||||
public DateTime? StartTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
@@ -57,6 +57,11 @@ namespace Yi.Framework.Ddd.Services
|
||||
where TGetListOutputDto : IEntityDto<TKey>
|
||||
|
||||
{
|
||||
protected virtual Task<TEntity> MapToEntityAsync(TGetListInput getListinput)
|
||||
{
|
||||
return Task.FromResult(_mapper.Map<TEntity>(getListinput));
|
||||
}
|
||||
|
||||
|
||||
protected virtual Task<TEntity> MapToEntityAsync(TCreateInput createInput)
|
||||
{
|
||||
@@ -153,7 +158,6 @@ namespace Yi.Framework.Ddd.Services
|
||||
{
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
var entity = await MapToEntityAsync(input);
|
||||
entity.Id = id;
|
||||
await _repository.UpdateIgnoreNullAsync(entity);
|
||||
|
||||
@@ -8,25 +8,13 @@ using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class UserGetListInputVo : PagedAndSortedResultRequestDto
|
||||
public class UserGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Salt { get; set; } = string.Empty;
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Ip { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? UserName { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,7 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,7 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
User服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.GetListAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.UserGetListInputVo)">
|
||||
<summary>
|
||||
查询用户
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.CreateAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.UserCreateInputVo)">
|
||||
<summary>
|
||||
添加用户
|
||||
|
||||
@@ -6,6 +6,8 @@ using Yi.Framework.Ddd.Services;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
using Yi.RBAC.Domain.Identity;
|
||||
using Yi.Framework.Uow;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Repositories;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
@@ -21,6 +23,25 @@ namespace Yi.RBAC.Application.Identity
|
||||
|
||||
[Autowired]
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<PagedResultDto<UserGetListOutputDto>> GetListAsync(UserGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
var entities = await _userRepository.SelctGetListAsync(entity, input);
|
||||
var result = new PagedResultDto<UserGetListOutputDto>();
|
||||
result.Items = await MapToGetListOutputDtosAsync(entities);
|
||||
result.Total = await _repository.CountAsync(_ => true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加用户
|
||||
/// </summary>
|
||||
|
||||
@@ -579,6 +579,14 @@
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.Repositories.IUserRepository.SelctGetListAsync(Yi.RBAC.Domain.Identity.Entities.UserEntity,Yi.Framework.Ddd.Dtos.Abstract.IPagedAllResultRequestDto)">
|
||||
<summary>
|
||||
动态分页选择
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<param name="pageInput"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Domain.Identity.UserManager.GiveUserSetRoleAsync(System.Collections.Generic.List{System.Int64},System.Collections.Generic.List{System.Int64})">
|
||||
<summary>
|
||||
给用户设置角色
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.Framework.Ddd.Dtos.Abstract;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
@@ -18,5 +20,13 @@ namespace Yi.RBAC.Domain.Identity.Repositories
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRoleMenuDto> GetUserAllInfoAsync(long userId);
|
||||
|
||||
/// <summary>
|
||||
/// 动态分页选择
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserEntity>> SelctGetListAsync(UserEntity input, IPagedAllResultRequestDto pageInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Sqlsugar.Repositories;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.Framework.Ddd.Dtos.Abstract;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
@@ -21,6 +23,17 @@ namespace Yi.RBAC.Sqlsugar.Repositories
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<UserEntity>> SelctGetListAsync(UserEntity input, IPagedAllResultRequestDto pageInput)
|
||||
{
|
||||
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(pageInput.StartTime is not null && pageInput.EndTime is not null, x => x.CreationTime >= pageInput.StartTime && x.CreationTime <= pageInput.EndTime).ToPageListAsync(pageInput.PageIndex, pageInput.PageSize);
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户id的全部信息
|
||||
/// </summary>
|
||||
@@ -71,7 +84,7 @@ namespace Yi.RBAC.Sqlsugar.Repositories
|
||||
}
|
||||
|
||||
//刚好可以去除一下多余的导航属性
|
||||
role.Menus =new List<MenuEntity>();
|
||||
role.Menus = new List<MenuEntity>();
|
||||
userRoleMenu.Roles.Add(role);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user