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
{
///
/// RoleModulePermissionRepository
///
public class RoleModulePermissionRepository : BaseRepository, IRoleModulePermissionRepository
{
public RoleModulePermissionRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
{
}
///
/// 角色权限Map
/// RoleModulePermission, Module, Role 三表联合
/// 第四个类型 RoleModulePermission 是返回值
///
///
public async Task> RoleModuleMaps()
{
return await QueryMuch(
(rmp, m, r) => new object[] {
JoinType.Left, rmp.ModuleId == m.Id,
JoinType.Left, rmp.RoleId == r.Id
},
(rmp, m, r) => rmp.IsDeleted == false && m.IsDeleted == false && r.IsDeleted == false
,
(rmp, m, r) => new RoleModulePermission()
{
Role = r,
Module = m,
IsDeleted = rmp.IsDeleted
});
}
}
}