public List <ModuleEntity> GetMenuList(string roleId) { var data = new List <ModuleEntity>(); if (OperatorProvider.Provider.GetCurrent().IsSystem) { data = moduleApp.GetList(); } else { var moduledata = moduleApp.GetList(); //var authorizedata = service.IQueryable(t => t.F_ObjectId == roleId && t.F_ItemType == 1).ToList(); var authorizedata = service.FindList("select * from Sys_RoleAuthorize where F_ItemType=1 and '" + roleId + "' like '%'+ F_ObjectId +'%'"); foreach (var item in authorizedata) { if (data.Exists(t => t.F_Id == item.F_ItemId) == false) { ModuleEntity moduleEntity = moduledata.Find(t => t.F_Id == item.F_ItemId); if (moduleEntity != null) { data.Add(moduleEntity); } } } } return(data.OrderBy(t => t.F_SortCode).ToList()); }
/// <summary> /// 使用sql查询 /// </summary> /// <param name="enCode"></param> /// <returns></returns> public List <RoleAuthorizeEntity> FildSql(string enCode) { StringBuilder strSql = new StringBuilder(); strSql.Append(enCode); return(service.FindList(strSql.ToString()).ToList()); }
/// <summary> /// 获得用户的所有权限信息列表【分页】 /// </summary> /// <param name="ObjectId"></param> /// <returns></returns> public List <RoleAuthorizeEntity> GetList(Pagination pagination, string ObjectId) { var expression = ExtLinq.True <RoleAuthorizeEntity>(); if (!string.IsNullOrEmpty(ObjectId)) { expression = expression.And(t => t.F_ObjectId.Contains(ObjectId)); } ResultClass <List <RoleAuthorizeEntity> > _ret = service.FindList(expression, pagination); if (_ret.Result) { return(_ret.ResultData.OrderBy(t => t.F_SortCode).ToList()); } return(new List <RoleAuthorizeEntity>()); }