增加数据权限

This commit is contained in:
不做码农
2022-01-22 20:47:48 +08:00
parent f5f5000854
commit bf26823a85
10 changed files with 275 additions and 118 deletions

View File

@@ -3,6 +3,7 @@ using Infrastructure.Attribute;
using Infrastructure.Enums;
using Microsoft.AspNetCore.Mvc;
using System.Collections;
using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.Common;
using ZR.Model.System;
@@ -73,6 +74,24 @@ namespace ZR.Admin.WebApi.Controllers.System
return SUCCESS(DeptService.BuildDeptTreeSelect(depts), TIME_FORMAT_FULL);
}
/// <summary>
/// 获取角色部门信息
/// 加载对应角色部门列表树
/// </summary>
/// <param name="roleId"></param>
/// <returns></returns>
[HttpGet("roleDeptTreeselect/{roleId}")]
public IActionResult RoleMenuTreeselect(int roleId)
{
var depts = DeptService.GetSysDepts(new SysDept());
var checkedKeys = DeptService.SelectRoleDepts(roleId);
return SUCCESS(new
{
checkedKeys,
depts = DeptService.BuildDeptTreeSelect(depts),
});
}
/// <summary>
/// 根据部门编号获取详细信息
/// </summary>

View File

@@ -103,13 +103,10 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ApiResult.Error($"编辑角色'{sysRoleDto.RoleName}'失败,角色权限已存在"));
}
}
sysRoleDto.Update_by = User.Identity.Name;
int upResult = sysRoleService.UpdateRole(sysRoleDto);
if (upResult > 0)
{
//TODO 更新缓存用户权限信息
return SUCCESS(upResult);
}
return ToResponse(ApiResult.Error($"修改角色'{sysRoleDto.RoleName}'失败,请联系管理员"));