平安校园
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

37 líneas
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 = input.CameraIds!=null? string.Join("、", input.CameraIds):"",
  11. CameraNames = input.CameraNames!=null?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. }