using Attribute;
using Model;
using Service;
namespace Services
{
///
/// 角色菜单
///
[AppService(ServiceType = typeof(ISysRoleMenuService), ServiceLifetime = LifeTime.Transient)]
public class SysRoleMenuService : BaseService, ISysRoleMenuService
{
public int AddRoleMenu(List sysRoleMenus)
{
return Insert(sysRoleMenus);
}
public bool CheckMenuExistRole(long menuId)
{
return Count(it => it.MenuId == menuId) > 0;
}
public int DeleteRoleMenuByRoleId(long roleId)
{
return Delete(roleId);
}
public bool DeleteRoleMenuByRoleIdMenuIds(long roleId, long[] menuIds)
{
return Delete(f => f.RoleId == roleId && menuIds.Contains(f.MenuId));
}
///
/// 根据角色获取菜单id
///
///
///
public List SelectRoleMenuByRoleId(long roleId)
{
return GetList(f => f.RoleId == roleId);
}
///
/// 根据用户所有角色获取菜单
///
///
///
public List SelectRoleMenuByRoleIds(long[] roleIds)
{
return GetList(it => roleIds.Contains(it.RoleId));
}
}
}