public List <ZtreeDto> GetRoleMenuTree(string roleid) { var menu = _sysmenuRepository.Queryable <sys_menu>().OrderBy(s => s.menu_sort).Select(s => new ZtreeDto() { id = s.id.ToString(), name = s.menu_name, pId = s.parent_id.ToString() }).ToList(); var func = Sqldb.Queryable <sys_menu_ref_operate, sys_operate, sys_menu>((f, o, m) => f.operate_id == o.id && f.menu_id == m.id).Select((f, o, m) => new ZtreeDto() { id = f.operate_id.ToString(), pId = f.menu_id.ToString(), name = o.func_cname }).ToList(); menu.AddRange(func); var role = _sysroleauthorizeRepository.Queryable <sys_role_authorize>().Where(s => s.role_id == SqlFunc.ToInt64(roleid)).Select(s => new { s.menu_id, s.menu_pid }).ToList(); if (role.Any()) { foreach (var item in menu) { var isok = role.Where(s => s.menu_id == item.id.ToInt64() && s.menu_pid == item.pId.ToInt64()).Count(); if (isok > 0) { item.checkstate = true; } } } return(menu); }
public List <sys_menu> GetMenuList(BootstrapGridDto param) { var query = _sysmenuRepository.Queryable <sys_menu>().OrderBy(s => s.menu_sort).ToList(); return(query); }