|
|
|
using EntrustSettle.IRepository;
|
|
|
|
using EntrustSettle.Model.Models;
|
|
|
|
using EntrustSettle.Repository.Base;
|
|
|
|
using SqlSugar;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using EntrustSettle.Repository.UnitOfWorks;
|
|
|
|
|
|
|
|
namespace EntrustSettle.Repository
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// RoleModulePermissionRepository
|
|
|
|
/// </summary>
|
|
|
|
public class RoleModulePermissionRepository : BaseRepository<RoleModulePermission>, IRoleModulePermissionRepository
|
|
|
|
{
|
|
|
|
public RoleModulePermissionRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 角色权限Map
|
|
|
|
/// RoleModulePermission, Module, Role 三表联合
|
|
|
|
/// 第四个类型 RoleModulePermission 是返回值
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<List<RoleModulePermission>> RoleModuleMaps()
|
|
|
|
{
|
|
|
|
return await Db.Queryable<RoleModulePermission, Modules, Role>(
|
|
|
|
(rmp, m, r) => new object[] {
|
|
|
|
JoinType.Left, rmp.ModuleId == m.Id,
|
|
|
|
JoinType.Left, rmp.RoleId == r.Id
|
|
|
|
})
|
|
|
|
.Where((rmp, m, r) => rmp.IsDeleted == false && m.IsDeleted == false && r.IsDeleted == false)
|
|
|
|
.Select((rmp, m, r) => new RoleModulePermission()
|
|
|
|
{
|
|
|
|
Role = r,
|
|
|
|
Module = m,
|
|
|
|
IsDeleted = rmp.IsDeleted
|
|
|
|
})
|
|
|
|
.ToListAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|