/// <summary> /// 根据角色查用户数量 /// </summary> /// <param name="userByRoleSearchViewModel"></param> /// <returns></returns> public IQueryable <User_Relate_Info_Role> GetUserByRoleAll(UserByRoleSearchViewModel userByRoleSearchViewModel) { int roleid = userByRoleSearchViewModel.RoleId; var queryResult = DbSet.Where(k => k.Station_InfoId == roleid).Include(p => p.Station_Info); return(queryResult); }
/// <summary> /// 根据角色查用户 /// </summary> /// <param name="userByRoleSearchViewModel"></param> /// <returns></returns> public List <User_Relate_Info_Role> SearchUserInfoByWhere(UserByRoleSearchViewModel userByRoleSearchViewModel) { int SkipNum = userByRoleSearchViewModel.pageViewModel.CurrentPageNum * userByRoleSearchViewModel.pageViewModel.PageSize; int roleid = userByRoleSearchViewModel.RoleId; var queryResult = DbSet.Where(k => k.User_RoleId == roleid && k.User_Info.status == "0").Include(p => p.User_Info).OrderBy(o => o.Id) .Skip(SkipNum) .Take(userByRoleSearchViewModel.pageViewModel.PageSize) .ToList(); return(queryResult); }
//根据角色查询用户 public List <UserSearchMiddlecs> User_By_Role_Search(UserByRoleSearchViewModel userByRoleSearchViewModel) { List <User_Relate_Info_Role> user_Relate_Info_Users = _userRelateInfoRoleRepository.SearchUserInfoByWhere(userByRoleSearchViewModel); List <UserSearchMiddlecs> user_infos = new List <UserSearchMiddlecs>(); foreach (var item in user_Relate_Info_Users) { var user_info_temp = _IMapper.Map <User_Info, UserSearchMiddlecs>(item.User_Info); user_infos.Add(user_info_temp); } return(user_infos); }
public ActionResult <UserByRoleSearchResModel> Manage_User_By_Role_Search(UserByRoleSearchViewModel userByRoleSearchViewModel) { UserByRoleSearchResModel userByRoleSearchResModel = new UserByRoleSearchResModel(); userByRoleSearchResModel.userInfos = _userService.User_By_Role_Search(userByRoleSearchViewModel); userByRoleSearchResModel.IsSuccess = true; userByRoleSearchResModel.TotalNum = _userService.User_By_Role_Get_ALLNum(userByRoleSearchViewModel); userByRoleSearchResModel.baseViewModel.Message = "根据角色查用户成功"; userByRoleSearchResModel.baseViewModel.ResponseCode = 200; _ILogger.Information("根据角色查用户成功"); return(Ok(userByRoleSearchResModel)); }
/// <summary> /// 根据角色查用户数量 /// </summary> /// <param name="userByRoleSearchViewModel"></param> /// <returns></returns> public int User_By_Role_Get_ALLNum(UserByRoleSearchViewModel userByRoleSearchViewModel) { return(_userRelateInfoRoleRepository.GetUserByRoleAll(userByRoleSearchViewModel).Count()); }