|  |  |  | 
|---|
|  |  |  | 锘縰sing SqlSugar; | 
|---|
|  |  |  | 锘縰sing 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; | 
|---|