public DepartmentSearchOutput GetAll(DepartmentSearchInput input) { if (input == null) { input = new DepartmentSearchInput(); } Logger.Info(" 查询部门信息,查询内容: " + input); var departmentAll = _departmentRepository.GetAllList(); var total = departmentAll.Count; departmentAll.WhereIf(!string.IsNullOrWhiteSpace(input.DepartmentName), r => r.DepartmentName.Contains(input.DepartmentName)); if (departmentAll == null) { throw new UserFriendlyException("未查询到数据。"); } Mapper.CreateMap <Core.System.Department, DepartmentBaseDto>(); var rows = departmentAll.MapTo <List <DepartmentBaseDto> >(); rows = rows.Skip(input.Offset).Take(input.Limit).ToList(); return(new DepartmentSearchOutput { Total = total, Rows = rows }); }
public DepartmentSearchOutput GetDpartmentsSearch(DepartmentSearchInput input) { var parentSearch = input.SearchList.FirstOrDefault(f => f.Name == "ParentName"); if (parentSearch != null) { input.SearchList.Remove(parentSearch); parentSearch.Name = "Parent.Name"; input.SearchList.Add(parentSearch); } var rowCount = 0; var navs = _departmentManagerManager.Query.SearchByInputDto(input, out rowCount); var outPut = new DepartmentSearchOutput() { Datas = navs.ToList().Select(s => s.MapTo <DepartmentOutput>()).ToList(), Page = new Pager(input.Page) { TotalCount = rowCount } }; return(outPut); }
public ActionResult IndexList(DepartmentSearchInput input) { return(Json(_departmentService.GetAll(input))); }