/// <summary>
        /// 分页获取
        /// </summary>
        /// <param name="employeePageRequestDto"></param>
        /// <returns></returns>

        public async Task <PageData> GetPageListAsync(EmployeePageRequestDto employeePageRequestDto)
        {
            var pageData = new PageData(employeePageRequestDto.PageIndex, employeePageRequestDto.PageSize);
            var list     = await _employeeRespository.WherePaged(pageData, employeePageRequestDto.GetOrgRoleEmployeeExpression(),
                                                                 e => e.CreateDate, false);

            pageData.Data = list.MapToList <Employee, EmployeeQueryDto>().ToList();
            return(pageData);
        }
Beispiel #2
0
        private async Task <EmployeePageRequestDto> GetRelationEmployeeRoleEmpIds(EmployeePageRequestDto employeePageRequestDto)
        {
            if (!string.IsNullOrEmpty(employeePageRequestDto.RoleId))
            {
                var empIds = await _relationEmployeeRoleAppService.GetEmployeeIdsByRoleIds(new List <string>() { employeePageRequestDto.RoleId });

                if (empIds != null)
                {
                    employeePageRequestDto.Ids = employeePageRequestDto.Ids.Concat(empIds.ToList()).ToList();
                }
            }
            return(employeePageRequestDto);
        }
Beispiel #3
0
        private async Task <EmployeePageRequestDto> GetRelationOranizationEmpIds(EmployeePageRequestDto employeePageRequestDto)
        {
            if (employeePageRequestDto.OrganziationIds != null && employeePageRequestDto.OrganziationIds.Count > 0)
            {
                var empIds = await _relationOrganizationEmployeeAppService.GetEmployeeIdsByOrgIds(employeePageRequestDto.OrganziationIds);

                if (empIds != null)
                {
                    employeePageRequestDto.Ids = employeePageRequestDto.Ids.Concat(empIds).ToList();
                }
            }
            return(employeePageRequestDto);
        }
Beispiel #4
0
        private async Task <EmployeePageRequestDto> GetSubOrganizations(EmployeePageRequestDto employeePageRequestDto)
        {
            if (string.IsNullOrEmpty(employeePageRequestDto.OrganizationId))
            {
                return(employeePageRequestDto);
            }
            var orgid = new List <string>();

            orgid.Add(employeePageRequestDto.OrganizationId);
            var orgIds = await GetSubOrganizations(orgid);

            orgid.AddRange(orgIds);
            employeePageRequestDto.OrganziationIds = orgid;

            return(employeePageRequestDto);
        }
Beispiel #5
0
        /// <summary>
        /// 获取成员信息分页
        /// </summary>
        /// <param name="employeePageRequestDto"></param>
        /// <returns></returns>
        public async Task <PageData> GetListPagedByOrgIdOrRoleId(EmployeePageRequestDto employeePageRequestDto)
        {
            employeePageRequestDto = await GetSubOrganizations(employeePageRequestDto);

            employeePageRequestDto = await GetRelationOranizationEmpIds(employeePageRequestDto);

            employeePageRequestDto = await GetRelationEmployeeRoleEmpIds(employeePageRequestDto);

            var pageData = await _employeeAppService.GetPageListAsync(employeePageRequestDto);

            var employeeDtos = pageData.Data as List <EmployeeQueryDto>;

            await GetRoleAndOrgName(employeeDtos);

            pageData.Data = employeeDtos;
            return(pageData);
        }
Beispiel #6
0
 /// <summary>
 /// 分页获取
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task <PageData> GetPageList(EmployeePageRequestDto input)
 {
     input.InitRequest();
     return(await _employeeAppService.GetPageListAsync(input));
 }
Beispiel #7
0
 /// <summary>
 /// 获取成员信息分页
 /// </summary>
 /// <param name="employeePageRequestDto"></param>
 /// <returns></returns>
 public async Task <PageData> GetListPagedByOrgIdOrRoleId(EmployeePageRequestDto input)
 {
     return(await _employeeDomainService.GetListPagedByOrgIdOrRoleId(input));
 }
Beispiel #8
0
        public static Expression <Func <Employee, bool> > GetOrgRoleEmployeeExpression(this EmployeePageRequestDto employeeQueryRequest)
        {
            var empty = string.Empty;

            Expression <Func <Employee, bool> > employeeExpressionAnd = m => m.Id.ToString() != empty && m.IsDelete == false;

            if (employeeQueryRequest.IsKeySearch)
            {
                if (!string.IsNullOrEmpty(employeeQueryRequest.QueryKey))
                {
                    employeeExpressionAnd = employeeExpressionAnd.And(m =>
                                                                      m.Name.Contains(employeeQueryRequest.QueryKey) ||
                                                                      m.Mobile.Contains(employeeQueryRequest.QueryKey) ||
                                                                      (m.Position != null && m.Position.Contains(employeeQueryRequest.QueryKey)) ||
                                                                      (m.Email != null && m.Email.Contains(employeeQueryRequest.QueryKey)), employeeQueryRequest.QueryKey);
                }
            }
            else
            {
                employeeExpressionAnd = employeeExpressionAnd.And(m => employeeQueryRequest.Ids.Contains(m.Id), employeeQueryRequest.Ids);
            }
            return(employeeExpressionAnd);
        }