style: 修改聚合跟类命名
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
public AccountService(IUserRepository userRepository,
|
||||
ICurrentUser currentUser,
|
||||
IAccountManager accountManager,
|
||||
ISqlSugarRepository<MenuEntity> menuRepository,
|
||||
ISqlSugarRepository<MenuAggregateRoot> menuRepository,
|
||||
IDistributedCache<CaptchaPhoneCacheItem, CaptchaPhoneCacheKey> phoneCache,
|
||||
IDistributedCache<UserInfoCacheItem, UserInfoCacheKey> userCache,
|
||||
ICaptcha captcha,
|
||||
@@ -65,7 +65,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
private IUserRepository _userRepository;
|
||||
private ICurrentUser _currentUser;
|
||||
private IAccountManager _accountManager;
|
||||
private ISqlSugarRepository<MenuEntity> _menuRepository;
|
||||
private ISqlSugarRepository<MenuAggregateRoot> _menuRepository;
|
||||
/// <summary>
|
||||
/// 校验图片登录验证码,无需和账号绑定
|
||||
/// </summary>
|
||||
@@ -100,7 +100,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
//校验验证码
|
||||
ValidationImageCaptcha(input);
|
||||
|
||||
UserEntity user = new();
|
||||
UserAggregateRoot user = new();
|
||||
//校验
|
||||
await _accountManager.LoginValidationAsync(input.UserName, input.Password, x => user = x);
|
||||
|
||||
@@ -267,10 +267,10 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
//为超级管理员直接给全部路由
|
||||
if (UserConst.Admin.Equals(data.User.UserName))
|
||||
{
|
||||
menus = ObjectMapper.Map<List<MenuEntity>, List<MenuDto>>(await _menuRepository.GetListAsync());
|
||||
menus = ObjectMapper.Map<List<MenuAggregateRoot>, List<MenuDto>>(await _menuRepository.GetListAsync());
|
||||
}
|
||||
//将后端菜单转换成前端路由,组件级别需要过滤
|
||||
List<Vue3RouterDto> routers = ObjectMapper.Map<List<MenuDto>, List<MenuEntity>>(menus).Vue3RouterBuild();
|
||||
List<Vue3RouterDto> routers = ObjectMapper.Map<List<MenuDto>, List<MenuAggregateRoot>>(menus).Vue3RouterBuild();
|
||||
return routers;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
/// <summary>
|
||||
/// Config服务实现
|
||||
/// </summary>
|
||||
public class ConfigService : YiCrudAppService<ConfigEntity, ConfigGetOutputDto, ConfigGetListOutputDto, Guid, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>,
|
||||
public class ConfigService : YiCrudAppService<ConfigAggregateRoot, ConfigGetOutputDto, ConfigGetListOutputDto, Guid, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>,
|
||||
IConfigService
|
||||
{
|
||||
private ISqlSugarRepository<ConfigEntity, Guid> _repository;
|
||||
public ConfigService(ISqlSugarRepository<ConfigEntity, Guid> repository) : base(repository)
|
||||
private ISqlSugarRepository<ConfigAggregateRoot, Guid> _repository;
|
||||
public ConfigService(ISqlSugarRepository<ConfigAggregateRoot, Guid> repository) : base(repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
/// <summary>
|
||||
/// Notice服务实现
|
||||
/// </summary>
|
||||
public class NoticeService : YiCrudAppService<NoticeEntity, NoticeGetOutputDto, NoticeGetListOutputDto, Guid, NoticeGetListInput, NoticeCreateInput, NoticeUpdateInput>,
|
||||
public class NoticeService : YiCrudAppService<NoticeAggregateRoot, NoticeGetOutputDto, NoticeGetListOutputDto, Guid, NoticeGetListInput, NoticeCreateInput, NoticeUpdateInput>,
|
||||
INoticeService
|
||||
{
|
||||
private ISqlSugarRepository<NoticeEntity, Guid> _repository;
|
||||
private ISqlSugarRepository<NoticeAggregateRoot, Guid> _repository;
|
||||
private IHubContext<NoticeHub> _hubContext;
|
||||
public NoticeService(ISqlSugarRepository<NoticeEntity, Guid> repository, IHubContext<NoticeHub> hubContext) : base(repository)
|
||||
public NoticeService(ISqlSugarRepository<NoticeAggregateRoot, Guid> repository, IHubContext<NoticeHub> hubContext) : base(repository)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
_repository = repository;
|
||||
|
||||
@@ -9,10 +9,10 @@ using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services.RecordLog
|
||||
{
|
||||
public class LoginLogService : YiCrudAppService<LoginLogEntity, LoginLogGetListOutputDto, Guid, LoginLogGetListInputVo>
|
||||
public class LoginLogService : YiCrudAppService<LoginLogAggregateRoot, LoginLogGetListOutputDto, Guid, LoginLogGetListInputVo>
|
||||
{
|
||||
private readonly ISqlSugarRepository<LoginLogEntity> _repository;
|
||||
public LoginLogService(ISqlSugarRepository<LoginLogEntity, Guid> repository) : base(repository)
|
||||
private readonly ISqlSugarRepository<LoginLogAggregateRoot> _repository;
|
||||
public LoginLogService(ISqlSugarRepository<LoginLogAggregateRoot, Guid> repository) : base(repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
/// <summary>
|
||||
/// Dept服务实现
|
||||
/// </summary>
|
||||
public class DeptService : YiCrudAppService<DeptEntity, DeptGetOutputDto, DeptGetListOutputDto, Guid, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>, IDeptService
|
||||
public class DeptService : YiCrudAppService<DeptAggregateRoot, DeptGetOutputDto, DeptGetListOutputDto, Guid, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>, IDeptService
|
||||
{
|
||||
private IDeptRepository _deptRepository;
|
||||
public DeptService(IDeptRepository deptRepository) : base(deptRepository)
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
/// <summary>
|
||||
/// Menu服务实现
|
||||
/// </summary>
|
||||
public class MenuService : YiCrudAppService<MenuEntity, MenuGetOutputDto, MenuGetListOutputDto, Guid, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>,
|
||||
public class MenuService : YiCrudAppService<MenuAggregateRoot, MenuGetOutputDto, MenuGetListOutputDto, Guid, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>,
|
||||
IMenuService
|
||||
{
|
||||
private readonly ISqlSugarRepository<MenuEntity, Guid> _repository;
|
||||
public MenuService(ISqlSugarRepository<MenuEntity, Guid> repository) : base(repository)
|
||||
private readonly ISqlSugarRepository<MenuAggregateRoot, Guid> _repository;
|
||||
public MenuService(ISqlSugarRepository<MenuAggregateRoot, Guid> repository) : base(repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
/// <summary>
|
||||
/// Post服务实现
|
||||
/// </summary>
|
||||
public class PostService : YiCrudAppService<PostEntity, PostGetOutputDto, PostGetListOutputDto, Guid, PostGetListInputVo, PostCreateInputVo, PostUpdateInputVo>,
|
||||
public class PostService : YiCrudAppService<PostAggregateRoot, PostGetOutputDto, PostGetListOutputDto, Guid, PostGetListInputVo, PostCreateInputVo, PostUpdateInputVo>,
|
||||
IPostService
|
||||
{
|
||||
private readonly ISqlSugarRepository<PostEntity, Guid> _repository;
|
||||
public PostService(ISqlSugarRepository<PostEntity, Guid> repository) : base(repository)
|
||||
private readonly ISqlSugarRepository<PostAggregateRoot, Guid> _repository;
|
||||
public PostService(ISqlSugarRepository<PostAggregateRoot, Guid> repository) : base(repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
@@ -19,16 +19,16 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
/// <summary>
|
||||
/// Role服务实现
|
||||
/// </summary>
|
||||
public class RoleService : YiCrudAppService<RoleEntity, RoleGetOutputDto, RoleGetListOutputDto, Guid, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>,
|
||||
public class RoleService : YiCrudAppService<RoleAggregateRoot, RoleGetOutputDto, RoleGetListOutputDto, Guid, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>,
|
||||
IRoleService
|
||||
{
|
||||
public RoleService(RoleManager roleManager, ISqlSugarRepository<RoleDeptEntity> roleDeptRepository, ISqlSugarRepository<UserRoleEntity> userRoleRepository, ISqlSugarRepository<RoleEntity, Guid> repository) : base(repository)
|
||||
public RoleService(RoleManager roleManager, ISqlSugarRepository<RoleDeptEntity> roleDeptRepository, ISqlSugarRepository<UserRoleEntity> userRoleRepository, ISqlSugarRepository<RoleAggregateRoot, Guid> repository) : base(repository)
|
||||
{
|
||||
(_roleManager, _roleDeptRepository, _userRoleRepository, _repository) =
|
||||
(roleManager, roleDeptRepository, userRoleRepository, repository);
|
||||
}
|
||||
|
||||
private ISqlSugarRepository<RoleEntity, Guid> _repository;
|
||||
private ISqlSugarRepository<RoleAggregateRoot, Guid> _repository;
|
||||
private RoleManager _roleManager { get; set; }
|
||||
|
||||
private ISqlSugarRepository<RoleDeptEntity> _roleDeptRepository;
|
||||
@@ -44,7 +44,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
var insertEntities = input.DeptIds.Select(x => new RoleDeptEntity { DeptId = x, RoleId = input.RoleId }).ToList();
|
||||
await _roleDeptRepository.InsertRangeAsync(insertEntities);
|
||||
}
|
||||
var entity = new RoleEntity() { DataScope = input.DataScope };
|
||||
var entity = new RoleAggregateRoot() { DataScope = input.DataScope };
|
||||
EntityHelper.TrySetId(entity, () => input.RoleId);
|
||||
await _repository._Db.Updateable(entity).UpdateColumns(x => x.DataScope).ExecuteCommandAsync();
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var output = await _userRoleRepository._DbQueryable
|
||||
.LeftJoin<UserEntity>((ur, u) => ur.UserId == u.Id && ur.RoleId == roleId)
|
||||
.LeftJoin<UserAggregateRoot>((ur, u) => ur.UserId == u.Id && ur.RoleId == roleId)
|
||||
.Where((ur, u) => ur.RoleId == roleId)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.UserName), (ur, u) => u.UserName.Contains(input.UserName))
|
||||
.WhereIF(input.Phone is not null, (ur, u) => u.Phone.ToString().Contains(input.Phone.ToString()))
|
||||
@@ -166,7 +166,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
private async Task<PagedResultDto<UserGetListOutputDto>> GetNotAllocatedAuthUserByRoleIdAsync(Guid roleId, RoleAuthUserGetListInput input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var entities = await _userRoleRepository._Db.Queryable<UserEntity>()
|
||||
var entities = await _userRoleRepository._Db.Queryable<UserAggregateRoot>()
|
||||
.Where(u => SqlFunc.Subqueryable<UserRoleEntity>().Where(x => x.RoleId == roleId).Where(x => x.UserId == u.Id).NotAny())
|
||||
.WhereIF(!string.IsNullOrEmpty(input.UserName), u => u.UserName.Contains(input.UserName))
|
||||
.WhereIF(input.Phone is not null, u => u.Phone.ToString().Contains(input.Phone.ToString()))
|
||||
|
||||
@@ -24,15 +24,15 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
/// <summary>
|
||||
/// User服务实现
|
||||
/// </summary>
|
||||
public class UserService : YiCrudAppService<UserEntity, UserGetOutputDto, UserGetListOutputDto, Guid, UserGetListInputVo, UserCreateInputVo, UserUpdateInputVo>, IUserService
|
||||
public class UserService : YiCrudAppService<UserAggregateRoot, UserGetOutputDto, UserGetListOutputDto, Guid, UserGetListInputVo, UserCreateInputVo, UserUpdateInputVo>, IUserService
|
||||
//IUserService
|
||||
{
|
||||
public UserService(ISqlSugarRepository<UserEntity, Guid> repository, UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser, IDeptService deptService, ILocalEventBus localEventBus, IDistributedCache<UserInfoCacheItem, UserInfoCacheKey> userCache) : base(repository)
|
||||
public UserService(ISqlSugarRepository<UserAggregateRoot, Guid> repository, UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser, IDeptService deptService, ILocalEventBus localEventBus, IDistributedCache<UserInfoCacheItem, UserInfoCacheKey> userCache) : base(repository)
|
||||
=>
|
||||
(_userManager, _userRepository, _currentUser, _deptService, _repository, _localEventBus) =
|
||||
(userManager, userRepository, currentUser, deptService, repository, localEventBus);
|
||||
private UserManager _userManager { get; set; }
|
||||
private ISqlSugarRepository<UserEntity, Guid> _repository;
|
||||
private ISqlSugarRepository<UserAggregateRoot, Guid> _repository;
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
private IDeptService _deptService { get; set; }
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
.WhereIF(ids is not null, x => ids.Contains(x.Id))
|
||||
|
||||
|
||||
.LeftJoin<DeptEntity>((user, dept) => user.DeptId == dept.Id)
|
||||
.LeftJoin<DeptAggregateRoot>((user, dept) => user.DeptId == dept.Id)
|
||||
.OrderByDescending(user => user.CreationTime)
|
||||
.Select((user, dept) => new UserGetListOutputDto(), true)
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
@@ -80,7 +80,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
}
|
||||
|
||||
|
||||
protected override UserEntity MapToEntity(UserCreateInputVo createInput)
|
||||
protected override UserAggregateRoot MapToEntity(UserCreateInputVo createInput)
|
||||
{
|
||||
var output = base.MapToEntity(createInput);
|
||||
output.EncryPassword = new Domain.Entities.ValueObjects.EncryPasswordValueObject(createInput.Password);
|
||||
@@ -107,7 +107,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override async Task<UserEntity> MapToEntityAsync(UserCreateInputVo createInput)
|
||||
protected override async Task<UserAggregateRoot> MapToEntityAsync(UserCreateInputVo createInput)
|
||||
{
|
||||
var entitiy = await base.MapToEntityAsync(createInput);
|
||||
entitiy.BuildPassword();
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Yi.Framework.Rbac.Application.SignalRHubs
|
||||
lock (objLock)
|
||||
{
|
||||
var name = CurrentUser.UserName;
|
||||
var loginUser = new LoginLogEntity().GetInfoByHttpContext(_httpContext);
|
||||
var loginUser = new LoginLogAggregateRoot().GetInfoByHttpContext(_httpContext);
|
||||
|
||||
OnlineUserModel user = new(Context.ConnectionId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user