using SafeCampus.Application.Services.Business.PassengerFlowService.Dto; namespace SafeCampus.Application.Services.Business.PassengerFlowService; public class PassengerFlowService:DbRepository, IPassengerFlowService { public async Task Add(PassengerFlowDto input) { //var model = input.Adapt(); var model = new PassengerFlow { CameraIds = string.Join("、", input.CameraIds), CameraNames = string.Join("、",input.CameraNames), EndTime = input.EndTime, ExtJson = input.ExtJson, QueryTime = DateTime.Now, Split = input.Split, StartTime = input.StartTime, Total = input.Total }; await InsertAsync(model); return true; } public async Task> GetPageList(PassengerFlowSearch search) { var query = Context.Queryable() .WhereIF(search.Split.HasValue, x => x.Split == search.Split) .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraIds.Contains(search.CameraId)) .WhereIF(search.StartTime.HasValue, x => x.QueryTime >= search.StartTime) .WhereIF(search.EndTime.HasValue, x => x.QueryTime <= search.EndTime); var list = await query.OrderByDescending(x => x.QueryTime) .ToPagedListAsyncMapster(search.PageNum, search.PageSize); return list; } }