|
@@ -9,7 +9,7 @@ using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using XF.Domain.Dependency;
|
|
|
|
|
|
-namespace Hotline.Repository.SqlSugar
|
|
|
+namespace Hotline.Repository.SqlSugar.System
|
|
|
{
|
|
|
public class SystemMenuRepository : BaseRepository<SystemMenu>, ISystemMenuRepository, IScopeDependency
|
|
|
{
|
|
@@ -20,8 +20,8 @@ namespace Hotline.Repository.SqlSugar
|
|
|
public async Task<IReadOnlyList<SystemMenu>> GetSystemMenus()
|
|
|
{
|
|
|
var list = await Db.Queryable<SystemMenu>()
|
|
|
- .OrderBy(x=>x.DisplayOrder)
|
|
|
- .Includes(t=>t.ButtonArr)
|
|
|
+ .OrderBy(x => x.DisplayOrder)
|
|
|
+ .Includes(t => t.ButtonArr)
|
|
|
.ToTreeAsync(x => x.children, it => it.ParentId, "");
|
|
|
return list;
|
|
|
}
|
|
@@ -32,7 +32,7 @@ namespace Hotline.Repository.SqlSugar
|
|
|
/// </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)
|
|
|
{
|
|
|
var list = await Db.Queryable<SystemAuthority>()
|
|
|
.Where(x => roles.Contains(x.RoleCode)).ToListAsync();
|
|
@@ -43,11 +43,11 @@ namespace Hotline.Repository.SqlSugar
|
|
|
}
|
|
|
var model = await Db.Queryable<UserFastMenu>().FirstAsync(x => x.UserId == userId);
|
|
|
var perList = new List<string>();
|
|
|
- if (model!=null)
|
|
|
+ if (model != null)
|
|
|
{
|
|
|
perList = permissionarr.Except(model.FastMenuArr).ToList();
|
|
|
}
|
|
|
- if (perList.Count>0)
|
|
|
+ if (perList.Count > 0)
|
|
|
{
|
|
|
//过滤已存在的
|
|
|
var menulist = await Db.Queryable<SystemMenu>()
|
|
@@ -60,7 +60,7 @@ namespace Hotline.Repository.SqlSugar
|
|
|
.Where(x => x.IsFast).ToListAsync();
|
|
|
return menulist;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -69,7 +69,7 @@ namespace Hotline.Repository.SqlSugar
|
|
|
/// <param name="roles"></param>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<IReadOnlyList<SystemMenu>> GetMyFastMenu(string[] roles,string userId)
|
|
|
+ public async Task<IReadOnlyList<SystemMenu>> GetMyFastMenu(string[] roles, string userId)
|
|
|
{
|
|
|
var list = await Db.Queryable<SystemAuthority>()
|
|
|
.Where(x => roles.Contains(x.RoleCode)).ToListAsync();
|
|
@@ -79,7 +79,7 @@ namespace Hotline.Repository.SqlSugar
|
|
|
permissionarr.AddRange(item.SystemMenuArr);
|
|
|
}
|
|
|
var model = await Db.Queryable<UserFastMenu>().FirstAsync(x => x.UserId == userId);
|
|
|
- if (model!=null)
|
|
|
+ if (model != null)
|
|
|
{
|
|
|
var perList = permissionarr.Intersect(model.FastMenuArr).ToList();
|
|
|
return await Db.Queryable<SystemMenu>().Where(x => perList.Contains(x.PermissionCode)).ToListAsync();
|