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.
115 lines
3.8 KiB
C#
115 lines
3.8 KiB
C#
1 year ago
|
|
||
|
//----------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
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 角色和菜单关联表Repository
|
||
|
/// </summary>
|
||
|
public class SysRoleMenuRepository : BaseRepository<SysRoleMenu>, ISysRoleMenuRepository
|
||
|
{
|
||
|
public SysRoleMenuRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
//public async Task<List<TestMuchTableResult>> QueryMuchTable()
|
||
|
//{
|
||
|
// return await QueryMuch<SysRoleMenu, Modules, Permission, TestMuchTableResult>(
|
||
|
// (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
|
||
|
// );
|
||
|
//}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 角色权限Map
|
||
|
/// SysRoleMenu, Module, Role 三表联合
|
||
|
/// 第四个类型 SysRoleMenu 是返回值
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
//public async Task<List<SysRoleMenu>> RoleModuleMaps()
|
||
|
//{
|
||
|
// return await QueryMuch<SysRoleMenu, SysMenu, SysRole, SysRoleMenu>(
|
||
|
// (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;
|
||
|
//}
|
||
|
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询出角色-菜单-接口关系表全部Map属性数据
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
//public async Task<List<SysRoleMenu>> GetRMPMaps()
|
||
|
//{
|
||
|
// return await Db.Queryable<SysRoleMenu>()
|
||
|
// .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();
|
||
|
//}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询出角色-菜单-接口关系表全部Map属性数据
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
//public async Task<List<SysRoleMenu>> GetRMPMapsPage()
|
||
|
//{
|
||
|
// return await Db.Queryable<SysRoleMenu>()
|
||
|
// .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);
|
||
|
//}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 批量更新菜单与接口的关系
|
||
|
/// </summary>
|
||
|
/// <param name="permissionId">菜单主键</param>
|
||
|
/// <param name="moduleId">接口主键</param>
|
||
|
/// <returns></returns>
|
||
|
//public async Task UpdateModuleId(int permissionId, int moduleId)
|
||
|
//{
|
||
|
// await Db.Updateable<SysRoleMenu>(it => it.ModuleId == moduleId).Where(
|
||
|
// it => it.PermissionId == permissionId).ExecuteCommandAsync();
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
//----------SysRoleMenu结束----------
|