You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB
C#

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) => new RoleModulePermission()
{
Role = r,
Module = m,
IsDeleted = rmp.IsDeleted
},
(rmp, m, r) => rmp.IsDeleted == false && m.IsDeleted == false && r.IsDeleted == false
);
}
}
}