平安校园
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

AttendanceService.cs 2.3 KiB

pirms 4 mēnešiem
pirms 3 mēnešiem
pirms 4 mēnešiem
pirms 3 mēnešiem
pirms 4 mēnešiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. namespace SafeCampus.Application.Services.Business.AttendanceService;
  2. public class AttendanceService:DbRepository<Attendance>, IAttendanceService
  3. {
  4. public async Task<bool> Add(AttendanceDto input)
  5. {
  6. var model = input.Adapt<Attendance>();
  7. await InsertAsync(model);
  8. return true;
  9. }
  10. public async Task<SqlSugarPagedList<AttendanceList>> GetPageList(AttendanceSearch search)
  11. {
  12. var query = Context.Queryable<Attendance>()
  13. //.Includes(x => x.CameraInfoItem)
  14. .WhereIF(search.IsAuto.HasValue, x => x.IsAuto == search.IsAuto)
  15. .WhereIF(!string.IsNullOrEmpty(search.PersonSetId), x => x.PersonSetId == search.PersonSetId)
  16. .WhereIF(!string.IsNullOrEmpty(search.PersonId), x => x.PersonId == search.PersonId)
  17. .WhereIF(!string.IsNullOrEmpty(search.TrackId), x => x.TrackId == search.TrackId)
  18. .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraId == search.CameraId)
  19. .WhereIF(search.StartTick.HasValue, x => x.Tick >= search.StartTick)
  20. .WhereIF(search.EndTick.HasValue, x => x.Tick <= search.EndTick);
  21. var list = await query.OrderByDescending(x => x.Tick)
  22. .ToPagedListAsyncMapster<Attendance, AttendanceList>(search.PageNum, search.PageSize);
  23. return list;
  24. }
  25. public async Task<List<AttendanceList>> GetNoPageList(AttendanceSearch search)
  26. {
  27. var query = Context.Queryable<Attendance>()
  28. //.Includes(x => x.CameraInfoItem)
  29. .WhereIF(search.IsAuto.HasValue, x => x.IsAuto == search.IsAuto)
  30. .WhereIF(!string.IsNullOrEmpty(search.PersonSetId), x => x.PersonSetId == search.PersonSetId)
  31. .WhereIF(!string.IsNullOrEmpty(search.PersonId), x => x.PersonId == search.PersonId)
  32. .WhereIF(!string.IsNullOrEmpty(search.TrackId), x => x.TrackId == search.TrackId)
  33. .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraId == search.CameraId)
  34. .WhereIF(search.StartTick.HasValue, x => x.Tick >= search.StartTick)
  35. .WhereIF(search.EndTick.HasValue, x => x.Tick <= search.EndTick);
  36. var list = await query.OrderByDescending(x => x.Tick)
  37. .ToListAsync();
  38. return list.Adapt<List<AttendanceList>>();
  39. }
  40. }