Browse Source

模块

master
747575620@qq.com 1 year ago
parent
commit
dcecc112bc
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs

+ 11
- 1
backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs View File

@@ -402,8 +402,18 @@
public async Task<bool> AddRoleModule(RoleModuleAddInput input)
{
List<RoleModuleEntity> entitys = new();
var moduleList =await _dbContext.Queryable<ModuleEntity>().ToListAsync();
var parentId = input.ModuleIds.Where(x=>x.ParentId!="").GroupBy(x => x.ParentId).ToList();
foreach (var item in parentId)
{
if (input.ModuleIds.FirstOrDefault(x=>x.ModuleId==item.Key && x.ParentId=="")==null)
{
input.ModuleIds.Add(new RoleModuleDto { ModuleId = item.Key, ParentId = "", RoleId = input.RoleId });
}
}
foreach (var item in input.ModuleIds)
{
RoleModuleEntity entity = new()
{
ModuleId = item.ModuleId,
@@ -433,7 +443,7 @@
[HttpGet]
public async Task<List<RoleModuleOutput>> RoleModuleList(string RoleId)
{
var entitys = await _dbContext.Queryable<RoleModuleEntity>().Where(x => x.RoleId == RoleId).ToListAsync();
var entitys = await _dbContext.Queryable<RoleModuleEntity>().Where(x => x.RoleId == RoleId&&x.ParentId!="").ToListAsync();
var output = entitys.Adapt<List<RoleModuleOutput>>();
return output;
}


Loading…
Cancel
Save