//----------SysRoleMenu开始----------
using System.Collections.Generic;
using System.Threading.Tasks;
using SqlSugar;
using Admin.Core.IRepository.ISys;
using Admin.Core.Model.Sys;
namespace Admin.Core.Repository.Sys
{
///
/// 角色和菜单关联表Repository
///
public class SysRoleMenuRepository : BaseRepository, ISysRoleMenuRepository
{
public SysRoleMenuRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
//public async Task> QueryMuchTable()
//{
// return await QueryMuch(
// (rmp, m, p) => new object[] {
// JoinType.Left, rmp.ModuleId == m.Id,
// JoinType.Left, rmp.PermissionId == p.Id
// },
// (rmp, m, p) => new TestMuchTableResult()
// {
// moduleName = m.Name,
// permName = p.Name,
// rid = rmp.RoleId,
// mid = rmp.ModuleId,
// pid = rmp.PermissionId
// },
// (rmp, m, p) => rmp.IsDeleted == false
// );
//}
///
/// 角色权限Map
/// SysRoleMenu, Module, Role 三表联合
/// 第四个类型 SysRoleMenu 是返回值
///
///
//public async Task> RoleModuleMaps()
//{
// return await QueryMuch(
// (rmp, m, r) => new object[] {
// JoinType.Left, rmp.MenuID == m.MenuID,
// JoinType.Left, rmp.RoleID == r.RoleID
// },
// (rmp, m, r) => new SysRoleMenu()
// {
// SysRole = r,
// Module = m,
// IsDeleted = rmp.IsDeleted
// },
// (rmp, m, r) => rmp.IsDeleted == false && m.IsDeleted == false && r.IsDeleted == false
// );
// return null;
//}
///
/// 查询出角色-菜单-接口关系表全部Map属性数据
///
///
//public async Task> GetRMPMaps()
//{
// return await Db.Queryable()
// .Mapper(rmp => rmp.Module, rmp => rmp.ModuleId)
// .Mapper(rmp => rmp.Permission, rmp => rmp.PermissionId)
// .Mapper(rmp => rmp.Role, rmp => rmp.RoleId)
// .Where(d => d.IsDeleted == false)
// .ToListAsync();
//}
///
/// 查询出角色-菜单-接口关系表全部Map属性数据
///
///
//public async Task> GetRMPMapsPage()
//{
// return await Db.Queryable()
// .Mapper(rmp => rmp.Module, rmp => rmp.ModuleId)
// .Mapper(rmp => rmp.Permission, rmp => rmp.PermissionId)
// .Mapper(rmp => rmp.Role, rmp => rmp.RoleId)
// .ToPageListAsync(1, 5, 10);
//}
///
/// 批量更新菜单与接口的关系
///
/// 菜单主键
/// 接口主键
///
//public async Task UpdateModuleId(int permissionId, int moduleId)
//{
// await Db.Updateable(it => it.ModuleId == moduleId).Where(
// it => it.PermissionId == permissionId).ExecuteCommandAsync();
//}
}
}
//----------SysRoleMenu结束----------