Parcourir la source

可选快速入口新增查询条件

Dun.Jason il y a 2 ans
Parent
commit
ae05b83b73

+ 3 - 3
src/Hotline.Api/Controllers/HomeController.cs

@@ -74,13 +74,13 @@ public class HomeController : BaseController
     /// </summary>
     /// <returns></returns>
     [AllowAnonymous]
-    [HttpGet("get-fastmenu")]
-    public async Task<IReadOnlyList<SystemMenu>> GetFastMenuByToken()
+    [HttpPost("get-fastmenu")]
+    public async Task<IReadOnlyList<SystemMenu>> GetFastMenuByToken([FromBody]GetFastMenuByTokenDto dto)
     {
         if (!string.IsNullOrEmpty(_sessionContext.UserId))
         {
             var roles = _sessionContext.Roles;
-            return await _systemMenuRepository.GetFastMenu(roles, _sessionContext.UserId);
+            return await _systemMenuRepository.GetFastMenu(roles, _sessionContext.UserId,dto.name);
         }
         throw UserFriendlyException.SameMessage("无效登录信息");
     }

+ 2 - 2
src/Hotline.Repository.SqlSugar/System/SystemMenuRepository.cs

@@ -33,7 +33,7 @@ namespace Hotline.Repository.SqlSugar.System
         /// </summary>
         /// <param name="roles"></param>
         /// <returns></returns>
-        public async Task<IReadOnlyList<SystemMenu>> GetFastMenu(string[] roles, string userId)
+        public async Task<IReadOnlyList<SystemMenu>> GetFastMenu(string[] roles, string userId,string name)
         {
             var list = await Db.Queryable<SystemAuthority>()
                 .Where(x => roles.Contains(x.RoleCode)).ToListAsync();
@@ -52,7 +52,7 @@ namespace Hotline.Repository.SqlSugar.System
             {
                 //过滤已存在的
                 var menulist = await Db.Queryable<SystemMenu>()
-               .Where(x => x.IsFast && perList.Contains(x.PermissionCode)).ToListAsync();
+               .Where(x => x.IsFast && perList.Contains(x.PermissionCode) && x.PageName.Contains(name)).ToListAsync();
                 return menulist;
             }
             else

+ 5 - 0
src/Hotline.Share/Dtos/Home/HomeDto.cs

@@ -10,4 +10,9 @@ namespace Hotline.Share.Dtos.Home
     {
         public List<string> FastMenuArr { get; set; }
     }
+
+    public record GetFastMenuByTokenDto
+    {
+        public string name { get; set; }
+    }
 }

+ 1 - 1
src/Hotline/Settings/ISystemMenuRepository.cs

@@ -12,7 +12,7 @@ namespace Hotline.Settings
         /// </summary>
         /// <param name="roles"></param>
         /// <returns></returns>
-        Task<IReadOnlyList<SystemMenu>> GetFastMenu(string[] roles,string userId);
+        Task<IReadOnlyList<SystemMenu>> GetFastMenu(string[] roles,string userId,string name);
 
         /// <summary>
         /// 获取我的快速入口