hutongqing
2024-11-27 b6edde9c340c41d617842370b3a8190cda7c0508
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/Sys_MenuRepository.cs
@@ -1,10 +1,13 @@
锘縰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;
@@ -16,14 +19,16 @@
{
    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;
@@ -31,11 +36,11 @@
                {
                    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;