update:循环引用了 先去掉
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Ewide.Application.Service
|
|||||||
[HttpPost("/houseMember/page")]
|
[HttpPost("/houseMember/page")]
|
||||||
public async Task<dynamic> QueryMemberPageList([FromBody] UserInput input)
|
public async Task<dynamic> QueryMemberPageList([FromBody] UserInput input)
|
||||||
{
|
{
|
||||||
var dataScopes = await _userManager.GetUserDataScopeIdList();
|
var dataScopes = await _sysUserService.GetUserDataScopeIdList();
|
||||||
|
|
||||||
var sql = @"SELECT
|
var sql = @"SELECT
|
||||||
SU.*,
|
SU.*,
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ namespace Ewide.Core.Controller
|
|||||||
{
|
{
|
||||||
private readonly IAreaCodeService _areaCodeService;
|
private readonly IAreaCodeService _areaCodeService;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
public AreaCodeController(IAreaCodeService areaCodeService, IUserManager userManager)
|
private readonly ISysUserService _sysUserService;
|
||||||
|
public AreaCodeController(IAreaCodeService areaCodeService, IUserManager userManager, ISysUserService sysUserService)
|
||||||
{
|
{
|
||||||
_areaCodeService = areaCodeService;
|
_areaCodeService = areaCodeService;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
_sysUserService = sysUserService;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询
|
/// 查询
|
||||||
@@ -86,7 +88,7 @@ namespace Ewide.Core.Controller
|
|||||||
List<string> areaCodeList = null;
|
List<string> areaCodeList = null;
|
||||||
if (!_userManager.SuperAdmin)
|
if (!_userManager.SuperAdmin)
|
||||||
{
|
{
|
||||||
var orgIdList = await _userManager.GetUserDataScopeIdList();
|
var orgIdList = await _sysUserService.GetUserDataScopeIdList();
|
||||||
areaCodeList = await _areaCodeService.GetAreaCodeListByOrgId(orgIdList);
|
areaCodeList = await _areaCodeService.GetAreaCodeListByOrgId(orgIdList);
|
||||||
}
|
}
|
||||||
return await _areaCodeService.GetAreaCodeTree(level, areaCodeList);
|
return await _areaCodeService.GetAreaCodeTree(level, areaCodeList);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Ewide.Core.Entity;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -24,6 +23,5 @@ namespace Ewide.Core
|
|||||||
Task<List<SysRole>> GetUserRoleList(string userId);
|
Task<List<SysRole>> GetUserRoleList(string userId);
|
||||||
Task<List<SysRole>> GetUserRoleList();
|
Task<List<SysRole>> GetUserRoleList();
|
||||||
Task<List<string>> GetLoginPermissionList();
|
Task<List<string>> GetLoginPermissionList();
|
||||||
Task<List<string>> GetUserDataScopeIdList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,9 +20,10 @@ namespace Ewide.Core
|
|||||||
private readonly IRepository<SysUserRole> _sysUserRoleRep;
|
private readonly IRepository<SysUserRole> _sysUserRoleRep;
|
||||||
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
|
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
|
||||||
private readonly IRepository<SysOrg> _sysOrgRep;
|
private readonly IRepository<SysOrg> _sysOrgRep;
|
||||||
|
private readonly IRepository<SysRoleMenu> _sysRoleMenuRep;
|
||||||
|
private readonly IRepository<SysMenu> _sysMenuRep;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly ISysMenuService _sysMenuService;
|
private readonly ISysCacheService _sysCacheService;
|
||||||
private readonly ISysUserService _sysUserService;
|
|
||||||
|
|
||||||
public string UserId
|
public string UserId
|
||||||
{
|
{
|
||||||
@@ -55,9 +56,7 @@ namespace Ewide.Core
|
|||||||
IRepository<SysUserRole> sysUserRoleRep,
|
IRepository<SysUserRole> sysUserRoleRep,
|
||||||
IRepository<SysEmp> sysEmpRep,
|
IRepository<SysEmp> sysEmpRep,
|
||||||
IRepository<SysOrg> sysOrgRep,
|
IRepository<SysOrg> sysOrgRep,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor, ISysCacheService sysCacheService, IRepository<SysRoleMenu> sysRoleMenuRep, IRepository<SysMenu> sysMenuRep)
|
||||||
ISysMenuService sysMenuService,
|
|
||||||
ISysUserService sysUserService)
|
|
||||||
{
|
{
|
||||||
_sysUserRep = sysUserRep;
|
_sysUserRep = sysUserRep;
|
||||||
_sysRoleRep = sysRoleRep;
|
_sysRoleRep = sysRoleRep;
|
||||||
@@ -65,8 +64,9 @@ namespace Ewide.Core
|
|||||||
_sysEmpRep = sysEmpRep;
|
_sysEmpRep = sysEmpRep;
|
||||||
_sysOrgRep = sysOrgRep;
|
_sysOrgRep = sysOrgRep;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_sysMenuService = sysMenuService;
|
_sysCacheService = sysCacheService;
|
||||||
_sysUserService = sysUserService;
|
_sysRoleMenuRep = sysRoleMenuRep;
|
||||||
|
_sysMenuRep = sysMenuRep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -171,13 +171,25 @@ namespace Ewide.Core
|
|||||||
return await GetUserRoleList(UserId);
|
return await GetUserRoleList(UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<string>> GetLoginPermissionList()
|
public async Task<List<string>> GetLoginPermissionList()
|
||||||
{
|
{
|
||||||
return _sysMenuService.GetLoginPermissionList(UserId);
|
var permissions = await _sysCacheService.GetPermission(UserId); // 先从缓存里面读取
|
||||||
}
|
if (permissions == null || permissions.Count < 1)
|
||||||
public Task<List<string>> GetUserDataScopeIdList()
|
|
||||||
{
|
{
|
||||||
return _sysUserService.GetUserDataScopeIdList(UserId);
|
var roleIdList = await GetUserRoleIdList();
|
||||||
|
var menuIdList = await _sysRoleMenuRep.DetachedEntities
|
||||||
|
.Where(u => roleIdList.Contains(u.SysRoleId))
|
||||||
|
.Select(u => u.SysMenuId).ToListAsync();
|
||||||
|
permissions = await _sysMenuRep.DetachedEntities.Where(u => menuIdList.Contains(u.Id))
|
||||||
|
.Where(u => u.Type == (int)MenuType.FUNCTION)
|
||||||
|
.Where(u => u.Status == (int)CommonStatus.ENABLE)
|
||||||
|
.Select(u => u.Permission).ToListAsync();
|
||||||
|
#if DEBUG
|
||||||
|
#else
|
||||||
|
await _sysCacheService.SetPermission(userId, permissions); // 缓存结果
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return permissions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Database.Migrations",
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Web.Entry", "Ewide.Web.Entry\Ewide.Web.Entry.csproj", "{9826E365-EEE9-4721-A738-B02AB64D47E5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Web.Entry", "Ewide.Web.Entry\Ewide.Web.Entry.csproj", "{9826E365-EEE9-4721-A738-B02AB64D47E5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ewide.Test", "Ewide.Test\Ewide.Test.csproj", "{DECE4796-6B13-4607-9C27-C1FE093D4DC8}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Test", "Ewide.Test\Ewide.Test.csproj", "{DECE4796-6B13-4607-9C27-C1FE093D4DC8}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|||||||
Reference in New Issue
Block a user