From a38b50675f2cf8e813bd337ca2f9d9456cc421d3 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期四, 17 十月 2024 09:50:14 +0800 Subject: [PATCH] WCS --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_RoleController.cs | 86 +++++++++++++++++++++--------------------- 1 files changed, 43 insertions(+), 43 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_RoleController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_RoleController.cs" index cd3cd9f..28ca857 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_RoleController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_RoleController.cs" @@ -1,4 +1,4 @@ -锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using WIDESEA_Core; @@ -8,57 +8,57 @@ using WIDESEA_IServices; using WIDESEA_Model.Models; using WIDESEA_Model.Models.System; +namespace WIDESEA_WMSServer.Controllers{ -namespace WIDESEA_WMSServer.Controllers.System +[Route("api/Sys_Role")] +[ApiController] +public class Sys_RoleController : ApiBaseController<ISys_RoleService, Sys_Role> { - [Route("api/Sys_Role")] - [ApiController] - public class Sys_RoleController : ApiBaseController<ISys_RoleService, Sys_Role> + private readonly IHttpContextAccessor _httpContextAccessor; + + public Sys_RoleController(ISys_RoleService service, IHttpContextAccessor httpContextAccessor) : base(service) { - private readonly IHttpContextAccessor _httpContextAccessor; - public Sys_RoleController(ISys_RoleService service, IHttpContextAccessor httpContextAccessor) : base(service) - { - _httpContextAccessor = httpContextAccessor; - } + _httpContextAccessor = httpContextAccessor; + } - [HttpPost, Route("getUserChildRoles")] - public IActionResult GetUserChildRoles() - { - int roleId = App.User.RoleId; - var data = Service.GetAllChildren(roleId); + [HttpPost, Route("getUserChildRoles")] + public IActionResult GetUserChildRoles() + { + int roleId = App.User.RoleId; + var data = Service.GetAllChildren(roleId); - if (App.User.IsSuperAdmin) - { - return Json(WebResponseContent.Instance.OK(null, data)); - } - //涓嶆槸瓒呯骇绠$悊锛屽皢鑷繁鐨勮鑹叉煡鍑烘潵锛屽湪鏍戝舰鑿滃崟涓婁綔涓烘牴鑺傜偣 - var self = data.Where(x => x.Id == roleId) - .Select(s => new RoleNodes() - { - Id = s.Id, - ParentId = 0,//灏嗚嚜宸辩殑瑙掕壊浣滀负root鑺傜偣 - RoleName = s.RoleName - }).ToList(); - data.AddRange(self); + if (App.User.IsSuperAdmin) + { return Json(WebResponseContent.Instance.OK(null, data)); } + //涓嶆槸瓒呯骇绠$悊锛屽皢鑷繁鐨勮鑹叉煡鍑烘潵锛屽湪鏍戝舰鑿滃崟涓婁綔涓烘牴鑺傜偣 + var self = data.Where(x => x.Id == roleId) + .Select(s => new RoleNodes() + { + Id = s.Id, + ParentId = 0,//灏嗚嚜宸辩殑瑙掕壊浣滀负root鑺傜偣 + RoleName = s.RoleName + }).ToList(); + data.AddRange(self); + return Json(WebResponseContent.Instance.OK(null, data)); + } - [HttpPost, Route("getCurrentTreePermission")] - public IActionResult GetCurrentTreePermission() - { - return Json(Service.GetCurrentTreePermission()); - } + [HttpPost, Route("getCurrentTreePermission")] + public IActionResult GetCurrentTreePermission() + { + return Json(Service.GetCurrentTreePermission()); + } - [HttpPost, Route("getUserTreePermission")] - public IActionResult GetUserTreePermission(int roleId) - { - return Json(Service.GetUserTreePermission(roleId)); - } + [HttpPost, Route("getUserTreePermission")] + public IActionResult GetUserTreePermission(int roleId) + { + return Json(Service.GetUserTreePermission(roleId)); + } - [HttpPost, Route("savePermission")] - public IActionResult SavePermission([FromBody] List<UserPermissionDTO> userPermissions, int roleId) - { - return Json(Service.SavePermission(userPermissions, roleId)); - } + [HttpPost, Route("savePermission")] + public IActionResult SavePermission([FromBody] List<UserPermissionDTO> userPermissions, int roleId) + { + return Json(Service.SavePermission(userPermissions, roleId)); } } +} \ No newline at end of file -- Gitblit v1.9.3