using Infrastructure.Attribute; using ZR.Model.System; namespace ZR.ServiceCore.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.Menu_id == menuId) > 0; } public int DeleteRoleMenuByRoleId(long roleId) { return Delete(roleId); } public bool DeleteRoleMenuByRoleIdMenuIds(long roleId, long[] menuIds) { return Delete(f => f.Role_id == roleId && menuIds.Contains(f.Menu_id)); } /// /// 根据角色获取菜单id /// /// /// public List SelectRoleMenuByRoleId(long roleId) { return GetList(f => f.Role_id == roleId); } /// /// 根据用户所有角色获取菜单 /// /// /// public List SelectRoleMenuByRoleIds(long[] roleIds) { return GetList(it => roleIds.Contains(it.Role_id)); } } }