| | |
| | | using System; |
| | | using AutoMapper; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_DTO.System; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.Helper; |
| | |
| | | { |
| | | public class Sys_MenuRepository : RepositoryBase<Sys_Menu>, ISys_MenuRepository |
| | | { |
| | | public Sys_MenuRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | private readonly IMapper _mapper; |
| | | public Sys_MenuRepository(IUnitOfWorkManage unitOfWorkManage, IMapper mapper) : base(unitOfWorkManage) |
| | | { |
| | | _mapper = mapper; |
| | | } |
| | | |
| | | public List<Sys_Menu> GetAllMenu() |
| | | public List<MenuDTO> GetAllMenu() |
| | | { |
| | | List<Sys_Menu> _menus = base.QueryData(x => x.Enable == 1 || x.Enable == 2).OrderByDescending(a => a.OrderNo).ThenByDescending(q => q.ParentId).ToList(); |
| | | |
| | | List<Sys_Menu> menus = base.QueryData(x => x.Enable == 1 || x.Enable == 2).OrderByDescending(a => a.OrderNo).ThenByDescending(q => q.ParentId).ToList(); |
| | | List<MenuDTO> _menus = _mapper.Map<List<MenuDTO>>(menus); |
| | | _menus.ForEach(x => |
| | | { |
| | | x.MenuType ??= 0; |
| | |
| | | { |
| | | try |
| | | { |
| | | x.Actions = x.Auth.DeserializeObject<List<Sys_Actions>>(); |
| | | x.Actions = x.Auth.DeserializeObject<List<ActionDTO>>(); |
| | | } |
| | | catch { } |
| | | } |
| | | x.Actions ??= new List<Sys_Actions>(); |
| | | x.Actions ??= new List<ActionDTO>(); |
| | | }); |
| | | string test = _menus.Serialize(); |
| | | return _menus; |
| | |
| | | { |
| | | //没有redis/memory缓存角色的版本号或与当前服务器的角色版本号不同时,刷新缓存 |
| | | |
| | | List<Permissions> _permissions = QueryTabs<Sys_Menu, Sys_RoleAuth, Permissions>((a, b) => new object[] { a.MenuId, b.MenuId }, (a, b) => new Permissions { MenuId = a.MenuId, ParentId = a.ParentId, TableName = (a.TableName ?? "").ToLower(), MenuAuth = a.Auth, UserAuth = b.AuthValue ?? "", MenuType = a.MenuType ?? 0 }, x => true); |
| | | List<Permissions> _permissions = QueryTabs<Sys_Menu, Sys_RoleAuth, Permissions>((a, b) => new object[] { JoinType.Inner, a.MenuId == b.MenuId }, (a, b) => new Permissions { MenuId = a.MenuId, ParentId = a.ParentId, TableName = (a.TableName ?? "").ToLower(), MenuAuth = a.Auth, UserAuth = b.AuthValue ?? "", MenuType = a.MenuType ?? 0 }, (a, b) => b.RoleId == roleId, x => true); |
| | | |
| | | ActionToArray(_permissions); |
| | | |