|
|
|
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 QueryMuch<RoleModulePermission, Modules, Role, RoleModulePermission>(
|
|
|
|
(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
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|