using Longbow.Data; using System.Collections.Generic; namespace Bootstrap.DataAccess { /// /// /// public static class RoleHelper { /// /// 查询所有角色 /// /// /// public static IEnumerable RetrieveRoles(int id = 0) => DbAdapterManager.Create().RetrieveRoles(id); /// /// 保存用户角色关系 /// /// /// /// public static bool SaveRolesByUserId(int id, IEnumerable roleIds) => DbAdapterManager.Create().SaveRolesByUserId(id, roleIds); /// /// 查询某个用户所拥有的角色 /// /// public static IEnumerable RetrieveRolesByUserId(int userId) => DbAdapterManager.Create().RetrieveRolesByUserId(userId); /// /// 删除角色表 /// /// public static bool DeleteRole(IEnumerable value) => DbAdapterManager.Create().DeleteRole(value); /// /// 保存新建/更新的角色信息 /// /// /// public static bool SaveRole(Role p) => DbAdapterManager.Create().SaveRole(p); /// /// 查询某个菜单所拥有的角色 /// /// /// public static IEnumerable RetrieveRolesByMenuId(int menuId) => DbAdapterManager.Create().RetrieveRolesByMenuId(menuId); /// /// /// /// /// /// public static bool SavaRolesByMenuId(int id, IEnumerable roleIds) => DbAdapterManager.Create().SavaRolesByMenuId(id, roleIds); /// /// 根据GroupId查询和该Group有关的所有Roles /// /// /// public static IEnumerable RetrieveRolesByGroupId(int groupId) => DbAdapterManager.Create().RetrieveRolesByGroupId(groupId); /// /// 根据GroupId更新Roles信息,删除旧的Roles信息,插入新的Roles信息 /// /// /// /// public static bool SaveRolesByGroupId(int id, IEnumerable roleIds) => DbAdapterManager.Create().SaveRolesByGroupId(id, roleIds); /// /// /// /// /// public static IEnumerable RetrieveRolesByUserName(string userName) => DbAdapterManager.Create().RetrieveRolesByUserName(userName); /// /// /// /// /// public static IEnumerable RetrieveRolesByUrl(string url) => DbAdapterManager.Create().RetrieveRolesByUrl(url); } }