chore: 构建稳定版本

This commit is contained in:
陈淳
2023-12-11 09:55:12 +08:00
parent 098d4bc85f
commit 769a6a9c63
756 changed files with 10431 additions and 19867 deletions

View File

@@ -0,0 +1,141 @@
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class DeptDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<DeptEntity> _repository;
private IGuidGenerator _guidGenerator;
public DeptDataSeed(ISqlSugarRepository<DeptEntity> repository, IGuidGenerator guidGenerator)
{
_repository = repository;
_guidGenerator = guidGenerator;
}
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => true))
{
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<DeptEntity> GetSeedData()
{
var entities = new List<DeptEntity>();
DeptEntity chengziDept = new DeptEntity(_guidGenerator.Create())
{
DeptName = "橙子科技",
DeptCode = "Yi",
OrderNum = 100,
IsDeleted = false,
Leader = "橙子",
Remark = "如名所指"
};
entities.Add(chengziDept);
DeptEntity shenzhenDept = new DeptEntity(_guidGenerator.Create())
{
DeptName = "深圳总公司",
OrderNum = 100,
IsDeleted = false,
ParentId = chengziDept.Id
};
entities.Add(shenzhenDept);
DeptEntity jiangxiDept = new DeptEntity(_guidGenerator.Create())
{
DeptName = "江西总公司",
OrderNum = 100,
IsDeleted = false,
ParentId = chengziDept.Id
};
entities.Add(jiangxiDept);
DeptEntity szDept1 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "研发部门",
OrderNum = 100,
IsDeleted = false,
ParentId = shenzhenDept.Id
};
entities.Add(szDept1);
DeptEntity szDept2 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "市场部门",
OrderNum = 100,
IsDeleted = false,
ParentId = shenzhenDept.Id
};
entities.Add(szDept2);
DeptEntity szDept3 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "测试部门",
OrderNum = 100,
IsDeleted = false,
ParentId = shenzhenDept.Id
};
entities.Add(szDept3);
DeptEntity szDept4 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "财务部门",
OrderNum = 100,
IsDeleted = false,
ParentId = shenzhenDept.Id
};
entities.Add(szDept4);
DeptEntity szDept5 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "运维部门",
OrderNum = 100,
IsDeleted = false,
ParentId = shenzhenDept.Id
};
entities.Add(szDept5);
DeptEntity jxDept1 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "市场部门",
OrderNum = 100,
IsDeleted = false,
ParentId = jiangxiDept.Id
};
entities.Add(jxDept1);
DeptEntity jxDept2 = new DeptEntity(_guidGenerator.Create())
{
DeptName = "财务部门",
OrderNum = 100,
IsDeleted = false,
ParentId = jiangxiDept.Id
};
entities.Add(jxDept2);
return entities;
}
}
}

View File

@@ -0,0 +1,401 @@
using SqlSugar;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class DictionaryDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<DictionaryEntity> _repository;
public DictionaryDataSeed(ISqlSugarRepository<DictionaryEntity> repository)
{
_repository= repository;
}
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => true))
{
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<DictionaryEntity> GetSeedData()
{
List<DictionaryEntity> entities = new List<DictionaryEntity>();
DictionaryEntity dictInfo1 = new DictionaryEntity()
{
DictLabel = "男",
DictValue = "0",
DictType = "sys_user_sex",
OrderNum = 100,
Remark = "性别男",
IsDeleted = false,
State = true
};
entities.Add(dictInfo1);
DictionaryEntity dictInfo2 = new DictionaryEntity()
{
DictLabel = "女",
DictValue = "1",
DictType = "sys_user_sex",
OrderNum = 99,
Remark = "性别女",
IsDeleted = false,
State = true
};
entities.Add(dictInfo2);
DictionaryEntity dictInfo3 = new DictionaryEntity()
{
DictLabel = "未知",
DictValue = "2",
DictType = "sys_user_sex",
OrderNum = 98,
Remark = "性别未知",
IsDeleted = false,
State = true
};
entities.Add(dictInfo3);
DictionaryEntity dictInfo4 = new DictionaryEntity()
{
DictLabel = "显示",
DictValue = "true",
DictType = "sys_show_hide",
OrderNum = 100,
Remark = "显示菜单",
IsDeleted = false,
State = true
};
entities.Add(dictInfo4);
DictionaryEntity dictInfo5 = new DictionaryEntity()
{
DictLabel = "隐藏",
DictValue = "false",
DictType = "sys_show_hide",
OrderNum = 99,
Remark = "隐藏菜单",
IsDeleted = false,
State = true
};
entities.Add(dictInfo5);
DictionaryEntity dictInfo6 = new DictionaryEntity()
{
DictLabel = "正常",
DictValue = "true",
DictType = "sys_normal_disable",
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo6);
DictionaryEntity dictInfo7 = new DictionaryEntity()
{
DictLabel = "停用",
DictValue = "false",
DictType = "sys_normal_disable",
OrderNum = 99,
Remark = "停用状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo7);
DictionaryEntity dictInfo8 = new DictionaryEntity()
{
DictLabel = "正常",
DictValue = "0",
DictType = "sys_job_status",
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo8);
DictionaryEntity dictInfo9 = new DictionaryEntity()
{
DictLabel = "暂停",
DictValue = "1",
DictType = "sys_job_status",
OrderNum = 99,
Remark = "停用状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo9);
DictionaryEntity dictInfo10 = new DictionaryEntity()
{
DictLabel = "默认",
DictValue = "DEFAULT",
DictType = "sys_job_group",
OrderNum = 100,
Remark = "默认分组",
IsDeleted = false,
State = true
};
entities.Add(dictInfo10);
DictionaryEntity dictInfo11 = new DictionaryEntity()
{
DictLabel = "系统",
DictValue = "SYSTEM",
DictType = "sys_job_group",
OrderNum = 99,
Remark = "系统分组",
IsDeleted = false,
State = true
};
entities.Add(dictInfo11);
DictionaryEntity dictInfo12 = new DictionaryEntity()
{
DictLabel = "是",
DictValue = "Y",
DictType = "sys_yes_no",
OrderNum = 100,
Remark = "系统默认是",
IsDeleted = false,
State = true
};
entities.Add(dictInfo12);
DictionaryEntity dictInfo13 = new DictionaryEntity()
{
DictLabel = "否",
DictValue = "N",
DictType = "sys_yes_no",
OrderNum = 99,
Remark = "系统默认否",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo13);
DictionaryEntity dictInfo14 = new DictionaryEntity()
{
DictLabel = "通知",
DictValue = "1",
DictType = "sys_notice_type",
OrderNum = 100,
Remark = "通知",
IsDeleted = false,
State = true
};
entities.Add(dictInfo14);
DictionaryEntity dictInfo15 = new DictionaryEntity()
{
DictLabel = "公告",
DictValue = "2",
DictType = "sys_notice_type",
OrderNum = 99,
Remark = "公告",
IsDeleted = false,
State = true
};
entities.Add(dictInfo15);
DictionaryEntity dictInfo16 = new DictionaryEntity()
{
DictLabel = "正常",
DictValue = "0",
DictType = "sys_notice_status",
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo16);
DictionaryEntity dictInfo17 = new DictionaryEntity()
{
DictLabel = "关闭",
DictValue = "1",
DictType = "sys_notice_status",
OrderNum = 99,
Remark = "关闭状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo17);
DictionaryEntity dictInfo18 = new DictionaryEntity()
{
DictLabel = "新增",
DictValue = "1",
DictType = "sys_oper_type",
OrderNum = 100,
Remark = "新增操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo18);
DictionaryEntity dictInfo19 = new DictionaryEntity()
{
DictLabel = "修改",
DictValue = "2",
DictType = "sys_oper_type",
OrderNum = 99,
Remark = "修改操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo19);
DictionaryEntity dictInfo22 = new DictionaryEntity()
{
DictLabel = "删除",
DictValue = "3",
DictType = "sys_oper_type",
OrderNum = 98,
Remark = "删除操作",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo22);
DictionaryEntity dictInfo23 = new DictionaryEntity()
{
DictLabel = "授权",
DictValue = "4",
DictType = "sys_oper_type",
OrderNum = 97,
Remark = "授权操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo23);
DictionaryEntity dictInfo24 = new DictionaryEntity()
{
DictLabel = "导出",
DictValue = "5",
DictType = "sys_oper_type",
OrderNum = 96,
Remark = "导出操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo24);
DictionaryEntity dictInfo25 = new DictionaryEntity()
{
DictLabel = "导入",
DictValue = "6",
DictType = "sys_oper_type",
OrderNum = 95,
Remark = "导入操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo25);
DictionaryEntity dictInfo26 = new DictionaryEntity()
{
DictLabel = "强退",
DictValue = "7",
DictType = "sys_oper_type",
OrderNum = 94,
Remark = "强退操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo26);
DictionaryEntity dictInfo27 = new DictionaryEntity()
{
DictLabel = "生成代码",
DictValue = "8",
DictType = "sys_oper_type",
OrderNum = 93,
Remark = "生成代码操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo27);
DictionaryEntity dictInfo28 = new DictionaryEntity()
{
DictLabel = "清空数据",
DictValue = "9",
DictType = "sys_oper_type",
OrderNum = 92,
Remark = "清空数据操作",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo28);
DictionaryEntity dictInfo20 = new DictionaryEntity()
{
DictLabel = "成功",
DictValue = "false",
DictType = "sys_common_status",
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo20);
DictionaryEntity dictInfo21 = new DictionaryEntity()
{
DictLabel = "失败",
DictValue = "true",
DictType = "sys_common_status",
OrderNum = 99,
Remark = "失败状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo21);
return entities;
}
}
}

View File

@@ -0,0 +1,148 @@
using SqlSugar;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class DictionaryTypeDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<DictionaryTypeEntity> _repository;
public DictionaryTypeDataSeed(ISqlSugarRepository<DictionaryTypeEntity> repository)
{
_repository = repository;
}
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => true))
{
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<DictionaryTypeEntity> GetSeedData()
{
List<DictionaryTypeEntity> entities = new List<DictionaryTypeEntity>();
DictionaryTypeEntity dict1 = new DictionaryTypeEntity()
{
DictName = "用户性别",
DictType = "sys_user_sex",
OrderNum = 100,
Remark = "用户性别列表",
IsDeleted = false,
State = true
};
entities.Add(dict1);
DictionaryTypeEntity dict2 = new DictionaryTypeEntity()
{
DictName = "菜单状态",
DictType = "sys_show_hide",
OrderNum = 100,
Remark = "菜单状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict2);
DictionaryTypeEntity dict3 = new DictionaryTypeEntity()
{
DictName = "系统开关",
DictType = "sys_normal_disable",
OrderNum = 100,
Remark = "系统开关列表",
IsDeleted = false,
State = true
};
entities.Add(dict3);
DictionaryTypeEntity dict4 = new DictionaryTypeEntity()
{
DictName = "任务状态",
DictType = "sys_job_status",
OrderNum = 100,
Remark = "任务状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict4);
DictionaryTypeEntity dict5 = new DictionaryTypeEntity()
{
DictName = "任务分组",
DictType = "sys_job_group",
OrderNum = 100,
Remark = "任务分组列表",
IsDeleted = false,
State = true
};
entities.Add(dict5);
DictionaryTypeEntity dict6 = new DictionaryTypeEntity()
{
DictName = "系统是否",
DictType = "sys_yes_no",
OrderNum = 100,
Remark = "系统是否列表",
IsDeleted = false,
State = true
};
entities.Add(dict6);
DictionaryTypeEntity dict7 = new DictionaryTypeEntity()
{
DictName = "通知类型",
DictType = "sys_notice_type",
OrderNum = 100,
Remark = "通知类型列表",
IsDeleted = false,
State = true
};
entities.Add(dict7);
DictionaryTypeEntity dict8 = new DictionaryTypeEntity()
{
DictName = "通知状态",
DictType = "sys_notice_status",
OrderNum = 100,
Remark = "通知状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict8);
DictionaryTypeEntity dict9 = new DictionaryTypeEntity()
{
DictName = "操作类型",
DictType = "sys_oper_type",
OrderNum = 100,
Remark = "操作类型列表",
IsDeleted = false,
State = true
};
entities.Add(dict9);
DictionaryTypeEntity dict10 = new DictionaryTypeEntity()
{
DictName = "系统状态",
DictType = "sys_common_status",
OrderNum = 100,
Remark = "登录状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict10);
return entities;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class PostDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<PostEntity> _repository;
public PostDataSeed(ISqlSugarRepository<PostEntity> repository)
{
_repository = repository;
}
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => true))
{
await _repository.InsertManyAsync(GetSeedData());
}
}
public List<PostEntity> GetSeedData()
{
var entites = new List<PostEntity>();
PostEntity Post1 = new PostEntity()
{
PostName = "董事长",
PostCode = "ceo",
OrderNum = 100,
IsDeleted = false
};
entites.Add(Post1);
PostEntity Post2 = new PostEntity()
{
PostName = "项目经理",
PostCode = "se",
OrderNum = 100,
IsDeleted = false
};
entites.Add(Post2);
PostEntity Post3 = new PostEntity()
{
PostName = "人力资源",
PostCode = "hr",
OrderNum = 100,
IsDeleted = false
};
entites.Add(Post3);
PostEntity Post4 = new PostEntity()
{
PostName = "普通员工",
PostCode = "user",
OrderNum = 100,
IsDeleted = false
};
entites.Add(Post4);
return entites;
}
}
}

View File

@@ -0,0 +1,80 @@
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.Rbac.Domain.Shared.Enums;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class RoleDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<RoleEntity> _repository;
public RoleDataSeed(ISqlSugarRepository<RoleEntity> repository)
{
_repository = repository;
}
public List<RoleEntity> GetSeedData()
{
var entities = new List<RoleEntity>();
RoleEntity role1 = new RoleEntity()
{
RoleName = "管理员",
RoleCode = "admin",
DataScope = DataScopeEnum.ALL,
OrderNum = 999,
Remark = "管理员",
IsDeleted = false
};
entities.Add(role1);
RoleEntity role2 = new RoleEntity()
{
RoleName = "测试角色",
RoleCode = "test",
DataScope = DataScopeEnum.ALL,
OrderNum = 1,
Remark = "测试用的角色",
IsDeleted = false
};
entities.Add(role2);
RoleEntity role3 = new RoleEntity()
{
RoleName = "普通用户",
RoleCode = "common",
DataScope = DataScopeEnum.ALL,
OrderNum = 1,
Remark = "正常用户",
IsDeleted = false
};
entities.Add(role3);
RoleEntity role4 = new RoleEntity()
{
RoleName = "游客用户",
RoleCode = "guest",
DataScope = DataScopeEnum.ALL,
OrderNum = 1,
Remark = "可简单浏览",
IsDeleted = false
};
entities.Add(role4);
return entities;
}
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => true))
{
await _repository.InsertManyAsync(GetSeedData());
}
}
}
}

View File

@@ -0,0 +1,87 @@
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.Rbac.Domain.Shared.Enums;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
{
public class UserDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<UserEntity> _repository;
public UserDataSeed(ISqlSugarRepository<UserEntity> repository)
{
_repository = repository;
}
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => true))
{
var entities = new List<UserEntity>();
UserEntity user1 = new UserEntity()
{
Name = "大橙子",
UserName = "cc",
Nick = "橙子",
Password = "123456",
Email = "454313500@qq.com",
Phone = 13800000000,
Sex = SexEnum.Male,
Address = "深圳",
Age = 20,
Introduction = "还有谁?",
OrderNum = 999,
Remark = "描述是什么呢?",
State = true
};
user1.BuildPassword();
entities.Add(user1);
UserEntity user2 = new UserEntity()
{
Name = "大测试",
UserName = "test",
Nick = "测试",
Password = "123456",
Email = "454313500@qq.com",
Phone = 15900000000,
Sex = SexEnum.Woman,
Address = "深圳",
Age = 18,
Introduction = "还有我!",
OrderNum = 1,
Remark = "我没有描述!",
State = true
};
user2.BuildPassword();
entities.Add(user2);
UserEntity user3 = new UserEntity()
{
Name = "游客",
UserName = "guest",
Nick = "测试",
Password = "123456",
Email = "454313500@qq.com",
Phone = 15900000000,
Sex = SexEnum.Woman,
Address = "深圳",
Age = 18,
Introduction = "临时游客",
OrderNum = 1,
Remark = "懒得创账号",
State = true
};
user3.BuildPassword();
entities.Add(user3);
await _repository.InsertManyAsync(entities);
}
}
}
}

View File

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

View File

@@ -0,0 +1,80 @@
using Mapster;
using SqlSugar;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.Rbac.Domain.Repositories;
using Yi.Framework.Rbac.Domain.Shared.Consts;
using Yi.Framework.Rbac.Domain.Shared.Dtos;
using Yi.Framework.SqlSugarCore.Abstractions;
using Yi.Framework.SqlSugarCore.Repositories;
namespace Yi.Framework.Rbac.SqlSugarCore.Repositories
{
public class UserRepository : SqlSugarRepository<UserEntity>, IUserRepository, ITransientDependency
{
public UserRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
{
}
/// <summary>
/// 获取用户id的全部信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public async Task<UserRoleMenuDto> GetUserAllInfoAsync(Guid userId)
{
var userRoleMenu = new UserRoleMenuDto();
//首先获取到该用户全部信息,导航到角色、菜单,(菜单需要去重,完全交给Set来处理即可)
//得到用户
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);
if (user is null)
{
throw new ArgumentNullException($"参数错误用户id{nameof(userId)} 不存在");
}
user.Password = string.Empty;
user.Salt = string.Empty;
//超级管理员特殊处理
if (UserConst.Admin.Equals(user.UserName))
{
userRoleMenu.User = user.Adapt<UserDto>();
userRoleMenu.RoleCodes.Add(UserConst.AdminRolesCode);
userRoleMenu.PermissionCodes.Add(UserConst.AdminPermissionCode);
return userRoleMenu;
}
//得到角色集合
var roleList = user.Roles;
//得到菜单集合
foreach (var role in roleList)
{
userRoleMenu.RoleCodes.Add(role.RoleCode);
if (role.Menus is not null)
{
foreach (var menu in role.Menus)
{
if (!string.IsNullOrEmpty(menu.PermissionCode))
{
userRoleMenu.PermissionCodes.Add(menu.PermissionCode);
}
userRoleMenu.Menus.Add(menu.Adapt<MenuDto>());
}
}
//刚好可以去除一下多余的导航属性
role.Menus = new List<MenuEntity>();
userRoleMenu.Roles.Add(role.Adapt<RoleDto>());
}
user.Roles = new List<RoleEntity>();
userRoleMenu.User = user.Adapt<UserDto>();
return userRoleMenu;
}
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Mapster\Yi.Framework.Mapster.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.SqlSugarCore\Yi.Framework.SqlSugarCore.csproj" />
<ProjectReference Include="..\Yi.Framework.Rbac.Domain\Yi.Framework.Rbac.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Rbac.SqlSugarCore</name>
</assembly>
<members>
<member name="M:Yi.Framework.Rbac.SqlSugarCore.Repositories.UserRepository.GetUserAllInfoAsync(System.Guid)">
<summary>
获取用户id的全部信息
</summary>
<param name="userId"></param>
<returns></returns>
<exception cref="T:System.ArgumentNullException"></exception>
</member>
</members>
</doc>

View File

@@ -0,0 +1,21 @@
using Volo.Abp.Modularity;
using Yi.Framework.Mapster;
using Yi.Framework.Rbac.Domain;
using Yi.Framework.SqlSugarCore;
namespace Yi.Framework.Rbac.SqlSugarCore
{
[DependsOn(
typeof(YiFrameworkRbacDomainModule),
typeof(YiFrameworkMapsterModule),
typeof(YiFrameworkSqlSugarCoreModule)
)]
public class YiFrameworkRbacSqlSugarCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddYiDbContext<YiRbacDbContext>();
}
}
}

View File

@@ -0,0 +1,44 @@
using Microsoft.Extensions.Logging;
using SqlSugar;
using Volo.Abp.DependencyInjection;
using Yi.Framework.SqlSugarCore;
namespace Yi.Framework.Rbac.SqlSugarCore
{
public class YiRbacDbContext : SqlSugarDbContext
{
public YiRbacDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider)
{
}
protected override void CustomDataFilter()
{
base.CustomDataFilter();
}
protected override void DataExecuted(object oldValue, DataAfterModel entityInfo)
{
base.DataExecuted(oldValue, entityInfo);
}
protected override void DataExecuting(object oldValue, DataFilterModel entityInfo)
{
base.DataExecuting(oldValue, entityInfo);
}
protected override void OnLogExecuting(string sql, SugarParameter[] pars)
{
base.OnLogExecuting(sql,pars);
}
protected override void OnLogExecuted(string sql, SugarParameter[] pars)
{
base.OnLogExecuted(sql, pars);
}
protected override void OnSqlSugarClientConfig(ISqlSugarClient sqlSugarClient)
{
base.OnSqlSugarClientConfig(sqlSugarClient);
}
}
}