style: 修改聚合跟类命名

This commit is contained in:
橙子
2024-05-22 14:35:08 +08:00
parent f2e3c76539
commit 3429de9eb6
89 changed files with 446 additions and 412 deletions

View File

@@ -259,6 +259,10 @@ namespace Yi.Framework.SqlSugarCore
/// <param name="column"></param>
protected virtual void EntityService(PropertyInfo property, EntityColumnInfo column)
{
if (property.Name == "ConcurrencyStamp")
{
column.IsIgnore = true;
}
if (property.PropertyType == typeof(ExtraPropertyDictionary))
{
column.IsIgnore = true;

View File

@@ -10,8 +10,8 @@ namespace Yi.Framework.Bbs.Application.Services
{
public class AccessLogService : ApplicationService, IAccessLogService
{
private readonly ISqlSugarRepository<AccessLogEntity> _repository;
public AccessLogService(ISqlSugarRepository<AccessLogEntity> repository) { _repository = repository; }
private readonly ISqlSugarRepository<AccessLogAggregateRoot> _repository;
public AccessLogService(ISqlSugarRepository<AccessLogAggregateRoot> repository) { _repository = repository; }
public DateTime GetWeekFirst()
{
@@ -71,11 +71,11 @@ namespace Yi.Framework.Bbs.Application.Services
if (last is null || last.CreationTime.Date != DateTime.Today)
{
await _repository.InsertAsync(new AccessLogEntity());
await _repository.InsertAsync(new AccessLogAggregateRoot());
}
else
{
await _repository._Db.Updateable<AccessLogEntity>().SetColumns(it => it.Number == it.Number + 1).Where(it => it.Id == last.Id).ExecuteCommandAsync();
await _repository._Db.Updateable<AccessLogAggregateRoot>().SetColumns(it => it.Number == it.Number + 1).Where(it => it.Id == last.Id).ExecuteCommandAsync();
}
}
@@ -95,7 +95,7 @@ namespace Yi.Framework.Bbs.Application.Services
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private AccessLogDto[] WeekTimeHandler(AccessLogEntity[] data)
private AccessLogDto[] WeekTimeHandler(AccessLogAggregateRoot[] data)
{
data = data.Where(x => x.CreationTime >= GetWeekFirst()).OrderByDescending(x => x.CreationTime).DistinctBy(x => x.CreationTime.DayOfWeek).ToArray();

View File

@@ -31,7 +31,7 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
{
var output = await _forumManager._discussRepository._DbQueryable
.Where(discuss=>discuss.PermissionType== DiscussPermissionTypeEnum.Public)
.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
.LeftJoin<UserAggregateRoot>((discuss, user) => discuss.CreatorId == user.Id)
.LeftJoin<BbsUserExtraInfoEntity>((discuss, user, info) => user.Id == info.UserId)
.OrderBy(discuss => SqlFunc.GetRandom())

View File

@@ -13,9 +13,9 @@ namespace Yi.Framework.Bbs.Application.Services.Bank
{
private BankManager _bankManager;
private BbsUserManager _bbsUserManager;
private ISqlSugarRepository<BankCardEntity, Guid> _repository;
private ISqlSugarRepository<InterestRecordsEntity, Guid> _interestRepository;
public BankService(BankManager bankManager, BbsUserManager userManager, ISqlSugarRepository<BankCardEntity, Guid> repository, ISqlSugarRepository<InterestRecordsEntity, Guid> interestRepository)
private ISqlSugarRepository<BankCardAggregateRoot, Guid> _repository;
private ISqlSugarRepository<InterestRecordsAggregateRoot, Guid> _interestRepository;
public BankService(BankManager bankManager, BbsUserManager userManager, ISqlSugarRepository<BankCardAggregateRoot, Guid> repository, ISqlSugarRepository<InterestRecordsAggregateRoot, Guid> interestRepository)
{
_bankManager = bankManager;
_bbsUserManager = userManager;

View File

@@ -13,7 +13,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// </summary>
public class AgreeService : ApplicationService, IApplicationService
{
public AgreeService(ISqlSugarRepository<AgreeEntity> repository, ISqlSugarRepository<DiscussEntity> discssRepository)
public AgreeService(ISqlSugarRepository<AgreeEntity> repository, ISqlSugarRepository<DiscussAggregateRoot> discssRepository)
{
_repository = repository;
_discssRepository = discssRepository;
@@ -21,7 +21,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
private ISqlSugarRepository<AgreeEntity> _repository { get; set; }
private ISqlSugarRepository<DiscussEntity> _discssRepository { get; set; }
private ISqlSugarRepository<DiscussAggregateRoot> _discssRepository { get; set; }
/// <summary>

View File

@@ -31,11 +31,11 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// Article服务实现
/// </summary>
public class ArticleService : YiCrudAppService<ArticleEntity, ArticleGetOutputDto, ArticleGetListOutputDto, Guid, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>,
public class ArticleService : YiCrudAppService<ArticleAggregateRoot, ArticleGetOutputDto, ArticleGetListOutputDto, Guid, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>,
IArticleService
{
public ArticleService(IArticleRepository articleRepository,
ISqlSugarRepository<DiscussEntity> discussRepository,
ISqlSugarRepository<DiscussAggregateRoot> discussRepository,
IDiscussService discussService,
ForumManager forumManager) : base(articleRepository)
{
@@ -48,7 +48,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
}
private ForumManager _forumManager;
private IArticleRepository _articleRepository;
private ISqlSugarRepository<DiscussEntity> _discussRepository;
private ISqlSugarRepository<DiscussAggregateRoot> _discussRepository;
private IDiscussService _discussService;
public override async Task<PagedResultDto<ArticleGetListOutputDto>> GetListAsync(ArticleGetListInputVo input)

View File

@@ -12,11 +12,11 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// <summary>
/// Banner服务实现
/// </summary>
public class BannerService : YiCrudAppService<BannerEntity, BannerGetOutputDto, BannerGetListOutputDto, Guid, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
public class BannerService : YiCrudAppService<BannerAggregateRoot, BannerGetOutputDto, BannerGetListOutputDto, Guid, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
IBannerService
{
private ISqlSugarRepository<BannerEntity, Guid> _repository;
public BannerService(ISqlSugarRepository<BannerEntity, Guid> repository) : base(repository)
private ISqlSugarRepository<BannerAggregateRoot, Guid> _repository;
public BannerService(ISqlSugarRepository<BannerAggregateRoot, Guid> repository) : base(repository)
{
_repository = repository;
}

View File

@@ -21,12 +21,12 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// <summary>
/// 评论
/// </summary>
public class CommentService : YiCrudAppService<CommentEntity, CommentGetOutputDto, CommentGetListOutputDto, Guid, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>,
public class CommentService : YiCrudAppService<CommentAggregateRoot, CommentGetOutputDto, CommentGetListOutputDto, Guid, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>,
ICommentService
{
private readonly ISqlSugarRepository<CommentEntity, Guid> _repository;
private readonly ISqlSugarRepository<CommentAggregateRoot, Guid> _repository;
private readonly BbsUserManager _bbsUserManager;
public CommentService(ForumManager forumManager, ISqlSugarRepository<DiscussEntity> discussRepository, IDiscussService discussService, ISqlSugarRepository<CommentEntity, Guid> CommentRepository, BbsUserManager bbsUserManager) : base(CommentRepository)
public CommentService(ForumManager forumManager, ISqlSugarRepository<DiscussAggregateRoot> discussRepository, IDiscussService discussService, ISqlSugarRepository<CommentAggregateRoot, Guid> CommentRepository, BbsUserManager bbsUserManager) : base(CommentRepository)
{
_forumManager = forumManager;
_discussRepository = discussRepository;
@@ -39,7 +39,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
private ISqlSugarRepository<DiscussEntity> _discussRepository { get; set; }
private ISqlSugarRepository<DiscussAggregateRoot> _discussRepository { get; set; }
private IDiscussService _discussService { get; set; }
/// <summary>

View File

@@ -29,12 +29,12 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// <summary>
/// Discuss应用服务实现,用于参数校验、领域服务业务组合、日志记录、事务处理、账户信息
/// </summary>
public class DiscussService : YiCrudAppService<DiscussEntity, DiscussGetOutputDto, DiscussGetListOutputDto, Guid, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
public class DiscussService : YiCrudAppService<DiscussAggregateRoot, DiscussGetOutputDto, DiscussGetListOutputDto, Guid, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
IDiscussService
{
private ISqlSugarRepository<DiscussTopEntity> _discussTopEntityRepository;
private BbsUserManager _bbsUserManager;
public DiscussService(BbsUserManager bbsUserManager, ForumManager forumManager, ISqlSugarRepository<DiscussTopEntity> discussTopEntityRepository, ISqlSugarRepository<PlateEntity> plateEntityRepository, ILocalEventBus localEventBus) : base(forumManager._discussRepository)
public DiscussService(BbsUserManager bbsUserManager, ForumManager forumManager, ISqlSugarRepository<DiscussTopEntity> discussTopEntityRepository, ISqlSugarRepository<PlateAggregateRoot> plateEntityRepository, ILocalEventBus localEventBus) : base(forumManager._discussRepository)
{
_forumManager = forumManager;
_plateEntityRepository = plateEntityRepository;
@@ -46,7 +46,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
private ForumManager _forumManager { get; set; }
private ISqlSugarRepository<PlateEntity> _plateEntityRepository { get; set; }
private ISqlSugarRepository<PlateAggregateRoot> _plateEntityRepository { get; set; }
@@ -60,9 +60,9 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
{
//查询主题发布 浏览主题 事件,浏览数+1
var item = await _forumManager._discussRepository._DbQueryable.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
var item = await _forumManager._discussRepository._DbQueryable.LeftJoin<UserAggregateRoot>((discuss, user) => discuss.CreatorId == user.Id)
.LeftJoin<BbsUserExtraInfoEntity>((discuss, user, info) => user.Id == info.UserId)
.LeftJoin<PlateEntity>((discuss, user, info, plate) => plate.Id == discuss.PlateId)
.LeftJoin<PlateAggregateRoot>((discuss, user, info, plate) => plate.Id == discuss.PlateId)
.Select((discuss, user, info, plate) => new DiscussGetOutputDto
{
Id = discuss.Id,
@@ -114,7 +114,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
.WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId)
.WhereIF(input.IsTop is not null, x => x.IsTop == input.IsTop)
.WhereIF(input.UserId is not null,x=>x.CreatorId==input.UserId)
.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
.LeftJoin<UserAggregateRoot>((discuss, user) => discuss.CreatorId == user.Id)
.WhereIF(input.UserName is not null, (discuss, user)=>user.UserName==input.UserName!)
.LeftJoin<BbsUserExtraInfoEntity>((discuss, user, info) => user.Id == info.UserId)
@@ -157,8 +157,8 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// <returns></returns>
public async Task<List<DiscussGetListOutputDto>> GetListTopAsync()
{
var output = await _discussTopEntityRepository._DbQueryable.LeftJoin<DiscussEntity>((top, discuss) => top.DiscussId == discuss.Id)
.LeftJoin<UserEntity>((top, discuss, user) => discuss.CreatorId == user.Id)
var output = await _discussTopEntityRepository._DbQueryable.LeftJoin<DiscussAggregateRoot>((top, discuss) => top.DiscussId == discuss.Id)
.LeftJoin<UserAggregateRoot>((top, discuss, user) => discuss.CreatorId == user.Id)
.LeftJoin<BbsUserExtraInfoEntity>((top, discuss, user, info) => user.Id == info.UserId)
.OrderByDescending(top => top.OrderNum)
.Select((top, discuss, user, info) => new DiscussGetListOutputDto

View File

@@ -13,11 +13,11 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
/// <summary>
/// Plate服务实现
/// </summary>
public class PlateService : YiCrudAppService<PlateEntity, PlateGetOutputDto, PlateGetListOutputDto, Guid, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>,
public class PlateService : YiCrudAppService<PlateAggregateRoot, PlateGetOutputDto, PlateGetListOutputDto, Guid, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>,
IPlateService
{
private ISqlSugarRepository<PlateEntity, Guid> _repository;
public PlateService(ISqlSugarRepository<PlateEntity, Guid> repository) : base(repository)
private ISqlSugarRepository<PlateAggregateRoot, Guid> _repository;
public PlateService(ISqlSugarRepository<PlateAggregateRoot, Guid> repository) : base(repository)
{
_repository = repository;
}

View File

@@ -22,11 +22,11 @@ namespace Yi.Framework.Bbs.Application.Services.Integral
/// <summary>
/// 等级服务
/// </summary>
public class LevelService : YiCrudAppService<LevelEntity, LevelOutputDto, Guid, LevelGetListInputDto>, ILevelService
public class LevelService : YiCrudAppService<LevelAggregateRoot, LevelOutputDto, Guid, LevelGetListInputDto>, ILevelService
{
private ISqlSugarRepository<LevelEntity, Guid> _repository;
private ISqlSugarRepository<LevelAggregateRoot, Guid> _repository;
private LevelManager _levelManager;
public LevelService(ISqlSugarRepository<LevelEntity, Guid> repository, LevelManager levelManager) : base(repository)
public LevelService(ISqlSugarRepository<LevelAggregateRoot, Guid> repository, LevelManager levelManager) : base(repository)
{
_repository = repository;
_levelManager = levelManager;

View File

@@ -5,7 +5,7 @@ using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("AccessLog")]
public class AccessLogEntity : Entity<Guid>, IHasModificationTime, IHasCreationTime
public class AccessLogAggregateRoot : AggregateRoot<Guid>, IHasModificationTime, IHasCreationTime
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }

View File

@@ -14,13 +14,13 @@ namespace Yi.Framework.Bbs.Domain.Entities.Bank
/// 银行卡
/// </summary>
[SugarTable("BankCard")]
public class BankCardEntity : Entity<Guid>, IHasCreationTime
public class BankCardAggregateRoot : AggregateRoot<Guid>, IHasCreationTime
{
public BankCardEntity()
public BankCardAggregateRoot()
{
}
public BankCardEntity(Guid userId)
public BankCardAggregateRoot(Guid userId)
{
this.UserId = userId;
}

View File

@@ -13,11 +13,11 @@ namespace Yi.Framework.Bbs.Domain.Entities.Bank
/// 利息记录
/// </summary>
[SugarTable("InterestRecords")]
public class InterestRecordsEntity : Entity<Guid>, IHasCreationTime
public class InterestRecordsAggregateRoot : AggregateRoot<Guid>, IHasCreationTime
{
public InterestRecordsEntity()
public InterestRecordsAggregateRoot()
{ }
public InterestRecordsEntity(decimal comparisonValue, decimal inputValue, bool isFluctuate = false)
public InterestRecordsAggregateRoot(decimal comparisonValue, decimal inputValue, bool isFluctuate = false)
{
ComparisonValue = comparisonValue;
Value = inputValue;

View File

@@ -0,0 +1,32 @@
namespace Yi.Framework.Bbs.Domain.Entities
{
public class BbsNoticeAggregateRoot
{
public Guid AcceptUserId { get; set; }
/// <summary>
/// 消息
/// </summary>
public string Message { get; set; }
public MessageTypeEnum MessageType { get; set; }
/// <summary>
/// 是否已读
/// </summary>
public bool IsRead { get; set; }
/// <summary>
/// 已读时间
/// </summary>
public DateTime? ReadTime { get; set; }
}
/// <summary>
/// 消息类型
/// </summary>
public enum MessageTypeEnum
{
}
}

View File

@@ -9,7 +9,7 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
[SugarIndex($"index_{nameof(Name)}", nameof(Name), OrderByType.Asc)]
[SugarIndex($"index_{nameof(ParentId)}", nameof(ParentId), OrderByType.Asc)]
[SugarIndex($"index_{nameof(DiscussId)}", nameof(DiscussId), OrderByType.Asc)]
public class ArticleEntity : Entity<Guid>, ISoftDelete, IAuditedObject
public class ArticleAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
@@ -26,7 +26,7 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
[SugarColumn(IsIgnore = true)]
public List<ArticleEntity>? Children { get; set; }
public List<ArticleAggregateRoot>? Children { get; set; }
public DateTime CreationTime { get; set; }
@@ -50,14 +50,14 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
/// </summary>
/// <param name="entities"></param>
/// <returns></returns>
public static List<ArticleEntity> Tile(this List<ArticleEntity> entities)
public static List<ArticleAggregateRoot> Tile(this List<ArticleAggregateRoot> entities)
{
if (entities is null) return new List<ArticleEntity>();
var result = new List<ArticleEntity>();
if (entities is null) return new List<ArticleAggregateRoot>();
var result = new List<ArticleAggregateRoot>();
return StartRecursion(entities, result);
}
private static List<ArticleEntity> StartRecursion(List<ArticleEntity> entities, List<ArticleEntity> result)
private static List<ArticleAggregateRoot> StartRecursion(List<ArticleAggregateRoot> entities, List<ArticleAggregateRoot> result)
{
foreach (var entity in entities)
{

View File

@@ -6,7 +6,7 @@ using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities.Forum
{
[SugarTable("Banner")]
public class BannerEntity : Entity<Guid>, ISoftDelete, IAuditedObject
public class BannerAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }

View File

@@ -13,16 +13,16 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
[SugarTable("Comment")]
[SugarIndex($"index_{nameof(DiscussId)}", nameof(DiscussId), OrderByType.Asc)]
[SugarIndex($"index_{nameof(ParentId)}", nameof(ParentId), OrderByType.Asc)]
public class CommentEntity : Entity<Guid>, ISoftDelete, IAuditedObject
public class CommentAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
{
/// <summary>
/// 采用二维数组方式,不使用树形方式
/// </summary>
public CommentEntity()
public CommentAggregateRoot()
{
}
public CommentEntity(Guid discussId)
public CommentAggregateRoot(Guid discussId)
{
DiscussId = discussId;
}
@@ -45,20 +45,20 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
public Guid RootId { get; set; }
[SugarColumn(IsIgnore = true)]
public List<CommentEntity> Children { get; set; } = new();
public List<CommentAggregateRoot> Children { get; set; } = new();
/// <summary>
/// 用户,评论人用户信息
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(CreatorId))]
public UserEntity CreateUser { get; set; }
public UserAggregateRoot CreateUser { get; set; }
/// <summary>
/// 被评论的用户信息
/// </summary>
[SugarColumn(IsIgnore = true)]
public UserEntity CommentedUser { get; set; }
public UserAggregateRoot CommentedUser { get; set; }
public Guid? CreatorId { get; set; }

View File

@@ -10,12 +10,12 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
[SugarIndex($"index_{nameof(Title)}", nameof(Title), OrderByType.Asc)]
[SugarIndex($"index_{nameof(PlateId)}", nameof(PlateId), OrderByType.Asc)]
[SugarIndex($"index_{nameof(CreationTime)}", nameof(CreationTime), OrderByType.Desc)]
public class DiscussEntity : Entity<Guid>, ISoftDelete, IAuditedObject
public class DiscussAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
{
public DiscussEntity()
public DiscussAggregateRoot()
{
}
public DiscussEntity(Guid plateId)
public DiscussAggregateRoot(Guid plateId)
{
PlateId = plateId;
}

View File

@@ -6,7 +6,7 @@ using Volo.Abp.Auditing;
namespace Yi.Framework.Bbs.Domain.Entities.Forum
{
[SugarTable("Plate")]
public class PlateEntity : Entity<Guid>, ISoftDelete, IAuditedObject
public class PlateAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]

View File

@@ -7,11 +7,11 @@ namespace Yi.Framework.Bbs.Domain.Entities.Integral
/// 等级表
/// </summary>
[SugarTable("Level")]
public class LevelEntity : Entity<Guid>
public class LevelAggregateRoot : AggregateRoot<Guid>
{
public LevelEntity() { }
public LevelAggregateRoot() { }
public LevelEntity(int currentLevel, string name, decimal minExperience)
public LevelAggregateRoot(int currentLevel, string name, decimal minExperience)
{
this.CurrentLevel = currentLevel;
this.Name = name;

View File

@@ -15,7 +15,7 @@ namespace Yi.Framework.Bbs.Domain.Entities.Integral
[SugarTable("SignIn")]
[SugarIndex($"index_{nameof(CreatorId)}", nameof(CreatorId), OrderByType.Asc)]
public class SignInEntity : Entity<Guid>, ICreationAuditedObject
public class SignInAggregateRoot : AggregateRoot<Guid>, ICreationAuditedObject
{
[SugarColumn(IsPrimaryKey = true)]

View File

@@ -4,7 +4,7 @@ using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Setting")]
public class SettingEntity : Entity<Guid>
public class SettingAggregateRoot : AggregateRoot<Guid>
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]

View File

@@ -23,7 +23,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
public async Task HandleEventAsync(EntityCreatedEventData<AgreeEntity> eventData)
{
var agreeEntity = eventData.Entity;
var userId = await _agreeRepository._DbQueryable.LeftJoin<DiscussEntity>((agree, discuss) => agree.DiscussId == discuss.Id)
var userId = await _agreeRepository._DbQueryable.LeftJoin<DiscussAggregateRoot>((agree, discuss) => agree.DiscussId == discuss.Id)
.Select((agree, discuss) => discuss.CreatorId).FirstAsync();
//给创建者发布数量+1
@@ -50,7 +50,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
public async Task HandleEventAsync(EntityCreatedEventData<AgreeEntity> eventData)
{
var agreeEntity = eventData.Entity;
var userId = await _agreeRepository._DbQueryable.LeftJoin<DiscussEntity>((agree, discuss) => agree.DiscussId == discuss.Id)
var userId = await _agreeRepository._DbQueryable.LeftJoin<DiscussAggregateRoot>((agree, discuss) => agree.DiscussId == discuss.Id)
.Select((agree, discuss) => discuss.CreatorId).FirstAsync();
//给创建者发布数量-1

View File

@@ -10,7 +10,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
/// <summary>
/// 评论创建的领域事件
/// </summary>
public class CommentCreatedEventHandler : ILocalEventHandler<EntityCreatedEventData<CommentEntity>>,
public class CommentCreatedEventHandler : ILocalEventHandler<EntityCreatedEventData<CommentAggregateRoot>>,
ITransientDependency
{
private ISqlSugarRepository<BbsUserExtraInfoEntity> _userRepository;
@@ -18,7 +18,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
{
_userRepository = userRepository;
}
public async Task HandleEventAsync(EntityCreatedEventData<CommentEntity> eventData)
public async Task HandleEventAsync(EntityCreatedEventData<CommentAggregateRoot> eventData)
{
var commentEntity = eventData.Entity;

View File

@@ -10,7 +10,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
/// <summary>
/// 主题创建的领域事件
/// </summary>
public class DiscussCreatedEventHandler : ILocalEventHandler<EntityCreatedEventData<DiscussEntity>>,
public class DiscussCreatedEventHandler : ILocalEventHandler<EntityCreatedEventData<DiscussAggregateRoot>>,
ITransientDependency
{
private ISqlSugarRepository<BbsUserExtraInfoEntity> _userRepository;
@@ -18,7 +18,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
{
_userRepository = userRepository;
}
public async Task HandleEventAsync(EntityCreatedEventData<DiscussEntity> eventData)
public async Task HandleEventAsync(EntityCreatedEventData<DiscussAggregateRoot> eventData)
{
var disucussEntity = eventData.Entity;

View File

@@ -13,8 +13,8 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
{
public class SeeDiscussEventHandler : ILocalEventHandler<SeeDiscussEventArgs>, ITransientDependency
{
private IRepository<DiscussEntity, Guid> _repository;
public SeeDiscussEventHandler(IRepository<DiscussEntity, Guid> repository)
private IRepository<DiscussAggregateRoot, Guid> _repository;
public SeeDiscussEventHandler(IRepository<DiscussAggregateRoot, Guid> repository)
{
_repository = repository;
}

View File

@@ -17,7 +17,7 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
LoggerFactory = loggerFactory;
}
protected ILoggerFactory LoggerFactory { get; set; }
public virtual List<ArticleEntity> Import(Guid discussId, Guid articleParentId, List<FileObject> fileObjs)
public virtual List<ArticleAggregateRoot> Import(Guid discussId, Guid articleParentId, List<FileObject> fileObjs)
{
var articles = Convert(fileObjs);
var orderNum = 0;
@@ -29,6 +29,6 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
});
return articles;
}
public abstract List<ArticleEntity> Convert(List<FileObject> fileObjs);
public abstract List<ArticleAggregateRoot> Convert(List<FileObject> fileObjs);
}
}

View File

@@ -10,9 +10,9 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
{
internal class DefaultArticleImport : AbstractArticleImport
{
public override List<ArticleEntity> Convert(List<FileObject> fileObjs)
public override List<ArticleAggregateRoot> Convert(List<FileObject> fileObjs)
{
return fileObjs.OrderBy(x => x.FileName).Select(x => new ArticleEntity { Name = x.FileName, Content = x.Content }).ToList();
return fileObjs.OrderBy(x => x.FileName).Select(x => new ArticleAggregateRoot { Name = x.FileName, Content = x.Content }).ToList();
}
}
}

View File

@@ -11,7 +11,7 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
{
internal class VuePressArticleImport : AbstractArticleImport
{
public override List<ArticleEntity> Convert(List<FileObject> fileObjs)
public override List<ArticleAggregateRoot> Convert(List<FileObject> fileObjs)
{
var logger = LoggerFactory.CreateLogger<VuePressArticleImport>();
@@ -65,7 +65,7 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
f.Content = result;
return f;
});
var output = fileContentHandler.Select(x => new ArticleEntity() { Content = x.Content, Name = x.FileName }).ToList();
var output = fileContentHandler.Select(x => new ArticleAggregateRoot() { Content = x.Content, Name = x.FileName }).ToList();
return output;
}

View File

@@ -15,11 +15,11 @@ namespace Yi.Framework.Bbs.Domain.Managers
/// </summary>
public class BankManager : DomainService
{
private ISqlSugarRepository<BankCardEntity> _repository;
private ISqlSugarRepository<BankCardAggregateRoot> _repository;
private ILocalEventBus _localEventBus;
private ISqlSugarRepository<InterestRecordsEntity> _interestRepository;
private ISqlSugarRepository<InterestRecordsAggregateRoot> _interestRepository;
private IBankValueProvider _bankValueProvider;
public BankManager(ISqlSugarRepository<BankCardEntity> repository, ILocalEventBus localEventBus, ISqlSugarRepository<InterestRecordsEntity> interestRepository, IBankValueProvider bankValueProvider)
public BankManager(ISqlSugarRepository<BankCardAggregateRoot> repository, ILocalEventBus localEventBus, ISqlSugarRepository<InterestRecordsAggregateRoot> interestRepository, IBankValueProvider bankValueProvider)
{
_repository = repository;
_localEventBus = localEventBus;
@@ -72,7 +72,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
/// 强制创建一个记录,不管时间到没到
/// </summary>
/// <returns></returns>
public async Task<InterestRecordsEntity> CreateInterestRecordsAsync()
public async Task<InterestRecordsAggregateRoot> CreateInterestRecordsAsync()
{
//获取最新的实体
var lastEntity = await _interestRepository._DbQueryable.OrderByDescending(x => x.CreationTime).FirstAsync();
@@ -106,7 +106,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
//根据上一次的老值进行变化率比较
var currentValue = oldValue + (oldValue* changeRate);
var entity = new InterestRecordsEntity(lastThirdPartyStandardValue, currentValue);
var entity = new InterestRecordsAggregateRoot(lastThirdPartyStandardValue, currentValue);
var output = await _interestRepository.InsertReturnEntityAsync(entity);
return output;
@@ -129,7 +129,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
/// <returns></returns>
public async Task ApplyingBankCardAsync(Guid userId, int cardNumber)
{
var entities = Enumerable.Range(1, cardNumber).Select(x => new BankCardEntity(userId)).ToList();
var entities = Enumerable.Range(1, cardNumber).Select(x => new BankCardAggregateRoot(userId)).ToList();
await _repository.InsertManyAsync(entities);
}

View File

@@ -12,10 +12,10 @@ namespace Yi.Framework.Bbs.Domain.Managers
{
public class BbsUserManager : DomainService
{
public ISqlSugarRepository<UserEntity> _userRepository;
public ISqlSugarRepository<UserAggregateRoot> _userRepository;
public ISqlSugarRepository<BbsUserExtraInfoEntity> _bbsUserInfoRepository;
public Dictionary<int,LevelCacheItem> _levelCacheDic;
public BbsUserManager(ISqlSugarRepository<UserEntity> userRepository,
public BbsUserManager(ISqlSugarRepository<UserAggregateRoot> userRepository,
ISqlSugarRepository<BbsUserExtraInfoEntity> bbsUserInfoRepository,
IDistributedCache<List<LevelCacheItem>> levelCache
)

View File

@@ -14,11 +14,11 @@ namespace Yi.Framework.Bbs.Domain.Managers
/// </summary>
public class ForumManager : DomainService
{
public readonly ISqlSugarRepository<DiscussEntity, Guid> _discussRepository;
public readonly ISqlSugarRepository<PlateEntity, Guid> _plateEntityRepository;
public readonly ISqlSugarRepository<CommentEntity, Guid> _commentRepository;
public readonly ISqlSugarRepository<ArticleEntity, Guid> _articleRepository;
public ForumManager(ISqlSugarRepository<DiscussEntity, Guid> discussRepository, ISqlSugarRepository<PlateEntity, Guid> plateEntityRepository, ISqlSugarRepository<CommentEntity, Guid> commentRepository, ISqlSugarRepository<ArticleEntity, Guid> articleRepository)
public readonly ISqlSugarRepository<DiscussAggregateRoot, Guid> _discussRepository;
public readonly ISqlSugarRepository<PlateAggregateRoot, Guid> _plateEntityRepository;
public readonly ISqlSugarRepository<CommentAggregateRoot, Guid> _commentRepository;
public readonly ISqlSugarRepository<ArticleAggregateRoot, Guid> _articleRepository;
public ForumManager(ISqlSugarRepository<DiscussAggregateRoot, Guid> discussRepository, ISqlSugarRepository<PlateAggregateRoot, Guid> plateEntityRepository, ISqlSugarRepository<CommentAggregateRoot, Guid> commentRepository, ISqlSugarRepository<ArticleAggregateRoot, Guid> articleRepository)
{
_discussRepository = discussRepository;
_plateEntityRepository = plateEntityRepository;
@@ -27,7 +27,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
}
//主题是不能直接创建的,需要由领域服务统一创建
public async Task<DiscussEntity> CreateDiscussAsync(DiscussEntity entity)
public async Task<DiscussAggregateRoot> CreateDiscussAsync(DiscussAggregateRoot entity)
{
entity.CreationTime = DateTime.Now;
entity.AgreeNum = 0;
@@ -35,9 +35,9 @@ namespace Yi.Framework.Bbs.Domain.Managers
return await _discussRepository.InsertReturnEntityAsync(entity);
}
public async Task<CommentEntity> CreateCommentAsync(Guid discussId, Guid parentId, Guid rootId, string content)
public async Task<CommentAggregateRoot> CreateCommentAsync(Guid discussId, Guid parentId, Guid rootId, string content)
{
var entity = new CommentEntity(discussId);
var entity = new CommentAggregateRoot(discussId);
entity.Content = content;
entity.ParentId = parentId;
entity.RootId = rootId;

View File

@@ -10,10 +10,10 @@ namespace Yi.Framework.Bbs.Domain.Managers
{
public class IntegralManager : DomainService
{
public ISqlSugarRepository<LevelEntity> _levelRepository;
public ISqlSugarRepository<SignInEntity> _signInRepository;
public ISqlSugarRepository<LevelAggregateRoot> _levelRepository;
public ISqlSugarRepository<SignInAggregateRoot> _signInRepository;
private readonly ILocalEventBus _localEventBus;
public IntegralManager(ISqlSugarRepository<LevelEntity> levelRepository, ISqlSugarRepository<SignInEntity> signInRepository, ILocalEventBus localEventBus)
public IntegralManager(ISqlSugarRepository<LevelAggregateRoot> levelRepository, ISqlSugarRepository<SignInAggregateRoot> signInRepository, ILocalEventBus localEventBus)
{
_levelRepository = levelRepository;
_localEventBus = localEventBus;
@@ -56,7 +56,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
//插入记录
var entity = new SignInEntity() { ContinuousNumber = continuousNumber };
var entity = new SignInAggregateRoot() { ContinuousNumber = continuousNumber };
await _signInRepository.InsertAsync(entity);
//发布一个其他领域的事件
@@ -112,7 +112,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
/// <summary>
/// 获取连续次数
/// </summary>
private int GetContinuousNumber(SignInEntity sigInLast)
private int GetContinuousNumber(SignInAggregateRoot sigInLast)
{
var continuousNumber = 1;

View File

@@ -9,8 +9,8 @@ using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Domain.Repositories
{
public interface IArticleRepository: ISqlSugarRepository<ArticleEntity,Guid>
public interface IArticleRepository: ISqlSugarRepository<ArticleAggregateRoot,Guid>
{
Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where);
Task<List<ArticleAggregateRoot>> GetTreeAsync(Expression<Func<ArticleAggregateRoot, bool>> where);
}
}

View File

@@ -28,7 +28,7 @@ namespace Yi.Framework.Bbs.Domain
var logger = services.GetRequiredService<ILogger<YiFrameworkBbsDomainModule>>();
logger.LogInformation("正在初始化【BBS-等级数据】......");
var levelRepository = services.GetRequiredService<IRepository<LevelEntity>>();
var levelRepository = services.GetRequiredService<IRepository<LevelAggregateRoot>>();
var levelCache = services.GetRequiredService<IDistributedCache<List<LevelCacheItem>>>();
var cacheItem = (await levelRepository.GetListAsync()).Adapt<List<LevelCacheItem>>();
await levelCache.SetAsync(LevelConst.LevelCacheKey, cacheItem);

View File

@@ -14,8 +14,8 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
{
public class BannerDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<BannerEntity> _repository;
public BannerDataSeed(ISqlSugarRepository<BannerEntity> repository)
private ISqlSugarRepository<BannerAggregateRoot> _repository;
public BannerDataSeed(ISqlSugarRepository<BannerAggregateRoot> repository)
{
_repository = repository;
}
@@ -26,18 +26,18 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<BannerEntity> GetSeedData()
public List<BannerAggregateRoot> GetSeedData()
{
//这里临时使用了图床图床地址https://mjj.today/
List<BannerEntity> entities = new List<BannerEntity>()
List<BannerAggregateRoot> entities = new List<BannerAggregateRoot>()
{
new BannerEntity{
new BannerAggregateRoot{
Name="欢迎",
Logo="https://i.miji.bid/2023/12/15/e6478d5d15a4b941077e336790c414f6.png",
Color=""
},
new BannerEntity{
new BannerAggregateRoot{
Name="前端",
Logo="https://i.miji.bid/2023/12/15/07e9291c9311889a31a2b433d4decca0.jpeg",
Color=""

View File

@@ -16,8 +16,8 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
public class BbsMenuDataSeed : IDataSeedContributor, ITransientDependency
{
private IGuidGenerator _guidGenerator;
private ISqlSugarRepository<MenuEntity, Guid> _repository;
public BbsMenuDataSeed(ISqlSugarRepository<MenuEntity,Guid> repository, IGuidGenerator guidGenerator)
private ISqlSugarRepository<MenuAggregateRoot, Guid> _repository;
public BbsMenuDataSeed(ISqlSugarRepository<MenuAggregateRoot,Guid> repository, IGuidGenerator guidGenerator)
{
_repository=repository;
_guidGenerator=guidGenerator;
@@ -30,11 +30,11 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
}
}
public List<MenuEntity> GetSeedData()
public List<MenuAggregateRoot> GetSeedData()
{
List<MenuEntity> entities = new List<MenuEntity>();
List<MenuAggregateRoot> entities = new List<MenuAggregateRoot>();
//BBS
MenuEntity bbs = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot bbs = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "BBS",
MenuType = MenuTypeEnum.Catalogue,
@@ -50,7 +50,7 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
//板块管理
MenuEntity plate = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot plate = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "板块管理",
@@ -69,7 +69,7 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
entities.Add(plate);
//文章管理
MenuEntity article = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot article = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "文章管理",

View File

@@ -15,8 +15,8 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
public class BbsUserInfoDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<BbsUserExtraInfoEntity> _repository;
private ISqlSugarRepository<UserEntity> _userRepository;
public BbsUserInfoDataSeed(ISqlSugarRepository<BbsUserExtraInfoEntity> repository, ISqlSugarRepository<UserEntity> userReponse)
private ISqlSugarRepository<UserAggregateRoot> _userRepository;
public BbsUserInfoDataSeed(ISqlSugarRepository<BbsUserExtraInfoEntity> repository, ISqlSugarRepository<UserAggregateRoot> userReponse)
{
_repository = repository;
_userRepository = userReponse;

View File

@@ -15,8 +15,8 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
{
public class ConfigDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<ConfigEntity> _repository;
public ConfigDataSeed(ISqlSugarRepository<ConfigEntity> repository)
private ISqlSugarRepository<ConfigAggregateRoot> _repository;
public ConfigDataSeed(ISqlSugarRepository<ConfigAggregateRoot> repository)
{
_repository = repository;
}
@@ -27,10 +27,10 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<ConfigEntity> GetSeedData()
public List<ConfigAggregateRoot> GetSeedData()
{
List<ConfigEntity> entities = new List<ConfigEntity>();
ConfigEntity config1 = new ConfigEntity()
List<ConfigAggregateRoot> entities = new List<ConfigAggregateRoot>();
ConfigAggregateRoot config1 = new ConfigAggregateRoot()
{
ConfigKey = "bbs.site.name",
ConfigName = "站点名称",
@@ -38,7 +38,7 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
};
entities.Add(config1);
ConfigEntity config2 = new ConfigEntity()
ConfigAggregateRoot config2 = new ConfigAggregateRoot()
{
ConfigKey = "bbs.site.author",
ConfigName = "站点作者",
@@ -46,7 +46,7 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
};
entities.Add(config2);
ConfigEntity config3 = new ConfigEntity()
ConfigAggregateRoot config3 = new ConfigAggregateRoot()
{
ConfigKey = "bbs.site.icp",
ConfigName = "站点Icp备案",
@@ -55,7 +55,7 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
entities.Add(config3);
ConfigEntity config4 = new ConfigEntity()
ConfigAggregateRoot config4 = new ConfigAggregateRoot()
{
ConfigKey = "bbs.site.bottom",
ConfigName = "站点底部信息",

View File

@@ -7,8 +7,8 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
{
public class LevelDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<LevelEntity> _repository;
public LevelDataSeed(ISqlSugarRepository<LevelEntity> repository)
private ISqlSugarRepository<LevelAggregateRoot> _repository;
public LevelDataSeed(ISqlSugarRepository<LevelAggregateRoot> repository)
{
_repository = repository;
}
@@ -19,20 +19,20 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<LevelEntity> GetSeedData()
public List<LevelAggregateRoot> GetSeedData()
{
List<LevelEntity> entities = new List<LevelEntity>()
List<LevelAggregateRoot> entities = new List<LevelAggregateRoot>()
{
new LevelEntity(1,"小白",10),
new LevelEntity(2,"中白",30),
new LevelEntity(3,"大白",100),
new LevelEntity(4,"精英",300),
new LevelEntity(5,"熟练",600),
new LevelEntity(6,"高手",1000),
new LevelEntity(7,"老手",1500),
new LevelEntity(8,"大佬",2000),
new LevelEntity(9,"巨佬",2500),
new LevelEntity(10,"大神",3000),
new LevelAggregateRoot(1,"小白",10),
new LevelAggregateRoot(2,"中白",30),
new LevelAggregateRoot(3,"大白",100),
new LevelAggregateRoot(4,"精英",300),
new LevelAggregateRoot(5,"熟练",600),
new LevelAggregateRoot(6,"高手",1000),
new LevelAggregateRoot(7,"老手",1500),
new LevelAggregateRoot(8,"大佬",2000),
new LevelAggregateRoot(9,"巨佬",2500),
new LevelAggregateRoot(10,"大神",3000),
};
return entities;

View File

@@ -7,13 +7,13 @@ using Yi.Framework.SqlSugarCore.Repositories;
namespace Yi.Framework.Bbs.SqlSugarCore.Repositories
{
public class ArticleRepository : SqlSugarRepository<ArticleEntity,Guid>, IArticleRepository,ITransientDependency
public class ArticleRepository : SqlSugarRepository<ArticleAggregateRoot,Guid>, IArticleRepository,ITransientDependency
{
public ArticleRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
{
}
public async Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where)
public async Task<List<ArticleAggregateRoot>> GetTreeAsync(Expression<Func<ArticleAggregateRoot, bool>> where)
{
return await _DbQueryable.Where(where).OrderBy(x=>x.OrderNum).OrderBy(x=>x.CreationTime).ToTreeAsync(x => x.Children, x => x.ParentId, Guid.Empty);
}

View File

@@ -12,11 +12,11 @@ using Yi.Framework.ChatHub.Domain.Shared.Model;
namespace Yi.Framework.ChatHub.Domain.Entities
{
[SugarTable("YiMessage")]
[SugarIndex($"index_{nameof(MessageEntity)}",
[SugarIndex($"index_{nameof(MessageAggregateRoot)}",
nameof(ReceiveId), OrderByType.Asc,
nameof(SendUserId), OrderByType.Asc,
nameof(CreationTime), OrderByType.Asc)]
public class MessageEntity : Entity<Guid>, IHasCreationTime
public class MessageAggregateRoot : AggregateRoot<Guid>, IHasCreationTime
{
public static MessageContext CreatePersonal(string content, Guid userId, Guid sendUserId)
{

View File

@@ -19,8 +19,8 @@ namespace Yi.Framework.ChatHub.Domain.Managers
public class UserMessageManager : DomainService
{
private IHubContext<ChatCenterHub> _hubContext;
public ISqlSugarRepository<MessageEntity> _repository;
public UserMessageManager(IHubContext<ChatCenterHub> hubContext, ISqlSugarRepository<MessageEntity> repository)
public ISqlSugarRepository<MessageAggregateRoot> _repository;
public UserMessageManager(IHubContext<ChatCenterHub> hubContext, ISqlSugarRepository<MessageAggregateRoot> repository)
{
_hubContext = hubContext;
_repository = repository;
@@ -57,7 +57,7 @@ namespace Yi.Framework.ChatHub.Domain.Managers
public async Task CreateMessageStoreAsync(MessageContext context)
{
await _repository.InsertAsync(context.Adapt<MessageEntity>());
await _repository.InsertAsync(context.Adapt<MessageAggregateRoot>());
}
public async Task<List<ChatOnlineUserCacheItem>> GetAllUserAsync()

View File

@@ -9,10 +9,10 @@ using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.CodeGen.Application.Services;
public class TemplateService : YiCrudAppService<TemplateEntity, TemplateDto, Guid, TemplateGetListInput>, ITemplateService
public class TemplateService : YiCrudAppService<TemplateAggregateRoot, TemplateDto, Guid, TemplateGetListInput>, ITemplateService
{
private ISqlSugarRepository<TemplateEntity, Guid> _repository;
public TemplateService(ISqlSugarRepository<TemplateEntity, Guid> repository) : base(repository)
private ISqlSugarRepository<TemplateAggregateRoot, Guid> _repository;
public TemplateService(ISqlSugarRepository<TemplateAggregateRoot, Guid> repository) : base(repository)
{
_repository = repository;
}

View File

@@ -4,7 +4,7 @@ using Volo.Abp.Domain.Entities;
namespace Yi.Framework.CodeGen.Domain.Entities
{
[SugarTable("YiTemplate")]
public class TemplateEntity : Entity<Guid>
public class TemplateAggregateRoot : AggregateRoot<Guid>
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]

View File

@@ -11,9 +11,9 @@ namespace Yi.Framework.CodeGen.Domain.Managers
public class CodeFileManager : DomainService
{
private IEnumerable<ITemplateHandler> _templateHandlers;
private ISqlSugarRepository<TemplateEntity> _repository;
private ISqlSugarRepository<TemplateAggregateRoot> _repository;
private ISqlSugarRepository<FieldEntity> _fieldRepository;
public CodeFileManager(IEnumerable<ITemplateHandler> templateHandlers, ISqlSugarRepository<FieldEntity> fieldRepository, ISqlSugarRepository<TemplateEntity> repository)
public CodeFileManager(IEnumerable<ITemplateHandler> templateHandlers, ISqlSugarRepository<FieldEntity> fieldRepository, ISqlSugarRepository<TemplateAggregateRoot> repository)
{
_templateHandlers = templateHandlers;
_repository = repository;

View File

@@ -8,8 +8,8 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
{
public class TemplateDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<TemplateEntity> _repository;
public TemplateDataSeed(ISqlSugarRepository<TemplateEntity> repository)
private ISqlSugarRepository<TemplateAggregateRoot> _repository;
public TemplateDataSeed(ISqlSugarRepository<TemplateAggregateRoot> repository)
{
_repository = repository;
}
@@ -20,10 +20,10 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<TemplateEntity> GetSeedData()
public List<TemplateAggregateRoot> GetSeedData()
{
var entities = new List<TemplateEntity>();
TemplateEntity entityTemplate = new TemplateEntity()
var entities = new List<TemplateAggregateRoot>();
TemplateAggregateRoot entityTemplate = new TemplateAggregateRoot()
{
Name = "Entity",
BuildPath = "D:\\code\\Entities\\@ModelEntity.cs",
@@ -33,7 +33,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
entities.Add(entityTemplate);
TemplateEntity getListInputTemplate = new TemplateEntity()
TemplateAggregateRoot getListInputTemplate = new TemplateAggregateRoot()
{
Name = "GetListInput",
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListInput.cs",
@@ -43,7 +43,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
entities.Add(getListInputTemplate);
TemplateEntity getListOutputDtoTemplate = new TemplateEntity()
TemplateAggregateRoot getListOutputDtoTemplate = new TemplateAggregateRoot()
{
Name = "GetListOutputDto",
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListOutputDto.cs",
@@ -53,7 +53,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
entities.Add(getListOutputDtoTemplate);
TemplateEntity getOutputDtoTemplate = new TemplateEntity()
TemplateAggregateRoot getOutputDtoTemplate = new TemplateAggregateRoot()
{
Name = "GetOutputDto",
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetOutputDto.cs",
@@ -62,7 +62,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
};
entities.Add(getOutputDtoTemplate);
TemplateEntity updateInputTemplate = new TemplateEntity()
TemplateAggregateRoot updateInputTemplate = new TemplateAggregateRoot()
{
Name = "UpdateInput",
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelUpdateInput.cs",
@@ -71,7 +71,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
};
entities.Add(updateInputTemplate);
TemplateEntity createInputTemplate = new TemplateEntity()
TemplateAggregateRoot createInputTemplate = new TemplateAggregateRoot()
{
Name = "CreateInput",
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelCreateInput.cs",
@@ -81,7 +81,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
entities.Add(createInputTemplate);
TemplateEntity iServicesTemplate = new TemplateEntity()
TemplateAggregateRoot iServicesTemplate = new TemplateAggregateRoot()
{
Name = "IServices",
BuildPath = "D:\\code\\IServices\\I@ModelService.cs",
@@ -92,7 +92,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
TemplateEntity servicesTemplate = new TemplateEntity()
TemplateAggregateRoot servicesTemplate = new TemplateAggregateRoot()
{
Name = "Service",
BuildPath = "D:\\code\\Services\\@ModelService.cs",
@@ -101,7 +101,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
};
entities.Add(servicesTemplate);
TemplateEntity apiTemplate = new TemplateEntity()
TemplateAggregateRoot apiTemplate = new TemplateAggregateRoot()
{
TemplateStr = "import request from '@/utils/request'\r\n\r\n// 分页查询\r\nexport function listData(query) {\r\n return request({\r\n url: '/@model',\r\n method: 'get',\r\n params: query\r\n })\r\n}\r\n\r\n// id查询\r\nexport function getData(id) {\r\n return request({\r\n url: `/@model/${id}`,\r\n method: 'get'\r\n })\r\n}\r\n\r\n// 新增\r\nexport function addData(data) {\r\n return request({\r\n url: '/@model',\r\n method: 'post',\r\n data: data\r\n })\r\n}\r\n\r\n// 修改\r\nexport function updateData(id,data) {\r\n return request({\r\n url: `/@model/${id}`,\r\n method: 'put',\r\n data: data\r\n })\r\n}\r\n\r\n// 删除\r\nexport function delData(ids) {\r\n return request({\r\n url: `/@model`,\r\n method: 'delete',\r\n params:{id:ids}\r\n })\r\n}\r\n",
Name = "api",

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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()))

View File

@@ -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();

View File

@@ -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)
{

View File

@@ -10,7 +10,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// 配置表
/// </summary>
[SugarTable("Config")]
public class ConfigEntity : Entity<Guid>, IAuditedObject, IOrderNum, ISoftDelete
public class ConfigAggregateRoot : AggregateRoot<Guid>, IAuditedObject, IOrderNum, ISoftDelete
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }

View File

@@ -10,15 +10,15 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// 部门表
///</summary>
[SugarTable("Dept")]
public class DeptEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
public class DeptAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
{
public DeptEntity()
public DeptAggregateRoot()
{
}
public DeptEntity(Guid Id) { this.Id = Id; ParentId = Guid.Empty; }
public DeptAggregateRoot(Guid Id) { this.Id = Id; ParentId = Guid.Empty; }
public DeptEntity(Guid Id, Guid parentId) { this.Id = Id; ParentId = parentId; }
public DeptAggregateRoot(Guid Id, Guid parentId) { this.Id = Id; ParentId = parentId; }
/// <summary>
/// 主键
/// </summary>

View File

@@ -10,7 +10,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
{
[SugarTable("LoginLog")]
[SugarIndex($"index_{nameof(LoginUser)}", nameof(LoginUser), OrderByType.Asc)]
public class LoginLogEntity : Entity<Guid>, ICreationAuditedObject
public class LoginLogAggregateRoot : AggregateRoot<Guid>, ICreationAuditedObject
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
@@ -50,7 +50,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
public Guid? CreatorId { get; set; }
public LoginLogEntity GetInfoByHttpContext(HttpContext context)
public LoginLogAggregateRoot GetInfoByHttpContext(HttpContext context)
{
ClientInfo GetClientInfo(HttpContext context)
{
@@ -78,7 +78,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
location = IpTool.Search(ipAddr);
}
ClientInfo clientInfo = GetClientInfo(context);
LoginLogEntity entity = new()
LoginLogAggregateRoot entity = new()
{
Browser = clientInfo.Device.Family,
Os = clientInfo.OS.ToString(),

View File

@@ -13,12 +13,12 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// 菜单表
///</summary>
[SugarTable("Menu")]
public partial class MenuEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
public partial class MenuAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
{
public MenuEntity() { }
public MenuAggregateRoot() { }
public MenuEntity(Guid id) { Id = id; ParentId = Guid.Empty; }
public MenuEntity(Guid id, Guid parentId) { Id = id; ParentId = parentId; }
public MenuAggregateRoot(Guid id) { Id = id; ParentId = Guid.Empty; }
public MenuAggregateRoot(Guid id, Guid parentId) { Id = id; ParentId = parentId; }
/// <summary>
/// 主键
/// </summary>
@@ -123,7 +123,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
public string? Query { get; set; }
[SugarColumn(IsIgnore = true)]
public List<MenuEntity>? Children { get; set; }
public List<MenuAggregateRoot>? Children { get; set; }
}
@@ -137,7 +137,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// </summary>
/// <param name="menus"></param>
/// <returns></returns>
public static List<Vue3RouterDto> Vue3RouterBuild(this List<MenuEntity> menus)
public static List<Vue3RouterDto> Vue3RouterBuild(this List<MenuAggregateRoot> menus)
{
menus = menus.Where(m => m.MenuType != MenuTypeEnum.Component).ToList();
List<Vue3RouterDto> routers = new();

View File

@@ -12,7 +12,7 @@ using Yi.Framework.Rbac.Domain.Shared.Enums;
namespace Yi.Framework.Rbac.Domain.Entities
{
[SugarTable("Notice")]
public class NoticeEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
public class NoticeAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
{
[SugarColumn(IsPrimaryKey = true)]

View File

@@ -10,7 +10,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// 岗位表
///</summary>
[SugarTable("Post")]
public class PostEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
public class PostAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
{
/// <summary>

View File

@@ -1,5 +1,4 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Yi.Framework.Core.Data;
@@ -11,7 +10,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// 角色表
/// </summary>
[SugarTable("Role")]
public class RoleEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
public class RoleAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
{
/// <summary>
/// 主键
@@ -79,9 +78,9 @@ namespace Yi.Framework.Rbac.Domain.Entities
[Navigate(typeof(RoleMenuEntity), nameof(RoleMenuEntity.RoleId), nameof(RoleMenuEntity.MenuId))]
public List<MenuEntity>? Menus { get; set; }
public List<MenuAggregateRoot>? Menus { get; set; }
[Navigate(typeof(RoleDeptEntity), nameof(RoleDeptEntity.RoleId), nameof(RoleDeptEntity.DeptId))]
public List<DeptEntity>? Depts { get; set; }
public List<DeptAggregateRoot>? Depts { get; set; }
}
}

View File

@@ -1,5 +1,4 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Yi.Framework.Core.Data;
@@ -14,13 +13,13 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// </summary>
[SugarTable("User")]
[SugarIndex($"index_{nameof(UserName)}", nameof(UserName), OrderByType.Asc)]
public class UserEntity : Entity<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
public class UserAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject, IOrderNum, IState
{
public UserEntity()
public UserAggregateRoot()
{
}
public UserEntity(string userName, string password, long phone, string nick = "萌新")
public UserAggregateRoot(string userName, string password, long phone, string nick = "萌新")
{
UserName = userName;
EncryPassword.Password = password;
@@ -158,26 +157,26 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// 角色
/// </summary>
[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))]
public List<RoleEntity> Roles { get; set; }
public List<RoleAggregateRoot> Roles { get; set; }
/// <summary>
/// 岗位
/// </summary>
[Navigate(typeof(UserPostEntity), nameof(UserPostEntity.UserId), nameof(UserPostEntity.PostId))]
public List<PostEntity> Posts { get; set; }
public List<PostAggregateRoot> Posts { get; set; }
/// <summary>
/// 部门
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(DeptId))]
public DeptEntity? Dept { get; set; }
public DeptAggregateRoot? Dept { get; set; }
/// <summary>
/// 构建密码MD5盐值加密
/// </summary>
public UserEntity BuildPassword(string password = null)
public UserAggregateRoot BuildPassword(string password = null)
{
//如果不传值那就把自己的password当作传进来的password
if (password == null)

View File

@@ -17,12 +17,12 @@ namespace Yi.Framework.Rbac.Domain.EventHandlers
ITransientDependency
{
private readonly ILogger<LoginEventHandler> _logger;
private readonly IRepository<LoginLogEntity> _loginLogRepository;
public LoginEventHandler(ILogger<LoginEventHandler> logger, IRepository<LoginLogEntity> loginLogRepository) { _logger = logger; _loginLogRepository = loginLogRepository; }
private readonly IRepository<LoginLogAggregateRoot> _loginLogRepository;
public LoginEventHandler(ILogger<LoginEventHandler> logger, IRepository<LoginLogAggregateRoot> loginLogRepository) { _logger = logger; _loginLogRepository = loginLogRepository; }
public async Task HandleEventAsync(LoginEventArgs eventData)
{
_logger.LogInformation($"用户【{eventData.UserId}:{eventData.UserName}】登入系统");
var loginLogEntity = eventData.Adapt<LoginLogEntity>();
var loginLogEntity = eventData.Adapt<LoginLogAggregateRoot>();
loginLogEntity.LogMsg = eventData.UserName + "登录系统";
loginLogEntity.LoginUser = eventData.UserName;
loginLogEntity.CreatorId = eventData.UserId;

View File

@@ -36,7 +36,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
private readonly RbacOptions _options;
private IHttpContextAccessor _httpContextAccessor;
private UserManager _userManager;
private ISqlSugarRepository<RoleEntity> _roleRepository;
private ISqlSugarRepository<RoleAggregateRoot> _roleRepository;
private RefreshJwtOptions _refreshJwtOptions;
public AccountManager(IUserRepository repository
@@ -45,7 +45,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
, ILocalEventBus localEventBus
, UserManager userManager
, IOptions<RefreshJwtOptions> refreshJwtOptions
, ISqlSugarRepository<RoleEntity> roleRepository
, ISqlSugarRepository<RoleAggregateRoot> roleRepository
, IOptions<RbacOptions> options)
{
_repository = repository;
@@ -86,7 +86,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
//这里抛出一个登录的事件
if (_httpContextAccessor.HttpContext is not null)
{
var loginEntity = new LoginLogEntity().GetInfoByHttpContext(_httpContextAccessor.HttpContext);
var loginEntity = new LoginLogAggregateRoot().GetInfoByHttpContext(_httpContextAccessor.HttpContext);
var loginEto = loginEntity.Adapt<LoginEventArgs>();
loginEto.UserName = userInfo.User.UserName;
loginEto.UserId = userInfo.User.Id;
@@ -149,9 +149,9 @@ namespace Yi.Framework.Rbac.Domain.Managers
/// <param name="password"></param>
/// <param name="userAction"></param>
/// <returns></returns>
public async Task LoginValidationAsync(string userName, string password, Action<UserEntity> userAction = null)
public async Task LoginValidationAsync(string userName, string password, Action<UserAggregateRoot> userAction = null)
{
var user = new UserEntity();
var user = new UserAggregateRoot();
if (await ExistAsync(userName, o => user = o))
{
if (userAction is not null)
@@ -173,7 +173,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
/// <param name="userName"></param>
/// <param name="userAction"></param>
/// <returns></returns>
public async Task<bool> ExistAsync(string userName, Action<UserEntity> userAction = null)
public async Task<bool> ExistAsync(string userName, Action<UserAggregateRoot> userAction = null)
{
var user = await _repository.GetFirstAsync(u => u.UserName == userName && u.State == true);
if (userAction is not null)
@@ -280,7 +280,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
/// <returns></returns>
public async Task RegisterAsync(string userName, string password, long phone)
{
var user = new UserEntity(userName, password, phone);
var user = new UserAggregateRoot(userName, password, phone);
await _userManager.CreateAsync(user);
await _userManager.SetDefautRoleAsync(user.Id);

View File

@@ -12,7 +12,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
{
string CreateRefreshToken(Guid userId);
Task<string> GetTokenByUserIdAsync(Guid userId);
Task LoginValidationAsync(string userName, string password, Action<UserEntity> userAction = null);
Task LoginValidationAsync(string userName, string password, Action<UserAggregateRoot> userAction = null);
Task RegisterAsync(string userName, string password, long phone);
Task<bool> RestPasswordAsync(Guid userId, string password);
Task UpdatePasswordAsync(Guid userId, string newPassword, string oldPassword);

View File

@@ -6,9 +6,9 @@ namespace Yi.Framework.Rbac.Domain.Managers
{
public class RoleManager : DomainService
{
private ISqlSugarRepository<RoleEntity> _repository;
private ISqlSugarRepository<RoleAggregateRoot> _repository;
private ISqlSugarRepository<RoleMenuEntity> _roleMenuRepository;
public RoleManager(ISqlSugarRepository<RoleEntity> repository, ISqlSugarRepository<RoleMenuEntity> roleMenuRepository)
public RoleManager(ISqlSugarRepository<RoleAggregateRoot> repository, ISqlSugarRepository<RoleMenuEntity> roleMenuRepository)
{
_repository = repository;
_roleMenuRepository = roleMenuRepository;

View File

@@ -21,15 +21,15 @@ namespace Yi.Framework.Rbac.Domain.Managers
{
public class UserManager : DomainService
{
public readonly ISqlSugarRepository<UserEntity> _repository;
public readonly ISqlSugarRepository<UserAggregateRoot> _repository;
public readonly ISqlSugarRepository<UserRoleEntity> _repositoryUserRole;
public readonly ISqlSugarRepository<UserPostEntity> _repositoryUserPost;
private readonly ISqlSugarRepository<RoleEntity> _roleRepository;
private readonly ISqlSugarRepository<RoleAggregateRoot> _roleRepository;
private IDistributedCache<UserInfoCacheItem, UserInfoCacheKey> _userCache;
private readonly IGuidGenerator _guidGenerator;
private IUserRepository _userRepository;
private ILocalEventBus _localEventBus;
public UserManager(ISqlSugarRepository<UserEntity> repository, ISqlSugarRepository<UserRoleEntity> repositoryUserRole, ISqlSugarRepository<UserPostEntity> repositoryUserPost, IGuidGenerator guidGenerator, IDistributedCache<UserInfoCacheItem, UserInfoCacheKey> userCache, IUserRepository userRepository, ILocalEventBus localEventBus, ISqlSugarRepository<RoleEntity> roleRepository) =>
public UserManager(ISqlSugarRepository<UserAggregateRoot> repository, ISqlSugarRepository<UserRoleEntity> repositoryUserRole, ISqlSugarRepository<UserPostEntity> repositoryUserPost, IGuidGenerator guidGenerator, IDistributedCache<UserInfoCacheItem, UserInfoCacheKey> userCache, IUserRepository userRepository, ILocalEventBus localEventBus, ISqlSugarRepository<RoleAggregateRoot> roleRepository) =>
(_repository, _repositoryUserRole, _repositoryUserPost, _guidGenerator, _userCache, _userRepository, _localEventBus, _roleRepository) =
(repository, repositoryUserRole, repositoryUserPost, guidGenerator, userCache, userRepository, localEventBus, roleRepository);
@@ -96,7 +96,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
/// 创建用户
/// </summary>
/// <returns></returns>
public async Task CreateAsync(UserEntity userEntity)
public async Task CreateAsync(UserAggregateRoot userEntity)
{
//校验用户名
ValidateUserName(userEntity);
@@ -139,7 +139,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
}
}
private void ValidateUserName(UserEntity input)
private void ValidateUserName(UserAggregateRoot input)
{
if (input.UserName == UserConst.Admin || input.UserName == UserConst.TenantAdmin)
{
@@ -217,7 +217,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
private UserRoleMenuDto EntityMapToDto(UserEntity user)
private UserRoleMenuDto EntityMapToDto(UserAggregateRoot user)
{
var userRoleMenu = new UserRoleMenuDto();
@@ -259,11 +259,11 @@ namespace Yi.Framework.Rbac.Domain.Managers
}
//刚好可以去除一下多余的导航属性
role.Menus = new List<MenuEntity>();
role.Menus = new List<MenuAggregateRoot>();
userRoleMenu.Roles.Add(role.Adapt<RoleDto>());
}
user.Roles = new List<RoleEntity>();
user.Roles = new List<RoleAggregateRoot>();
userRoleMenu.User = user.Adapt<UserDto>();
userRoleMenu.Menus = userRoleMenu.Menus.OrderByDescending(x => x.OrderNum).ToHashSet();
return userRoleMenu;

View File

@@ -3,9 +3,9 @@ using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.Domain.Repositories
{
public interface IDeptRepository : ISqlSugarRepository<DeptEntity, Guid>
public interface IDeptRepository : ISqlSugarRepository<DeptAggregateRoot, Guid>
{
Task<List<Guid>> GetChildListAsync(Guid deptId);
Task<List<DeptEntity>> GetListRoleIdAsync(Guid roleId);
Task<List<DeptAggregateRoot>> GetListRoleIdAsync(Guid roleId);
}
}

View File

@@ -5,20 +5,20 @@ using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.Domain.Repositories
{
public interface IUserRepository : ISqlSugarRepository<UserEntity>
public interface IUserRepository : ISqlSugarRepository<UserAggregateRoot>
{
/// <summary>
/// 获取用户的所有信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
Task<UserEntity> GetUserAllInfoAsync(Guid userId);
Task<UserAggregateRoot> GetUserAllInfoAsync(Guid userId);
/// <summary>
/// 批量获取用户的所有信息
/// </summary>
/// <param name="userIds"></param>
/// <returns></returns>
Task<List<UserEntity>> GetListUserAllInfoAsync(List<Guid> userIds);
Task<List<UserAggregateRoot>> GetListUserAllInfoAsync(List<Guid> userIds);
}
}

View File

@@ -9,9 +9,9 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
public class DeptDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<DeptEntity> _repository;
private ISqlSugarRepository<DeptAggregateRoot> _repository;
private IGuidGenerator _guidGenerator;
public DeptDataSeed(ISqlSugarRepository<DeptEntity> repository, IGuidGenerator guidGenerator)
public DeptDataSeed(ISqlSugarRepository<DeptAggregateRoot> repository, IGuidGenerator guidGenerator)
{
_repository = repository;
_guidGenerator = guidGenerator;
@@ -23,11 +23,11 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<DeptEntity> GetSeedData()
public List<DeptAggregateRoot> GetSeedData()
{
var entities = new List<DeptEntity>();
var entities = new List<DeptAggregateRoot>();
DeptEntity chengziDept = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot chengziDept = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "橙子科技",
DeptCode = "Yi",
@@ -39,7 +39,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(chengziDept);
DeptEntity shenzhenDept = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot shenzhenDept = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "深圳总公司",
@@ -50,7 +50,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(shenzhenDept);
DeptEntity jiangxiDept = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot jiangxiDept = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "江西总公司",
@@ -62,7 +62,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
DeptEntity szDept1 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot szDept1 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "研发部门",
@@ -72,7 +72,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(szDept1);
DeptEntity szDept2 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot szDept2 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "市场部门",
@@ -82,7 +82,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(szDept2);
DeptEntity szDept3 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot szDept3 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "测试部门",
@@ -92,7 +92,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(szDept3);
DeptEntity szDept4 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot szDept4 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "财务部门",
@@ -102,7 +102,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(szDept4);
DeptEntity szDept5 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot szDept5 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "运维部门",
@@ -113,7 +113,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(szDept5);
DeptEntity jxDept1 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot jxDept1 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "市场部门",
@@ -124,7 +124,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(jxDept1);
DeptEntity jxDept2 = new DeptEntity(_guidGenerator.Create())
DeptAggregateRoot jxDept2 = new DeptAggregateRoot(_guidGenerator.Create())
{
DeptName = "财务部门",

View File

@@ -9,9 +9,9 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class MenuDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<MenuEntity> _repository;
private ISqlSugarRepository<MenuAggregateRoot> _repository;
private IGuidGenerator _guidGenerator;
public MenuDataSeed(ISqlSugarRepository<MenuEntity> repository, IGuidGenerator guidGenerator)
public MenuDataSeed(ISqlSugarRepository<MenuAggregateRoot> repository, IGuidGenerator guidGenerator)
{
_repository = repository;
_guidGenerator = guidGenerator;
@@ -24,14 +24,14 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<MenuEntity> GetSeedData()
public List<MenuAggregateRoot> GetSeedData()
{
List<MenuEntity> entities = new List<MenuEntity>();
List<MenuAggregateRoot> entities = new List<MenuAggregateRoot>();
//系统管理
MenuEntity system = new MenuEntity(_guidGenerator.Create(), Guid.Empty)
MenuAggregateRoot system = new MenuAggregateRoot(_guidGenerator.Create(), Guid.Empty)
{
MenuName = "系统管理",
MenuType = MenuTypeEnum.Catalogue,
@@ -45,7 +45,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(system);
//代码生成
MenuEntity code = new MenuEntity(_guidGenerator.Create(), Guid.Empty)
MenuAggregateRoot code = new MenuAggregateRoot(_guidGenerator.Create(), Guid.Empty)
{
MenuName = "代码生成",
MenuType = MenuTypeEnum.Catalogue,
@@ -59,7 +59,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(code);
//数据表管理
MenuEntity table = new MenuEntity(_guidGenerator.Create(), code.Id)
MenuAggregateRoot table = new MenuAggregateRoot(_guidGenerator.Create(), code.Id)
{
MenuName = "数据表管理",
PermissionCode = "code:table:list",
@@ -76,7 +76,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(table);
//字段管理
MenuEntity field = new MenuEntity(_guidGenerator.Create(), code.Id)
MenuAggregateRoot field = new MenuAggregateRoot(_guidGenerator.Create(), code.Id)
{
MenuName = "字段管理",
PermissionCode = "code:field:list",
@@ -95,7 +95,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//模板管理
MenuEntity template = new MenuEntity(_guidGenerator.Create(), code.Id)
MenuAggregateRoot template = new MenuAggregateRoot(_guidGenerator.Create(), code.Id)
{
MenuName = "模板管理",
PermissionCode = "code:template:list",
@@ -118,7 +118,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//系统监控
MenuEntity monitoring = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot monitoring = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "系统监控",
MenuType = MenuTypeEnum.Catalogue,
@@ -133,7 +133,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//在线用户
MenuEntity online = new MenuEntity(_guidGenerator.Create(), monitoring.Id)
MenuAggregateRoot online = new MenuAggregateRoot(_guidGenerator.Create(), monitoring.Id)
{
MenuName = "在线用户",
PermissionCode = "monitor:online:list",
@@ -150,7 +150,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(online);
//缓存列表
MenuEntity cache = new MenuEntity(_guidGenerator.Create(), monitoring.Id)
MenuAggregateRoot cache = new MenuAggregateRoot(_guidGenerator.Create(), monitoring.Id)
{
MenuName = "缓存列表",
PermissionCode = "monitor:cache:list",
@@ -167,7 +167,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(cache);
//服务监控
MenuEntity server = new MenuEntity(_guidGenerator.Create(), monitoring.Id)
MenuAggregateRoot server = new MenuAggregateRoot(_guidGenerator.Create(), monitoring.Id)
{
MenuName = "服务监控",
PermissionCode = "monitor:server:list",
@@ -184,7 +184,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(server);
//定时任务
MenuEntity task = new MenuEntity(_guidGenerator.Create(), monitoring.Id)
MenuAggregateRoot task = new MenuAggregateRoot(_guidGenerator.Create(), monitoring.Id)
{
MenuName = "定时任务",
PermissionCode = "monitor:job:list",
@@ -202,7 +202,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//系统工具
MenuEntity tool = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot tool = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "系统工具",
MenuType = MenuTypeEnum.Catalogue,
@@ -215,7 +215,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(tool);
//swagger文档
MenuEntity swagger = new MenuEntity(_guidGenerator.Create(), tool.Id)
MenuAggregateRoot swagger = new MenuAggregateRoot(_guidGenerator.Create(), tool.Id)
{
MenuName = "接口文档",
MenuType = MenuTypeEnum.Menu,
@@ -230,7 +230,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//ERP
MenuEntity erp = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot erp = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "ERP(待更新)",
MenuType = MenuTypeEnum.Catalogue,
@@ -246,7 +246,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//供应商定义
MenuEntity supplier = new MenuEntity(_guidGenerator.Create(), erp.Id)
MenuAggregateRoot supplier = new MenuAggregateRoot(_guidGenerator.Create(), erp.Id)
{
MenuName = "供应商定义",
PermissionCode = "erp:supplier:list",
@@ -262,7 +262,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(supplier);
MenuEntity supplierQuery = new MenuEntity(_guidGenerator.Create(), supplier.Id)
MenuAggregateRoot supplierQuery = new MenuAggregateRoot(_guidGenerator.Create(), supplier.Id)
{
MenuName = "供应商查询",
PermissionCode = "erp:supplier:query",
@@ -272,7 +272,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(supplierQuery);
MenuEntity supplierAdd = new MenuEntity(_guidGenerator.Create(), supplier.Id)
MenuAggregateRoot supplierAdd = new MenuAggregateRoot(_guidGenerator.Create(), supplier.Id)
{
MenuName = "供应商新增",
PermissionCode = "erp:supplier:add",
@@ -283,7 +283,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(supplierAdd);
MenuEntity supplierEdit = new MenuEntity(_guidGenerator.Create(), supplier.Id)
MenuAggregateRoot supplierEdit = new MenuAggregateRoot(_guidGenerator.Create(), supplier.Id)
{
MenuName = "供应商修改",
PermissionCode = "erp:supplier:edit",
@@ -293,7 +293,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(supplierEdit);
MenuEntity supplierRemove = new MenuEntity(_guidGenerator.Create(), supplier.Id)
MenuAggregateRoot supplierRemove = new MenuAggregateRoot(_guidGenerator.Create(), supplier.Id)
{
MenuName = "供应商删除",
PermissionCode = "erp:supplier:remove",
@@ -305,7 +305,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//仓库定义
MenuEntity warehouse = new MenuEntity(_guidGenerator.Create(), erp.Id)
MenuAggregateRoot warehouse = new MenuAggregateRoot(_guidGenerator.Create(), erp.Id)
{
MenuName = "仓库定义",
PermissionCode = "erp:warehouse:list",
@@ -321,7 +321,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(warehouse);
MenuEntity warehouseQuery = new MenuEntity(_guidGenerator.Create(), warehouse.Id)
MenuAggregateRoot warehouseQuery = new MenuAggregateRoot(_guidGenerator.Create(), warehouse.Id)
{
MenuName = "仓库查询",
PermissionCode = "erp:warehouse:query",
@@ -332,7 +332,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(warehouseQuery);
MenuEntity warehouseAdd = new MenuEntity(_guidGenerator.Create(), warehouse.Id)
MenuAggregateRoot warehouseAdd = new MenuAggregateRoot(_guidGenerator.Create(), warehouse.Id)
{
MenuName = "仓库新增",
PermissionCode = "erp:warehouse:add",
@@ -342,7 +342,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(warehouseAdd);
MenuEntity warehouseEdit = new MenuEntity(_guidGenerator.Create(), warehouse.Id)
MenuAggregateRoot warehouseEdit = new MenuAggregateRoot(_guidGenerator.Create(), warehouse.Id)
{
MenuName = "仓库修改",
PermissionCode = "erp:warehouse:edit",
@@ -352,7 +352,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(warehouseEdit);
MenuEntity warehouseRemove = new MenuEntity(_guidGenerator.Create(), warehouse.Id)
MenuAggregateRoot warehouseRemove = new MenuAggregateRoot(_guidGenerator.Create(), warehouse.Id)
{
MenuName = "仓库删除",
PermissionCode = "erp:warehouse:remove",
@@ -364,7 +364,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//单位定义
MenuEntity unit = new MenuEntity(_guidGenerator.Create(), erp.Id)
MenuAggregateRoot unit = new MenuAggregateRoot(_guidGenerator.Create(), erp.Id)
{
MenuName = "单位定义",
PermissionCode = "erp:unit:list",
@@ -380,7 +380,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(unit);
MenuEntity unitQuery = new MenuEntity(_guidGenerator.Create(), unit.Id)
MenuAggregateRoot unitQuery = new MenuAggregateRoot(_guidGenerator.Create(), unit.Id)
{
MenuName = "单位查询",
PermissionCode = "erp:unit:query",
@@ -390,7 +390,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(unitQuery);
MenuEntity unitAdd = new MenuEntity(_guidGenerator.Create(), unit.Id)
MenuAggregateRoot unitAdd = new MenuAggregateRoot(_guidGenerator.Create(), unit.Id)
{
MenuName = "单位新增",
PermissionCode = "erp:unit:add",
@@ -400,7 +400,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(unitAdd);
MenuEntity unitEdit = new MenuEntity(_guidGenerator.Create(), unit.Id)
MenuAggregateRoot unitEdit = new MenuAggregateRoot(_guidGenerator.Create(), unit.Id)
{
MenuName = "单位修改",
PermissionCode = "erp:unit:edit",
@@ -410,7 +410,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(unitEdit);
MenuEntity unitRemove = new MenuEntity(_guidGenerator.Create(), unit.Id)
MenuAggregateRoot unitRemove = new MenuAggregateRoot(_guidGenerator.Create(), unit.Id)
{
MenuName = "单位删除",
PermissionCode = "erp:unit:remove",
@@ -422,7 +422,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//物料定义
MenuEntity material = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot material = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "物料定义",
@@ -440,7 +440,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(material);
MenuEntity materialQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot materialQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "物料查询",
@@ -452,7 +452,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(materialQuery);
MenuEntity materialAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot materialAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "物料新增",
@@ -464,7 +464,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(materialAdd);
MenuEntity materialEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot materialEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "物料修改",
@@ -476,7 +476,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(materialEdit);
MenuEntity materialRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot materialRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "物料删除",
@@ -490,7 +490,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//采购订单
MenuEntity purchase = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot purchase = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "采购订单",
@@ -508,7 +508,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(purchase);
MenuEntity purchaseQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot purchaseQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "采购订单查询",
@@ -520,7 +520,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(purchaseQuery);
MenuEntity purchaseAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot purchaseAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "采购订单新增",
@@ -532,7 +532,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(purchaseAdd);
MenuEntity purchaseEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot purchaseEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "采购订单修改",
@@ -544,7 +544,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(purchaseEdit);
MenuEntity purchaseRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot purchaseRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "采购订单删除",
@@ -559,7 +559,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//Yi框架
MenuEntity guide = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot guide = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "Yi框架",
@@ -574,7 +574,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(guide);
//租户管理
MenuEntity tenant = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot tenant = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "租户管理",
PermissionCode = "system:tenant:list",
@@ -591,7 +591,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(tenant);
MenuEntity tenantQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot tenantQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "租户查询",
@@ -603,7 +603,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(tenantQuery);
MenuEntity tenantAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot tenantAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "租户新增",
@@ -615,7 +615,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(tenantAdd);
MenuEntity tenantEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot tenantEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "租户修改",
@@ -627,7 +627,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(tenantEdit);
MenuEntity tenantRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot tenantRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "租户删除",
@@ -651,7 +651,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//用户管理
MenuEntity user = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot user = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "用户管理",
@@ -669,7 +669,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(user);
MenuEntity userQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot userQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "用户查询",
@@ -681,7 +681,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(userQuery);
MenuEntity userAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot userAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "用户新增",
@@ -693,7 +693,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(userAdd);
MenuEntity userEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot userEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "用户修改",
@@ -705,7 +705,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(userEdit);
MenuEntity userRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot userRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "用户删除",
@@ -719,7 +719,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//角色管理
MenuEntity role = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot role = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "角色管理",
@@ -737,7 +737,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(role);
MenuEntity roleQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot roleQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "角色查询",
@@ -749,7 +749,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(roleQuery);
MenuEntity roleAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot roleAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "角色新增",
@@ -761,7 +761,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(roleAdd);
MenuEntity roleEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot roleEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "角色修改",
@@ -773,7 +773,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(roleEdit);
MenuEntity roleRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot roleRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "角色删除",
@@ -787,7 +787,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//菜单管理
MenuEntity menu = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot menu = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "菜单管理",
@@ -805,7 +805,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(menu);
MenuEntity menuQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot menuQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "菜单查询",
@@ -817,7 +817,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(menuQuery);
MenuEntity menuAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot menuAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "菜单新增",
@@ -829,7 +829,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(menuAdd);
MenuEntity menuEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot menuEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "菜单修改",
@@ -841,7 +841,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(menuEdit);
MenuEntity menuRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot menuRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "菜单删除",
@@ -854,7 +854,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(menuRemove);
//部门管理
MenuEntity dept = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot dept = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "部门管理",
@@ -872,7 +872,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(dept);
MenuEntity deptQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot deptQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "部门查询",
@@ -884,7 +884,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(deptQuery);
MenuEntity deptAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot deptAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "部门新增",
@@ -896,7 +896,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(deptAdd);
MenuEntity deptEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot deptEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "部门修改",
@@ -908,7 +908,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(deptEdit);
MenuEntity deptRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot deptRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "部门删除",
@@ -923,7 +923,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//岗位管理
MenuEntity post = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot post = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "岗位管理",
@@ -941,7 +941,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(post);
MenuEntity postQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot postQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "岗位查询",
@@ -953,7 +953,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(postQuery);
MenuEntity postAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot postAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "岗位新增",
@@ -965,7 +965,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(postAdd);
MenuEntity postEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot postEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "岗位修改",
@@ -977,7 +977,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(postEdit);
MenuEntity postRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot postRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "岗位删除",
@@ -990,7 +990,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(postRemove);
//字典管理
MenuEntity dict = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot dict = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "字典管理",
@@ -1008,7 +1008,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(dict);
MenuEntity dictQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot dictQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "字典查询",
@@ -1020,7 +1020,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(dictQuery);
MenuEntity dictAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot dictAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "字典新增",
@@ -1032,7 +1032,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(dictAdd);
MenuEntity dictEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot dictEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "字典修改",
@@ -1044,7 +1044,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(dictEdit);
MenuEntity dictRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot dictRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "字典删除",
@@ -1058,7 +1058,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//参数设置
MenuEntity config = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot config = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数设置",
@@ -1076,7 +1076,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(config);
MenuEntity configQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot configQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数查询",
@@ -1088,7 +1088,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(configQuery);
MenuEntity configAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot configAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数新增",
@@ -1100,7 +1100,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(configAdd);
MenuEntity configEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot configEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数修改",
@@ -1112,7 +1112,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(configEdit);
MenuEntity configRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot configRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数删除",
@@ -1128,7 +1128,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//通知公告
MenuEntity notice = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot notice = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "通知公告",
@@ -1146,7 +1146,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(notice);
MenuEntity noticeQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot noticeQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "通知查询",
@@ -1158,7 +1158,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(noticeQuery);
MenuEntity noticeAdd = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot noticeAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "通知新增",
@@ -1170,7 +1170,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(noticeAdd);
MenuEntity noticeEdit = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot noticeEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "通知修改",
@@ -1182,7 +1182,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(noticeEdit);
MenuEntity noticeRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot noticeRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "通知删除",
@@ -1197,7 +1197,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//日志管理
MenuEntity log = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot log = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "日志管理",
@@ -1213,7 +1213,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(log);
//操作日志
MenuEntity operationLog = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot operationLog = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "操作日志",
@@ -1231,7 +1231,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(operationLog);
MenuEntity operationLogQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot operationLogQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "操作查询",
@@ -1243,7 +1243,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(operationLogQuery);
MenuEntity operationLogRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot operationLogRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "操作删除",
@@ -1257,7 +1257,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
//登录日志
MenuEntity loginLog = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot loginLog = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "登录日志",
@@ -1275,7 +1275,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(loginLog);
MenuEntity loginLogQuery = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot loginLogQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "登录查询",
@@ -1287,7 +1287,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(loginLogQuery);
MenuEntity loginLogRemove = new MenuEntity(_guidGenerator.Create())
MenuAggregateRoot loginLogRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "登录删除",

View File

@@ -7,8 +7,8 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class PostDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<PostEntity> _repository;
public PostDataSeed(ISqlSugarRepository<PostEntity> repository)
private ISqlSugarRepository<PostAggregateRoot> _repository;
public PostDataSeed(ISqlSugarRepository<PostAggregateRoot> repository)
{
_repository = repository;
}
@@ -19,11 +19,11 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<PostEntity> GetSeedData()
public List<PostAggregateRoot> GetSeedData()
{
var entites = new List<PostEntity>();
var entites = new List<PostAggregateRoot>();
PostEntity Post1 = new PostEntity()
PostAggregateRoot Post1 = new PostAggregateRoot()
{
PostName = "董事长",
@@ -33,7 +33,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entites.Add(Post1);
PostEntity Post2 = new PostEntity()
PostAggregateRoot Post2 = new PostAggregateRoot()
{
PostName = "项目经理",
@@ -43,7 +43,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entites.Add(Post2);
PostEntity Post3 = new PostEntity()
PostAggregateRoot Post3 = new PostAggregateRoot()
{
PostName = "人力资源",
@@ -53,7 +53,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entites.Add(Post3);
PostEntity Post4 = new PostEntity()
PostAggregateRoot Post4 = new PostAggregateRoot()
{
PostName = "普通员工",

View File

@@ -8,16 +8,16 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class RoleDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<RoleEntity> _repository;
public RoleDataSeed(ISqlSugarRepository<RoleEntity> repository)
private ISqlSugarRepository<RoleAggregateRoot> _repository;
public RoleDataSeed(ISqlSugarRepository<RoleAggregateRoot> repository)
{
_repository = repository;
}
public List<RoleEntity> GetSeedData()
public List<RoleAggregateRoot> GetSeedData()
{
var entities = new List<RoleEntity>();
RoleEntity role1 = new RoleEntity()
var entities = new List<RoleAggregateRoot>();
RoleAggregateRoot role1 = new RoleAggregateRoot()
{
RoleName = "管理员",
@@ -29,7 +29,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(role1);
RoleEntity role2 = new RoleEntity()
RoleAggregateRoot role2 = new RoleAggregateRoot()
{
RoleName = "测试角色",
@@ -41,7 +41,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(role2);
RoleEntity role3 = new RoleEntity()
RoleAggregateRoot role3 = new RoleAggregateRoot()
{
RoleName = "普通角色",
@@ -53,7 +53,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(role3);
RoleEntity role4 = new RoleEntity()
RoleAggregateRoot role4 = new RoleAggregateRoot()
{
RoleName = "默认角色",

View File

@@ -11,9 +11,9 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class UserDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<UserEntity> _repository;
private ISqlSugarRepository<UserAggregateRoot> _repository;
private RbacOptions _options;
public UserDataSeed(ISqlSugarRepository<UserEntity> repository, IOptions<RbacOptions> options)
public UserDataSeed(ISqlSugarRepository<UserAggregateRoot> repository, IOptions<RbacOptions> options)
{
_repository = repository;
_options = options.Value;
@@ -22,8 +22,8 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
if (!await _repository.IsAnyAsync(x => true))
{
var entities = new List<UserEntity>();
UserEntity user1 = new UserEntity()
var entities = new List<UserAggregateRoot>();
UserAggregateRoot user1 = new UserAggregateRoot()
{
Name = "大橙子",
UserName = "cc",
@@ -42,7 +42,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
user1.BuildPassword();
entities.Add(user1);
UserEntity user2 = new UserEntity()
UserAggregateRoot user2 = new UserAggregateRoot()
{
Name = "大测试",
@@ -63,7 +63,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
user2.BuildPassword();
entities.Add(user2);
UserEntity user3 = new UserEntity()
UserAggregateRoot user3 = new UserAggregateRoot()
{
Name = "游客",

View File

@@ -7,7 +7,7 @@ using Yi.Framework.SqlSugarCore.Repositories;
namespace Yi.Framework.Rbac.SqlSugarCore.Repositories
{
public class DeptRepository : SqlSugarRepository<DeptEntity, Guid>, IDeptRepository, ITransientDependency
public class DeptRepository : SqlSugarRepository<DeptAggregateRoot, Guid>, IDeptRepository, ITransientDependency
{
public DeptRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
{
@@ -18,7 +18,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.Repositories
var entities = await _DbQueryable.ToChildListAsync(x => x.ParentId, deptId);
return entities.Select(x => x.Id).ToList();
}
public async Task<List<DeptEntity>> GetListRoleIdAsync(Guid roleId)
public async Task<List<DeptAggregateRoot>> GetListRoleIdAsync(Guid roleId)
{
return await _DbQueryable.Where(d => SqlFunc.Subqueryable<RoleDeptEntity>().Where(rd => rd.RoleId == roleId && d.Id == rd.DeptId).Any()).ToListAsync();

View File

@@ -10,7 +10,7 @@ using Yi.Framework.SqlSugarCore.Repositories;
namespace Yi.Framework.Rbac.SqlSugarCore.Repositories
{
public class UserRepository : SqlSugarRepository<UserEntity>, IUserRepository, ITransientDependency
public class UserRepository : SqlSugarRepository<UserAggregateRoot>, IUserRepository, ITransientDependency
{
public UserRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
{
@@ -21,7 +21,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.Repositories
/// <param name="userIds"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public async Task<List<UserEntity>> GetListUserAllInfoAsync(List<Guid> userIds)
public async Task<List<UserAggregateRoot>> GetListUserAllInfoAsync(List<Guid> userIds)
{
var users = await _DbQueryable.Where(x => userIds.Contains(x.Id)).Includes(u => u.Roles.Where(r => r.IsDeleted == false).ToList(), r => r.Menus.Where(m => m.IsDeleted == false).ToList()).ToListAsync();
return users;
@@ -34,7 +34,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.Repositories
/// <param name="userId"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public async Task<UserEntity> GetUserAllInfoAsync(Guid userId)
public async Task<UserAggregateRoot> GetUserAllInfoAsync(Guid userId)
{
//得到用户
var user = await _DbQueryable.Includes(u => u.Roles.Where(r => r.IsDeleted == false).ToList(), r => r.Menus.Where(m => m.IsDeleted == false).ToList()).InSingleAsync(userId);

View File

@@ -36,8 +36,8 @@ namespace Yi.Framework.Rbac.SqlSugarCore
if (CurrentUser.Id == null || CurrentUser.IsRefreshToken()) return;
//管理员不过滤
if (CurrentUser.UserName.Equals(UserConst.Admin) || CurrentUser.Roles.Any(f => f.Equals(UserConst.AdminRolesCode))) return;
var expUser = Expressionable.Create<UserEntity>();
var expRole = Expressionable.Create<RoleEntity>();
var expUser = Expressionable.Create<UserAggregateRoot>();
var expRole = Expressionable.Create<RoleAggregateRoot>();
var roleInfo = CurrentUser.GetRoleInfo();
@@ -70,7 +70,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore
else if (DataScopeEnum.DEPT_FOLLOW.Equals(dataScope))//本部门及以下数据
{
//SQl OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )
var allChildDepts = sqlSugarClient.Queryable<DeptEntity>().ToChildList(it => it.ParentId, CurrentUser.GetDeptId());
var allChildDepts = sqlSugarClient.Queryable<DeptAggregateRoot>().ToChildList(it => it.ParentId, CurrentUser.GetDeptId());
expUser.Or(it => allChildDepts.Select(f => f.Id).ToList().Contains(it.DeptId ?? Guid.Empty));
}

View File

@@ -13,8 +13,8 @@ namespace Acme.BookStore.Application.Jobs
/// </summary>
public class TestJob : QuartzBackgroundWorkerBase
{
private ISqlSugarRepository<UserEntity> _repository;
public TestJob(ISqlSugarRepository<UserEntity> repository)
private ISqlSugarRepository<UserAggregateRoot> _repository;
public TestJob(ISqlSugarRepository<UserAggregateRoot> repository)
{
_repository = repository;
JobDetail = JobBuilder.Create<TestJob>().WithIdentity(nameof(TestJob)).Build();

View File

@@ -34,14 +34,14 @@ namespace Yi.Abp.Application.Jobs
//定时任务,非常简单
_logger.LogWarning("演示环境正在还原!");
var db = _dbContext.SqlSugarClient.CopyNew();
db.DbMaintenance.TruncateTable<UserEntity>();
db.DbMaintenance.TruncateTable<UserAggregateRoot>();
db.DbMaintenance.TruncateTable<UserRoleEntity>();
db.DbMaintenance.TruncateTable<RoleEntity>();
db.DbMaintenance.TruncateTable<RoleAggregateRoot>();
db.DbMaintenance.TruncateTable<RoleMenuEntity>();
db.DbMaintenance.TruncateTable<MenuEntity>();
db.DbMaintenance.TruncateTable<MenuAggregateRoot>();
db.DbMaintenance.TruncateTable<RoleDeptEntity>();
db.DbMaintenance.TruncateTable<DeptEntity>();
db.DbMaintenance.TruncateTable<PostEntity>();
db.DbMaintenance.TruncateTable<DeptAggregateRoot>();
db.DbMaintenance.TruncateTable<PostAggregateRoot>();
db.DbMaintenance.TruncateTable<UserPostEntity>();
//删除种子数据

View File

@@ -13,8 +13,8 @@ namespace Yi.Abp.Application.Jobs
/// </summary>
public class TestJob : QuartzBackgroundWorkerBase
{
private ISqlSugarRepository<UserEntity> _repository;
public TestJob(ISqlSugarRepository<UserEntity> repository)
private ISqlSugarRepository<UserAggregateRoot> _repository;
public TestJob(ISqlSugarRepository<UserAggregateRoot> repository)
{
_repository = repository;
JobDetail = JobBuilder.Create<TestJob>().WithIdentity(nameof(TestJob)).Build();

View File

@@ -20,7 +20,7 @@ namespace Yi.Abp.Application.Services
/// 属性注入
/// 不推荐,坑太多,容易把自己玩死,简单的东西可以用一用
/// </summary>
public ISqlSugarRepository<BannerEntity> sqlSugarRepository { get; set; }
public ISqlSugarRepository<BannerAggregateRoot> sqlSugarRepository { get; set; }
/// <summary>
/// 动态Api
@@ -62,14 +62,14 @@ namespace Yi.Abp.Application.Services
{
tasks.Add(Task.Run(async () =>
{
await sqlSugarRepository.InsertAsync(new BannerEntity { Name = "插入2" });
await sqlSugarRepository.InsertAsync(new BannerAggregateRoot { Name = "插入2" });
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
await sqlSugarRepository.InsertAsync(new BannerEntity { Name = "插入1" });
await sqlSugarRepository.InsertAsync(new BannerAggregateRoot { Name = "插入1" });
await uow.CompleteAsync();
}
}));
await sqlSugarRepository.InsertAsync(new BannerEntity { Name = "插入3" });
await sqlSugarRepository.InsertAsync(new BannerAggregateRoot { Name = "插入3" });
i--;
}
@@ -115,7 +115,7 @@ namespace Yi.Abp.Application.Services
public void GetMapper()
{
//直接无脑Adapt无需配置
var entity = new BannerEntity();
var entity = new BannerAggregateRoot();
var dto = entity.Adapt<BannerGetListOutputDto>();
}

View File

@@ -22,11 +22,11 @@ namespace Yi.Framework.Rbac.Test.System
{
private IAccountService _accountService;
private ISqlSugarRepository<UserEntity> _userRepository;
private ISqlSugarRepository<UserAggregateRoot> _userRepository;
public Account_Test()
{
_accountService = GetRequiredService<IAccountService>();
_userRepository = GetRequiredService<ISqlSugarRepository<UserEntity>>();
_userRepository = GetRequiredService<ISqlSugarRepository<UserAggregateRoot>>();
}
/// <summary>

View File

@@ -16,11 +16,11 @@ namespace Yi.Framework.Rbac.Test.System
public class User_Test : YiTestBase
{
private IUserService _userService;
private ISqlSugarRepository<UserEntity> _repository;
private ISqlSugarRepository<UserAggregateRoot> _repository;
public User_Test()
{
_userService = ServiceProvider.GetRequiredService<IUserService>();
_repository = ServiceProvider.GetRequiredService<ISqlSugarRepository<UserEntity>>();
_repository = ServiceProvider.GetRequiredService<ISqlSugarRepository<UserAggregateRoot>>();
}
/// <summary>

View File

@@ -45,8 +45,8 @@ namespace Yi.Framework.Rbac.Test
#region
var roleManager = services.GetRequiredService<RoleManager>();
var roleRep = services.GetRequiredService<ISqlSugarRepository<RoleEntity>>();
var menuRep = services.GetRequiredService<ISqlSugarRepository<MenuEntity>>();
var roleRep = services.GetRequiredService<ISqlSugarRepository<RoleAggregateRoot>>();
var menuRep = services.GetRequiredService<ISqlSugarRepository<MenuAggregateRoot>>();
var defaultRoleEntity = await roleRep._DbQueryable.Where(x => x.RoleCode == UserConst.DefaultRoleCode).FirstAsync();
var menuIds = await menuRep._DbQueryable.Where(x => x.PermissionCode.Contains("user")).Select(x => x.Id).ToListAsync();
await roleManager.GiveRoleSetMenuAsync(new List<Guid> { defaultRoleEntity.Id }, menuIds);