平安校园
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

37 строки
1.5 KiB

  1. using SafeCampus.Application.Services.Business.PassengerFlowService.Dto;
  2. namespace SafeCampus.Application.Services.Business.PassengerFlowService;
  3. public class PassengerFlowService:DbRepository<PassengerFlow>, IPassengerFlowService
  4. {
  5. public async Task<bool> Add(PassengerFlowDto input)
  6. {
  7. //var model = input.Adapt<PassengerFlow>();
  8. var model = new PassengerFlow
  9. {
  10. CameraIds = string.Join("、", input.CameraIds),
  11. CameraNames = string.Join("、",input.CameraNames),
  12. EndTime = input.EndTime,
  13. ExtJson = input.ExtJson,
  14. QueryTime = DateTime.Now,
  15. Split = input.Split,
  16. StartTime = input.StartTime,
  17. Total = input.Total
  18. };
  19. await InsertAsync(model);
  20. return true;
  21. }
  22. public async Task<SqlSugarPagedList<PassengerFlowDto>> GetPageList(PassengerFlowSearch search)
  23. {
  24. var query = Context.Queryable<PassengerFlow>()
  25. .WhereIF(search.Split.HasValue, x => x.Split == search.Split)
  26. .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraIds.Contains(search.CameraId))
  27. .WhereIF(search.StartTime.HasValue, x => x.QueryTime >= search.StartTime)
  28. .WhereIF(search.EndTime.HasValue, x => x.QueryTime <= search.EndTime);
  29. var list = await query.OrderByDescending(x => x.QueryTime)
  30. .ToPagedListAsyncMapster<PassengerFlow, PassengerFlowDto>(search.PageNum, search.PageSize);
  31. return list;
  32. }
  33. }